summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-11-08 03:09:20 +0100
committerHaru <haru@dotalux.com>2013-11-08 03:12:33 +0100
commit0b7b3796ec987cbb1c263722b841cfa5795aa6d3 (patch)
treecc0aa01be6fdb5fa0e7fb0b0a1397bb2d71cbf90 /src
parentbc9743ce3455f9d9cbc9c934b2a19343ad369fc5 (diff)
downloadhercules-0b7b3796ec987cbb1c263722b841cfa5795aa6d3.tar.gz
hercules-0b7b3796ec987cbb1c263722b841cfa5795aa6d3.tar.bz2
hercules-0b7b3796ec987cbb1c263722b841cfa5795aa6d3.tar.xz
hercules-0b7b3796ec987cbb1c263722b841cfa5795aa6d3.zip
Added support for monster spritename constants
- Follow-up to 124ab2a1cdb344f24170a4d91f7000ebabf39b40 - Replaced numeric IDs in NPC definitions and setnpcdisplay calls with the appropriate constants - Made possible thanks to Ind Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r--src/map/mob.c11
-rw-r--r--src/map/mob.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index b8a8ed6c5..c3c6fceee 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3874,6 +3874,7 @@ void mob_readdb(void) {
sv->readdb(map->db_path, filename[fi], ',', 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, -1, mob->readdb_sub);
}
+ mob->name_constants();
}
/*==========================================
@@ -3923,9 +3924,18 @@ int mob_read_sqldb(void) {
ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, mob_db_name[fi]);
}
+ mob->name_constants();
return 0;
}
+void mob_name_constants(void) {
+ int i;
+ 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);
+ }
+}
+
/*==========================================
* MOB display graphic change data reading
*------------------------------------------*/
@@ -4759,6 +4769,7 @@ void mob_defaults(void) {
mob->readdb_sub = mob_readdb_sub;
mob->readdb = mob_readdb;
mob->read_sqldb = mob_read_sqldb;
+ mob->name_constants = mob_name_constants;
mob->readdb_mobavail = mob_readdb_mobavail;
mob->read_randommonster = mob_read_randommonster;
mob->parse_row_chatdb = mob_parse_row_chatdb;
diff --git a/src/map/mob.h b/src/map/mob.h
index 31a8666a2..61f718c30 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -345,6 +345,7 @@ struct mob_interface {
bool (*readdb_sub) (char *fields[], int columns, int current);
void (*readdb) (void);
int (*read_sqldb) (void);
+ void (*name_constants) (void);
bool (*readdb_mobavail) (char *str[], int columns, int current);
int (*read_randommonster) (void);
bool (*parse_row_chatdb) (char **str, const char *source, int line, int *last_msg_id);