|
@@ -34,6 +34,7 @@
|
34
|
34
|
/* === DEFINES === */
|
35
|
35
|
#define OW_REPLACE_VAR 0x500A
|
36
|
36
|
#define OW_REPLACE_TO_VAR 0x500B
|
|
37
|
+#define MAX_NPC_TABLES 4
|
37
|
38
|
|
38
|
39
|
/* === PROTOTYPES === */
|
39
|
40
|
/**
|
|
@@ -44,19 +45,20 @@
|
44
|
45
|
struct npc_type *npc_get_type(u16 npc_id);
|
45
|
46
|
|
46
|
47
|
/* === EXTERN STATICS ===*/
|
47
|
|
-struct npc_type **ow_main_table;
|
48
|
|
-struct npc_type **ow_second_table;
|
49
|
|
-struct npc_type **ow_third_table;
|
|
48
|
+extern struct npc_type **ow_main_table;
|
|
49
|
+extern struct npc_type **ow_second_table;
|
|
50
|
+extern struct npc_type **ow_third_table;
|
|
51
|
+extern struct npc_type **ow_fourth_table;
|
50
|
52
|
|
51
|
53
|
/* === IMPLEMENTATIONS === */
|
52
|
54
|
struct npc_type *npc_get_type(u16 npc_id)
|
53
|
55
|
{
|
54
|
56
|
|
55
|
57
|
/* Not possible in a global scope because of gcc cow magic */
|
56
|
|
- struct npc_type **npc_tables[3] = {ow_main_table, ow_second_table, ow_third_table};
|
|
58
|
+ struct npc_type **npc_tables[MAX_NPC_TABLES] = {ow_main_table, ow_second_table, ow_third_table, ow_fourth_table};
|
57
|
59
|
//struct npc_type** npc_tables[] = {ow_main_table, ow_second_table, ow_third_table};
|
58
|
60
|
u8 table_id = npc_id >> 8;
|
59
|
|
- if (table_id > 2)
|
|
61
|
+ if (table_id > (MAX_NPC_TABLES -1))
|
60
|
62
|
npc_id = (u8)npc_id;
|
61
|
63
|
|
62
|
64
|
u16 replace_ow = var_get(OW_REPLACE_VAR);
|