diff options
author | Haru <haru@dotalux.com> | 2013-11-10 05:22:30 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-11-10 05:22:30 +0100 |
commit | dd05ae388d69e7df1dffcd393cea5e4cdc605e75 (patch) | |
tree | ac7454f83fb9d4e2adee0fed59c97c95e569da49 /src/map/npc.c | |
parent | f7f10cf7bb600b6871ed37f493fef18110dc182b (diff) | |
download | hercules-dd05ae388d69e7df1dffcd393cea5e4cdc605e75.tar.gz hercules-dd05ae388d69e7df1dffcd393cea5e4cdc605e75.tar.bz2 hercules-dd05ae388d69e7df1dffcd393cea5e4cdc605e75.tar.xz hercules-dd05ae388d69e7df1dffcd393cea5e4cdc605e75.zip |
Added deprecation messages for incorrect capitalization in scripts
- These messages are temporary, only meant to help those with custom
scripts to transition them to the correct case-sensitive syntax. If
you ignore the deprecation messages you encounter, your scripts may
continue to work just as they did until now, but this will no longer
be true in the near future, and they may stop working at any time.
If you ignore this, and your scripts break, you'll get to keep the
pieces :)
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 03e4aa9fa..5ca96d587 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3627,14 +3627,25 @@ int npc_parsesrcfile(const char* filepath, bool runOnInit) { if( strcasecmp(w2,"warp") == 0 && count > 3 ) { +#ifdef ENABLE_CASE_CHECK + if( strcmp(w2, "warp") != 0 ) DeprecationWarning("npc_parsesrcfile", w2, "warp", filepath, strline(buffer, p-buffer)); // TODO +#endif // ENABLE_CASE_CHECK p = npc->parse_warp(w1,w2,w3,w4, p, buffer, filepath); } else if( (!strcasecmp(w2,"shop") || !strcasecmp(w2,"cashshop")) && count > 3 ) { +#ifdef ENABLE_CASE_CHECK + if( strcasecmp(w2,"shop") == 0 && strcmp(w2, "shop") != 0 ) DeprecationWarning("npc_parsesrcfile", w2, "shop", filepath, strline(buffer, p-buffer)) // TODO + else if( strcasecmp(w2,"cashshop") == 0 && strcmp(w2, "cashshop") != 0 ) DeprecationWarning("npc_parsesrcfile", w2, "cashshop", filepath, strline(buffer, p-buffer)); // TODO +#endif // ENABLE_CASE_CHECK p = npc->parse_shop(w1,w2,w3,w4, p, buffer, filepath); } else if( strcasecmp(w2,"script") == 0 && count > 3 ) { +#ifdef ENABLE_CASE_CHECK + if( strcmp(w2, "script") != 0 ) DeprecationWarning("npc_parsesrcfile", w2, "script", filepath, strline(buffer, p-buffer)); // TODO + if( strcasecmp(w1, "function") == 0 && strcmp(w1, "function") != 0 ) DeprecationWarning("npc_parsesrcfile", w1, "function", filepath, strline(buffer, p-buffer)); // TODO +#endif // ENABLE_CASE_CHECK if( strcasecmp(w1,"function") == 0 ) p = npc->parse_function(w1, w2, w3, w4, p, buffer, filepath); else @@ -3642,14 +3653,25 @@ int npc_parsesrcfile(const char* filepath, bool runOnInit) { } else if( (i=0, sscanf(w2,"duplicate%n",&i), (i > 0 && w2[i] == '(')) && count > 3 ) { +#ifdef ENABLE_CASE_CHECK + char temp[10]; safestrncpy(temp, w2, 10); + if( strcmp(temp, "duplicate") != 0 ) DeprecationWarning("npc_parsesrcfile", temp, "duplicate", filepath, strline(buffer, p-buffer)); // TODO +#endif // ENABLE_CASE_CHECK p = npc->parse_duplicate(w1,w2,w3,w4, p, buffer, filepath); } else if( (strcmpi(w2,"monster") == 0 || strcmpi(w2,"boss_monster") == 0) && count > 3 ) { +#ifdef ENABLE_CASE_CHECK + if( strcasecmp(w2,"monster") == 0 && strcmp(w2, "monster") != 0 ) DeprecationWarning("npc_parsesrcfile", w2, "monster", filepath, strline(buffer, p-buffer)) // TODO: + else if( strcasecmp(w2,"boss_monster") == 0 && strcmp(w2, "boss_monster") != 0 ) DeprecationWarning("npc_parsesrcfile", w2, "boss_monster", filepath, strline(buffer, p-buffer)); // TODO +#endif // ENABLE_CASE_CHECK p = npc->parse_mob(w1, w2, w3, w4, p, buffer, filepath); } else if( strcmpi(w2,"mapflag") == 0 && count >= 3 ) { +#ifdef ENABLE_CASE_CHECK + if( strcmp(w2, "mapflag") != 0 ) DeprecationWarning("npc_parsesrcfile", w2, "mapflag", filepath, strline(buffer, p-buffer)); // TODO +#endif // ENABLE_CASE_CHECK p = npc->parse_mapflag(w1, w2, trim(w3), trim(w4), p, buffer, filepath); } else @@ -3719,6 +3741,9 @@ void npc_read_event_script(void) if( (p=strchr(p,':')) && p && strcmpi(name,p)==0 ) { +#ifdef ENABLE_CASE_CHECK + if( strcmp(name, p) != 0 ) DeprecationWarning2("npc_read_event_script", p, name, config[i].event_name); // TODO +#endif // ENABLE_CASE_CHECK script_event[i].event[count] = ed; script_event[i].event_name[count] = key.str; script_event[i].event_count++; |