summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 2b1a541d8..4db5ce625 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -47,6 +47,7 @@
#include "common/nullpo.h"
#include "common/showmsg.h"
#include "common/socket.h"
+#include "common/sql.h"
#include "common/strlib.h"
#include "common/timer.h"
#include "common/utils.h"
@@ -366,7 +367,7 @@ int npc_event_dequeue(struct map_session_data* sd)
/**
* @see DBCreateData
*/
-DBData npc_event_export_create(DBKey key, va_list args)
+struct DBData npc_event_export_create(union DBKey key, va_list args)
{
struct linkdb_node** head_ptr;
CREATE(head_ptr, struct linkdb_node*, 1);
@@ -1514,8 +1515,9 @@ int npc_buylist_sub(struct map_session_data *sd, struct itemlist *item_list, str
/**
* Loads persistent NPC Market Data from SQL
**/
-void npc_market_fromsql(void) {
- SqlStmt* stmt = SQL->StmtMalloc(map->mysql_handle);
+void npc_market_fromsql(void)
+{
+ struct SqlStmt *stmt = SQL->StmtMalloc(map->mysql_handle);
char name[NAME_LENGTH+1];
int itemid;
int amount;
@@ -1630,7 +1632,7 @@ bool npc_trader_open(struct map_session_data *sd, struct npc_data *nd) {
* @param master id of the original npc
**/
void npc_trader_update(int master) {
- DBIterator* iter;
+ struct DBIterator *iter;
struct block_list* bl;
struct npc_data *master_nd = map->id2nd(master);
@@ -2222,7 +2224,7 @@ int npc_remove_map(struct npc_data* nd) {
/**
* @see DBApply
*/
-int npc_unload_ev(DBKey key, DBData *data, va_list ap)
+int npc_unload_ev(union DBKey key, struct DBData *data, va_list ap)
{
struct event_data* ev = DB->data2ptr(data);
char* npcname = va_arg(ap, char *);
@@ -2237,7 +2239,7 @@ int npc_unload_ev(DBKey key, DBData *data, va_list ap)
/**
* @see DBApply
*/
-int npc_unload_ev_label(DBKey key, DBData *data, va_list ap)
+int npc_unload_ev_label(union DBKey key, struct DBData *data, va_list ap)
{
struct linkdb_node **label_linkdb = DB->data2ptr(data);
struct npc_data* nd = va_arg(ap, struct npc_data *);
@@ -3567,7 +3569,7 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c
}
st = script->alloc_state(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id);
- script->setd_sub(st, NULL, ".@atcmd_command$", 0, (void *)command, NULL);
+ script->setd_sub(st, NULL, ".@atcmd_command$", 0, command, NULL);
len = strlen(message);
if (len) {
@@ -3623,8 +3625,8 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c
*/
const char *npc_parse_function(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval)
{
- DBMap* func_db;
- DBData old_data;
+ struct DBMap *func_db;
+ struct DBData old_data;
struct script_code *scriptroot;
const char* end;
const char* script_start;
@@ -4567,11 +4569,10 @@ void npc_read_event_script(void)
{"Kill NPC Event",script->config.kill_mob_event_name},
};
- for (i = 0; i < NPCE_MAX; i++)
- {
- DBIterator* iter;
- DBKey key;
- DBData *data;
+ for (i = 0; i < NPCE_MAX; i++) {
+ struct DBIterator *iter;
+ union DBKey key;
+ struct DBData *data;
char name[64]="::";
safestrncpy(name+2,config[i].event_name,62);
@@ -4614,7 +4615,7 @@ void npc_read_event_script(void)
/**
* @see DBApply
*/
-int npc_path_db_clear_sub(DBKey key, DBData *data, va_list args)
+int npc_path_db_clear_sub(union DBKey key, struct DBData *data, va_list args)
{
struct npc_path_data *npd = DB->data2ptr(data);
if (npd->path)
@@ -4625,7 +4626,7 @@ int npc_path_db_clear_sub(DBKey key, DBData *data, va_list args)
/**
* @see DBApply
*/
-int npc_ev_label_db_clear_sub(DBKey key, DBData *data, va_list args)
+int npc_ev_label_db_clear_sub(union DBKey key, struct DBData *data, va_list args)
{
struct linkdb_node **label_linkdb = DB->data2ptr(data);
linkdb_final(label_linkdb); // linked data (struct event_data*) is freed when clearing ev_db
@@ -4754,8 +4755,9 @@ int npc_reload(void) {
}
//Unload all npc in the given file
-bool npc_unloadfile( const char* filepath ) {
- DBIterator * iter = db_iterator(npc->name_db);
+bool npc_unloadfile(const char *filepath)
+{
+ struct DBIterator *iter = db_iterator(npc->name_db);
struct npc_data* nd = NULL;
bool found = false;