summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFabian Greffrath2014-09-11 15:15:25 +0200
committerFabian Greffrath2014-09-11 15:15:25 +0200
commit78ca3a89b94dea261c88441df044709dd4ca8e7a (patch)
tree440bd1ed864f28983f87e5ff8a12921e66676b38 /src
parent5f3eb6fee3165a44ca032c9642130dddb2128e1d (diff)
downloadchocolate-doom-78ca3a89b94dea261c88441df044709dd4ca8e7a.tar.gz
chocolate-doom-78ca3a89b94dea261c88441df044709dd4ca8e7a.tar.bz2
chocolate-doom-78ca3a89b94dea261c88441df044709dd4ca8e7a.zip
simplify and generalize deh_allow_extended_strings usage
Diffstat (limited to 'src')
-rw-r--r--src/deh_io.c3
-rw-r--r--src/deh_main.c16
2 files changed, 13 insertions, 6 deletions
diff --git a/src/deh_io.c b/src/deh_io.c
index 46f4c9fb..fa02aa2e 100644
--- a/src/deh_io.c
+++ b/src/deh_io.c
@@ -28,7 +28,6 @@
#include "deh_defs.h"
#include "deh_io.h"
-#include "deh_main.h"
typedef enum
{
@@ -251,7 +250,7 @@ char *DEH_ReadLine(deh_context_t *context, boolean extended)
}
// extended string support
- if (deh_allow_extended_strings && extended && c == '\\')
+ if (extended && c == '\\')
{
c = DEH_GetChar(context);
diff --git a/src/deh_main.c b/src/deh_main.c
index 55e26c70..be1e5611 100644
--- a/src/deh_main.c
+++ b/src/deh_main.c
@@ -88,6 +88,14 @@ static deh_section_t *GetSectionByName(char *name)
{
unsigned int i;
+ // we explicitely do not recognize [STRINGS] sections at all
+ // if extended strings are not allowed
+
+ if (!deh_allow_extended_strings && !strncasecmp("[STRINGS]", name, 9))
+ {
+ return NULL;
+ }
+
for (i=0; deh_section_types[i] != NULL; ++i)
{
if (!strcasecmp(deh_section_types[i]->name, name))
@@ -253,14 +261,14 @@ static void DEH_ParseContext(deh_context_t *context)
DEH_Error(context, "This is not a valid dehacked patch file!");
}
+ // extended string support required?
+
+ bexstr = GetSectionByName("[STRINGS]");
+
// Read the file
for (;;)
{
- // extended string support required?
-
- bexstr = GetSectionByName("[STRINGS]");
-
// read a new line
line = DEH_ReadLine(context, bexstr && current_section == bexstr);