diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-01-04 18:59:50 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-01-04 18:59:50 +0000 |
commit | 53d4cb5c798563c20e4602d5a65eefe00a0ac47c (patch) | |
tree | 85773320978e7ef36f95599be2ef4dd3d1fc2e15 /src | |
parent | 35f6c6cfb89988885f6f2a647cc0fc8dac14f10e (diff) | |
download | hercules-53d4cb5c798563c20e4602d5a65eefe00a0ac47c.tar.gz hercules-53d4cb5c798563c20e4602d5a65eefe00a0ac47c.tar.bz2 hercules-53d4cb5c798563c20e4602d5a65eefe00a0ac47c.tar.xz hercules-53d4cb5c798563c20e4602d5a65eefe00a0ac47c.zip |
* Added support for removal of trailing comments to sv_readdb (bugreport:4680).
- Disabled monster BACSOJIN_T (1996) whose drop White Snake Hat (5411) is not enabled (was hidden by '//', which would cause errors now) (since r14412).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14649 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/common/strlib.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/common/strlib.c b/src/common/strlib.c index 019e2d629..a0cba906c 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -925,6 +925,7 @@ bool sv_readdb(const char* directory, const char* filename, char delim, int minc char** fields; // buffer for fields ([0] is reserved) int columns, fields_length; char path[1024], line[1024]; + char* match; snprintf(path, sizeof(path), "%s/%s", directory, filename); @@ -944,9 +945,12 @@ bool sv_readdb(const char* directory, const char* filename, char delim, int minc while( fgets(line, sizeof(line), fp) ) { lines++; - if( line[0] == '/' && line[1] == '/' ) - continue; - //TODO: strip trailing // comment + + if( ( match = strstr(line, "//") ) != NULL ) + {// strip comments + match[0] = 0; + } + //TODO: strip trailing whitespace if( line[0] == '\0' || line[0] == '\n' || line[0] == '\r') continue; |