summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-05 20:27:08 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-05 20:27:08 +0000
commit61d9a63c900b02ac23a77420e71ee653de6edaa0 (patch)
treec2e8c50c5c71a9d37efee1dbd084390eae444b8b
parent961c1f83daaceecd086816d6fd7a0968c61ec250 (diff)
downloadhercules-61d9a63c900b02ac23a77420e71ee653de6edaa0.tar.gz
hercules-61d9a63c900b02ac23a77420e71ee653de6edaa0.tar.bz2
hercules-61d9a63c900b02ac23a77420e71ee653de6edaa0.tar.xz
hercules-61d9a63c900b02ac23a77420e71ee653de6edaa0.zip
- applied the Ultra Mage's suggestion to have the map server strip trailing spaces/comments from the config files. It will also now print out when an unknown config setting is found.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8642 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--src/map/map.c17
2 files changed, 17 insertions, 3 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 41c72d498..8f99c67f6 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/09/05
+ * Applied the Ultra Mage's suggestion to have the map server strip trailing
+ spaces/comments from the config files. It will also now print out when an
+ unknown config setting is found. [Skotlex]
* Fixed status change resistance not being invoked at all for pretty much
all cases. [Skotlex]
* Corrected SC_INTRAVISION not starting. [Skotlex]
diff --git a/src/map/map.c b/src/map/map.c
index c25c61e79..492283125 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3302,7 +3302,7 @@ int parse_console(char *buf) {
*------------------------------------------
*/
int map_config_read(char *cfgName) {
- char line[1024], w1[1024], w2[1024];
+ char line[1024], w1[1024], w2[1024], *ptr;
FILE *fp;
fp = fopen(cfgName,"r");
@@ -3313,7 +3313,17 @@ int map_config_read(char *cfgName) {
while(fgets(line, sizeof(line) -1, fp)) {
if (line[0] == '/' && line[1] == '/')
continue;
- if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2) {
+
+ if ((ptr = strstr(line, "//")) != NULL)
+ *ptr = '\n'; //Strip comments
+
+ if (sscanf(line, "%[^:]: %[^\t\r\n]", w1, w2) == 2) {
+ //Strip trailing spaces
+ ptr = w2 + strlen(w2);
+ while (--ptr >= w2 && *ptr == ' ');
+ ptr++;
+ *ptr = '\0';
+
if(strcmpi(w1,"timestamp_format")==0){
strncpy(timestamp_format, w2, 20);
} else if(strcmpi(w1,"console_silent")==0){
@@ -3390,7 +3400,8 @@ int map_config_read(char *cfgName) {
enable_spy = 0;
} else if (strcmpi(w1, "import") == 0) {
map_config_read(w2);
- }
+ } else
+ ShowWarning("Unknown setting [%s] in file %s\n", w1, cfgName);
}
}
fclose(fp);