summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/itemdb.c12
-rw-r--r--src/map/mob.c6
-rw-r--r--src/map/script.c18
-rw-r--r--src/map/script.h6
-rw-r--r--src/map/skill.c6
5 files changed, 43 insertions, 5 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 527972516..bfcc6f795 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1164,6 +1164,9 @@ void itemdb_read_chains(void) {
CREATE(itemdb->chains, struct item_chain, libconfig->setting_length(item_chain_conf.root));
itemdb->chain_count = (unsigned short)libconfig->setting_length(item_chain_conf.root);
+#ifdef ENABLE_CASE_CHECK
+ script->parser_current_file = config_filename;
+#endif // ENABLE_CASE_CHECK
while( (itc = libconfig->setting_get_elem(item_chain_conf.root,i++)) ) {
struct item_data *data = NULL;
struct item_chain_entry *prev = NULL;
@@ -1197,6 +1200,9 @@ void itemdb_read_chains(void) {
count++;
}
+#ifdef ENABLE_CASE_CHECK
+ script->parser_current_file = NULL;
+#endif // ENABLE_CASE_CHECK
libconfig->destroy(&item_chain_conf);
@@ -2230,8 +2236,14 @@ void itemdb_name_constants(void) {
DBIterator *iter = db_iterator(itemdb->names);
struct item_data *data;
+#ifdef ENABLE_CASE_CHECK
+ script->parser_current_file = "Item Database (Likely an invalid or conflicting AegisName)";
+#endif // ENABLE_CASE_CHECK
for( data = dbi_first(iter); dbi_exists(iter); data = dbi_next(iter) )
script->set_constant2(data->name,data->nameid,0);
+#ifdef ENABLE_CASE_CHECK
+ script->parser_current_file = NULL;
+#endif // ENABLE_CASE_CHECK
dbi_destroy(iter);
}
diff --git a/src/map/mob.c b/src/map/mob.c
index dab7b99ac..dc83be93e 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3962,10 +3962,16 @@ int mob_read_sqldb(void) {
void mob_name_constants(void) {
int i;
+#ifdef ENABLE_CASE_CHECK
+ script->parser_current_file = "Mob Database (Likely an invalid or conflicting SpriteName)";
+#endif // ENABLE_CASE_CHECK
for (i = 0; i < MAX_MOB_DB; i++) {
if (mob->db_data[i] && !mob->is_clone(i))
script->set_constant2(mob->db_data[i]->sprite, i, 0);
}
+#ifdef ENABLE_CASE_CHECK
+ script->parser_current_file = NULL;
+#endif // ENABLE_CASE_CHECK
}
/*==========================================
diff --git a/src/map/script.c b/src/map/script.c
index aa3713427..4fb4e7224 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2275,7 +2275,10 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
for(i=0; i<size; i++)
linkdb_final(&script->syntax.curly[i].case_label);
#ifdef ENABLE_CASE_CHECK
- script->local_casecheck.clear();
+ script->local_casecheck.clear();
+ script->parser_current_src = NULL;
+ script->parser_current_file = NULL;
+ script->parser_current_line = 0;
#endif // ENABLE_CASE_CHECK
return NULL;
}
@@ -2292,7 +2295,10 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
script->size = 0;
script->buf = NULL;
#ifdef ENABLE_CASE_CHECK
- script->local_casecheck.clear();
+ script->local_casecheck.clear();
+ script->parser_current_src = NULL;
+ script->parser_current_file = NULL;
+ script->parser_current_line = 0;
#endif // ENABLE_CASE_CHECK
return NULL;
}
@@ -2310,7 +2316,10 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
script->size = 0;
script->buf = NULL;
#ifdef ENABLE_CASE_CHECK
- script->local_casecheck.clear();
+ script->local_casecheck.clear();
+ script->parser_current_src = NULL;
+ script->parser_current_file = NULL;
+ script->parser_current_line = 0;
#endif // ENABLE_CASE_CHECK
return NULL;
}
@@ -2428,6 +2437,9 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
code->script_vars = NULL;
#ifdef ENABLE_CASE_CHECK
script->local_casecheck.clear();
+ script->parser_current_src = NULL;
+ script->parser_current_file = NULL;
+ script->parser_current_line = 0;
#endif // ENABLE_CASE_CHECK
return code;
}
diff --git a/src/map/script.h b/src/map/script.h
index 4906d4fa8..99e53d3b2 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -23,9 +23,11 @@ struct eri;
**/
// TODO: Remove temporary code
#define ENABLE_CASE_CHECK
-#define DeprecationWarning(func, bad, good, file, line) ShowError("%s: use of deprecated keyword '%s' (use '%s' instead) in file '%s', line '%d'.\n", (func), (bad), (good), (file), (line));
-#define DeprecationWarning2(func, bad, good, where) ShowError("%s: detected possible use of wrong case in a script. Found '%s', probably meant to be '%s' (in '%s').\n", (func), (bad), (good), (where));
+#define get_script_source(source) ((source) ? (source) : "Unknown (Possibly source or variables stored in database")
+#define DeprecationWarning(func, bad, good, file, line) ShowError("%s: use of deprecated keyword '%s' (use '%s' instead) in file '%s', line '%d'.\n", (func), (bad), (good), get_script_source(file), (line));
+#define DeprecationWarning2(func, bad, good, where) ShowError("%s: detected possible use of wrong case in a script. Found '%s', probably meant to be '%s' (in '%s').\n", (func), (bad), (good), get_script_source(where));
#define disp_deprecation_message(func, good, p) disp_warning_message(func": use of deprecated keyword (use '"good"' instead).", (p));
+#undef get_script_source
#define NUM_WHISPER_VAR 10
diff --git a/src/map/skill.c b/src/map/skill.c
index 2e520454f..b0c6d7a38 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -18130,7 +18130,13 @@ void skill_readdb(bool minimal) {
safestrncpy(skill->db[0].name, "UNKNOWN_SKILL", sizeof(skill->db[0].name));
safestrncpy(skill->db[0].desc, "Unknown Skill", sizeof(skill->db[0].desc));
+#ifdef ENABLE_CASE_CHECK
+ script->parser_current_file = DBPATH"skill_db.txt";
+#endif // ENABLE_CASE_CHECK
sv->readdb(map->db_path, DBPATH"skill_db.txt", ',', 17, 17, MAX_SKILL_DB, skill->parse_row_skilldb);
+#ifdef ENABLE_CASE_CHECK
+ script->parser_current_file = NULL;
+#endif // ENABLE_CASE_CHECK
if (minimal)
return;