From 251317bd9a36883deffa0be645060c9f6776533b Mon Sep 17 00:00:00 2001 From: Giel van Schijndel Date: Mon, 12 May 2008 18:03:26 +0000 Subject: [PATCH] Cleanup (behaviour should be unchanged) git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5080 4a71c877-e1ca-e34f-864e-861f7616d084 --- lib/framework/resource_parser.y | 79 +++++++++++++++------------------ 1 file changed, 37 insertions(+), 42 deletions(-) diff --git a/lib/framework/resource_parser.y b/lib/framework/resource_parser.y index 91d1f2165..5960f0196 100644 --- a/lib/framework/resource_parser.y +++ b/lib/framework/resource_parser.y @@ -81,52 +81,47 @@ res_line: dir_line | file_line ; -dir_line: DIRECTORY QTEXT_T { - UDWORD len; +dir_line: DIRECTORY QTEXT_T + { + UDWORD len; - // set a new input directory - debug(LOG_NEVER, "directory: %s", $2); - if (strncmp($2, "/:", strlen("/:")) == 0) - { - // the new dir is rooted - strlcpy(aCurrResDir, $2, sizeof(aCurrResDir)); - } - else - { - strlcpy(aCurrResDir, aResDir, sizeof(aCurrResDir)); - strlcat(aCurrResDir, $2, sizeof(aCurrResDir)); - } - if (strlen($2) > 0) - { - // Add a trailing '/' - len = strlen(aCurrResDir); - aCurrResDir[len] = '/'; - aCurrResDir[len+1] = 0; -// debug( LOG_NEVER, "aCurrResDir: %s\n", aCurrResDir); - } - free($2); - } + // set a new input directory + debug(LOG_NEVER, "directory: %s", $2); + if (strncmp($2, "/:", strlen("/:")) == 0) + { + // the new dir is rooted + strlcpy(aCurrResDir, $2, sizeof(aCurrResDir)); + } + else + { + strlcpy(aCurrResDir, aResDir, sizeof(aCurrResDir)); + strlcat(aCurrResDir, $2, sizeof(aCurrResDir)); + } + if (strlen($2) > 0) + { + // Add a trailing '/' + len = strlen(aCurrResDir); + aCurrResDir[len] = '/'; + aCurrResDir[len+1] = 0; + debug(LOG_NEVER, "Current resource directory: %s", aCurrResDir); + } + free($2); + } ; file_line: FILETOKEN TEXT_T QTEXT_T - { - bool succes; - /* load a data file */ - debug(LOG_NEVER, "file: %s %s", $2, $3); - succes = resLoadFile($2, $3); - free($2); - free($3); + { + bool succes; + /* load a data file */ + debug(LOG_NEVER, "file: %s %s", $2, $3); + succes = resLoadFile($2, $3); + free($2); + free($3); - if (!succes) - { - YYABORT; - } - } + if (!succes) + { + YYABORT; + } + } ; - -%% - - - -