summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c4
-rw-r--r--src/map/battleground.c4
-rw-r--r--src/map/map.c4
-rw-r--r--src/map/mapreg.h35
-rw-r--r--src/map/mapreg_sql.c163
-rw-r--r--src/map/script.c38
6 files changed, 145 insertions, 103 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index d9b9543e4..a3c13228a 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8622,7 +8622,7 @@ ACMD(set) {
data->u.str = pc->readregstr(sd, script->add_str(reg));
break;
case '$':
- data->u.str = mapreg_readregstr(script->add_str(reg));
+ data->u.str = mapreg->readregstr(script->add_str(reg));
break;
case '#':
if( reg[1] == '#' )
@@ -8651,7 +8651,7 @@ ACMD(set) {
data->u.num = pc->readreg(sd, script->add_str(reg));
break;
case '$':
- data->u.num = mapreg_readreg(script->add_str(reg));
+ data->u.num = mapreg->readreg(script->add_str(reg));
break;
case '#':
if( reg[1] == '#' )
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 66586c5fe..eb91f0066 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -532,8 +532,8 @@ void bg_begin(struct bg_arena *arena) {
bg->match_over(arena,true);
} else {
arena->ongoing = true;
- mapreg_setreg(script->add_str("$@bg_queue_id"),arena->queue_id);/* TODO: make this a arena-independant var? or just .@? */
- mapreg_setregstr(script->add_str("$@bg_delay_var$"),bg->gdelay_var);
+ mapreg->setreg(script->add_str("$@bg_queue_id"),arena->queue_id);/* TODO: make this a arena-independant var? or just .@? */
+ mapreg->setregstr(script->add_str("$@bg_delay_var$"),bg->gdelay_var);
npc->event_do(arena->npc_event);
/* we split evenly? */
/* but if a party of say 10 joins, it cant be split evenly unless by luck there are 10 soloers in the queue besides them */
diff --git a/src/map/map.c b/src/map/map.c
index e55dea152..a12a6579a 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3469,7 +3469,7 @@ int inter_config_read(char *cfgName) {
else if(strcmpi(w1,"log_db_db")==0)
strcpy(log_db_db, w2);
/* mapreg */
- else if( mapreg_config_read(w1,w2) )
+ else if( mapreg->config_read(w1,w2) )
continue;
/* import */
else if(strcmpi(w1,"import")==0)
@@ -5171,6 +5171,7 @@ void map_hp_symbols(void) {
HPM->share(mob,"mob");
HPM->share(unit,"unit");
HPM->share(npc,"npc");
+ HPM->share(mapreg,"mapreg");
/* partial */
HPM->share(mapit,"mapit");
@@ -5218,6 +5219,7 @@ void map_load_defaults(void) {
mercenary_defaults();
mob_defaults();
unit_defaults();
+ mapreg_defaults();
}
int do_init(int argc, char *argv[])
{
diff --git a/src/map/mapreg.h b/src/map/mapreg.h
index e83f9e053..3c1d0ba0e 100644
--- a/src/map/mapreg.h
+++ b/src/map/mapreg.h
@@ -5,6 +5,9 @@
#ifndef _MAPREG_H_
#define _MAPREG_H_
+#include "../common/cbasetypes.h"
+#include "../common/db.h"
+
struct mapreg_save {
int uid;
union {
@@ -14,14 +17,30 @@ struct mapreg_save {
bool save;
};
-void mapreg_reload(void);
-void mapreg_final(void);
-void mapreg_init(void);
-bool mapreg_config_read(const char* w1, const char* w2);
+struct mapreg_interface {
+ DBMap *db; // int var_id -> int value
+ DBMap *str_db; // int var_id -> char* value
+ struct eri *ers; //[Ind/Hercules]
+ char table[32];
+ bool i_dirty;
+ bool str_dirty;
+ /* */
+ void (*init) (void);
+ void (*final) (void);
+ /* */
+ int (*readreg) (int uid);
+ char* (*readregstr) (int uid);
+ bool (*setreg) (int uid, int val);
+ bool (*setregstr) (int uid, const char *str);
+ void (*load) (void);
+ void (*save) (void);
+ int (*save_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ void (*reload) (void);
+ bool (*config_read) (const char *w1, const char *w2);
+};
+
+struct mapreg_interface *mapreg;
-int mapreg_readreg(int uid);
-char* mapreg_readregstr(int uid);
-bool mapreg_setreg(int uid, int val);
-bool mapreg_setregstr(int uid, const char* str);
+void mapreg_defaults(void);
#endif /* _MAPREG_H_ */
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c
index 4f9888aba..c0bfeb987 100644
--- a/src/map/mapreg_sql.c
+++ b/src/map/mapreg_sql.c
@@ -16,26 +16,19 @@
#include <stdlib.h>
#include <string.h>
-static DBMap* mapreg_db = NULL; // int var_id -> int value
-static DBMap* mapregstr_db = NULL; // int var_id -> char* value
-static struct eri *mapreg_ers; //[Ind/Hercules]
-
-static char mapreg_table[32] = "mapreg";
-static bool mapreg_i_dirty = false;
-static bool mapreg_str_dirty = false;
+struct mapreg_interface mapreg_s;
#define MAPREG_AUTOSAVE_INTERVAL (300*1000)
-
/// Looks up the value of an integer variable using its uid.
int mapreg_readreg(int uid) {
- struct mapreg_save *m = idb_get(mapreg_db, uid);
+ struct mapreg_save *m = idb_get(mapreg->db, uid);
return m?m->u.i:0;
}
/// Looks up the value of a string variable using its uid.
char* mapreg_readregstr(int uid) {
- struct mapreg_save *m = idb_get(mapregstr_db, uid);
+ struct mapreg_save *m = idb_get(mapreg->str_db, uid);
return m?m->u.str:NULL;
}
@@ -47,14 +40,14 @@ bool mapreg_setreg(int uid, int val) {
const char* name = script->get_str(num);
if( val != 0 ) {
- if( (m = idb_get(mapreg_db,uid)) ) {
+ if( (m = idb_get(mapreg->db,uid)) ) {
m->u.i = val;
if(name[1] != '@') {
m->save = true;
- mapreg_i_dirty = true;
+ mapreg->i_dirty = true;
}
} else {
- m = ers_alloc(mapreg_ers, struct mapreg_save);
+ m = ers_alloc(mapreg->ers, struct mapreg_save);
m->u.i = val;
m->uid = uid;
@@ -63,19 +56,19 @@ bool mapreg_setreg(int uid, int val) {
if(name[1] != '@') {// write new variable to database
char tmp_str[32*2+1];
SQL->EscapeStringLen(mmysql_handle, tmp_str, name, strnlen(name, 32));
- if( SQL_ERROR == SQL->Query(mmysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%d','%d')", mapreg_table, tmp_str, i, val) )
+ if( SQL_ERROR == SQL->Query(mmysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%d','%d')", mapreg->table, tmp_str, i, val) )
Sql_ShowDebug(mmysql_handle);
}
- idb_put(mapreg_db, uid, m);
+ idb_put(mapreg->db, uid, m);
}
} else { // val == 0
- if( (m = idb_get(mapreg_db,uid)) ) {
- ers_free(mapreg_ers, m);
+ if( (m = idb_get(mapreg->db,uid)) ) {
+ ers_free(mapreg->ers, m);
}
- idb_remove(mapreg_db,uid);
+ idb_remove(mapreg->db,uid);
if( name[1] != '@' ) {// Remove from database because it is unused.
- if( SQL_ERROR == SQL->Query(mmysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%d'", mapreg_table, name, i) )
+ if( SQL_ERROR == SQL->Query(mmysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%d'", mapreg->table, name, i) )
Sql_ShowDebug(mmysql_handle);
}
}
@@ -92,26 +85,26 @@ bool mapreg_setregstr(int uid, const char* str) {
if( str == NULL || *str == 0 ) {
if(name[1] != '@') {
- if( SQL_ERROR == SQL->Query(mmysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%d'", mapreg_table, name, i) )
+ if( SQL_ERROR == SQL->Query(mmysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%d'", mapreg->table, name, i) )
Sql_ShowDebug(mmysql_handle);
}
- if( (m = idb_get(mapregstr_db,uid)) ) {
+ if( (m = idb_get(mapreg->str_db,uid)) ) {
if( m->u.str != NULL )
aFree(m->u.str);
- ers_free(mapreg_ers, m);
+ ers_free(mapreg->ers, m);
}
- idb_remove(mapregstr_db,uid);
+ idb_remove(mapreg->str_db,uid);
} else {
- if( (m = idb_get(mapregstr_db,uid)) ) {
+ if( (m = idb_get(mapreg->str_db,uid)) ) {
if( m->u.str != NULL )
aFree(m->u.str);
m->u.str = aStrdup(str);
if(name[1] != '@') {
- mapreg_str_dirty = true;
+ mapreg->str_dirty = true;
m->save = true;
}
} else {
- m = ers_alloc(mapreg_ers, struct mapreg_save);
+ m = ers_alloc(mapreg->ers, struct mapreg_save);
m->uid = uid;
m->u.str = aStrdup(str);
@@ -122,10 +115,10 @@ bool mapreg_setregstr(int uid, const char* str) {
char tmp_str2[255*2+1];
SQL->EscapeStringLen(mmysql_handle, tmp_str, name, strnlen(name, 32));
SQL->EscapeStringLen(mmysql_handle, tmp_str2, str, strnlen(str, 255));
- if( SQL_ERROR == SQL->Query(mmysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%d','%s')", mapreg_table, tmp_str, i, tmp_str2) )
+ if( SQL_ERROR == SQL->Query(mmysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%d','%s')", mapreg->table, tmp_str, i, tmp_str2) )
Sql_ShowDebug(mmysql_handle);
}
- idb_put(mapregstr_db, uid, m);
+ idb_put(mapreg->str_db, uid, m);
}
}
@@ -133,7 +126,7 @@ bool mapreg_setregstr(int uid, const char* str) {
}
/// Loads permanent variables from database
-static void script_load_mapreg(void) {
+void script_load_mapreg(void) {
/*
0 1 2
+-------------------------+
@@ -146,7 +139,7 @@ static void script_load_mapreg(void) {
char value[255+1];
uint32 length;
- if ( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `varname`, `index`, `value` FROM `%s`", mapreg_table)
+ if ( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `varname`, `index`, `value` FROM `%s`", mapreg->table)
|| SQL_ERROR == SQL->StmtExecute(stmt)
) {
SqlStmt_ShowDebug(stmt);
@@ -164,59 +157,59 @@ static void script_load_mapreg(void) {
int i = index;
if( varname[length-1] == '$' ) {
- if( idb_exists(mapregstr_db, (i<<24)|s) ) {
+ if( idb_exists(mapreg->str_db, (i<<24)|s) ) {
ShowWarning("load_mapreg: duplicate! '%s' => '%s' skipping...\n",varname,value);
continue;
}
} else {
- if( idb_exists(mapreg_db, (i<<24)|s) ) {
+ if( idb_exists(mapreg->db, (i<<24)|s) ) {
ShowWarning("load_mapreg: duplicate! '%s' => '%s' skipping...\n",varname,value);
continue;
}
}
- m = ers_alloc(mapreg_ers, struct mapreg_save);
+ m = ers_alloc(mapreg->ers, struct mapreg_save);
m->uid = (i<<24)|s;
m->save = false;
if( varname[length-1] == '$' ) {
m->u.str = aStrdup(value);
- idb_put(mapregstr_db, m->uid, m);
+ idb_put(mapreg->str_db, m->uid, m);
} else {
m->u.i = atoi(value);
- idb_put(mapreg_db, m->uid, m);
+ idb_put(mapreg->db, m->uid, m);
}
}
SQL->StmtFree(stmt);
- mapreg_i_dirty = false;
- mapreg_str_dirty = false;
+ mapreg->i_dirty = false;
+ mapreg->str_dirty = false;
}
/// Saves permanent variables to database
-static void script_save_mapreg(void) {
+void script_save_mapreg(void) {
DBIterator* iter;
struct mapreg_save *m = NULL;
- if( mapreg_i_dirty ) {
- iter = db_iterator(mapreg_db);
+ if( mapreg->i_dirty ) {
+ iter = db_iterator(mapreg->db);
for( m = dbi_first(iter); dbi_exists(iter); m = dbi_next(iter) ) {
if( m->save ) {
int num = (m->uid & 0x00ffffff);
int i = (m->uid & 0xff000000) >> 24;
const char* name = script->get_str(num);
- if( SQL_ERROR == SQL->Query(mmysql_handle, "UPDATE `%s` SET `value`='%d' WHERE `varname`='%s' AND `index`='%d' LIMIT 1", mapreg_table, m->u.i, name, i) )
+ if( SQL_ERROR == SQL->Query(mmysql_handle, "UPDATE `%s` SET `value`='%d' WHERE `varname`='%s' AND `index`='%d' LIMIT 1", mapreg->table, m->u.i, name, i) )
Sql_ShowDebug(mmysql_handle);
m->save = false;
}
}
dbi_destroy(iter);
- mapreg_i_dirty = false;
+ mapreg->i_dirty = false;
}
- if( mapreg_str_dirty ) {
- iter = db_iterator(mapregstr_db);
+ if( mapreg->str_dirty ) {
+ iter = db_iterator(mapreg->str_db);
for( m = dbi_first(iter); dbi_exists(iter); m = dbi_next(iter) ) {
if( m->save ) {
int num = (m->uid & 0x00ffffff);
@@ -225,18 +218,18 @@ static void script_save_mapreg(void) {
char tmp_str2[2*255+1];
SQL->EscapeStringLen(mmysql_handle, tmp_str2, m->u.str, safestrnlen(m->u.str, 255));
- if( SQL_ERROR == SQL->Query(mmysql_handle, "UPDATE `%s` SET `value`='%s' WHERE `varname`='%s' AND `index`='%d' LIMIT 1", mapreg_table, tmp_str2, name, i) )
+ if( SQL_ERROR == SQL->Query(mmysql_handle, "UPDATE `%s` SET `value`='%s' WHERE `varname`='%s' AND `index`='%d' LIMIT 1", mapreg->table, tmp_str2, name, i) )
Sql_ShowDebug(mmysql_handle);
m->save = false;
}
}
dbi_destroy(iter);
- mapreg_str_dirty = false;
+ mapreg->str_dirty = false;
}
}
-static int script_autosave_mapreg(int tid, unsigned int tick, int id, intptr_t data) {
- script_save_mapreg();
+int script_autosave_mapreg(int tid, unsigned int tick, int id, intptr_t data) {
+ mapreg->save();
return 0;
}
@@ -245,72 +238,100 @@ void mapreg_reload(void) {
DBIterator* iter;
struct mapreg_save *m = NULL;
- script_save_mapreg();
+ mapreg->save();
- iter = db_iterator(mapreg_db);
+ iter = db_iterator(mapreg->db);
for( m = dbi_first(iter); dbi_exists(iter); m = dbi_next(iter) ) {
- ers_free(mapreg_ers, m);
+ ers_free(mapreg->ers, m);
}
dbi_destroy(iter);
- iter = db_iterator(mapregstr_db);
+ iter = db_iterator(mapreg->str_db);
for( m = dbi_first(iter); dbi_exists(iter); m = dbi_next(iter) ) {
if( m->u.str != NULL ) {
aFree(m->u.str);
}
- ers_free(mapreg_ers, m);
+ ers_free(mapreg->ers, m);
}
dbi_destroy(iter);
- db_clear(mapreg_db);
- db_clear(mapregstr_db);
+ db_clear(mapreg->db);
+ db_clear(mapreg->str_db);
- script_load_mapreg();
+ mapreg->load();
}
void mapreg_final(void) {
DBIterator* iter;
struct mapreg_save *m = NULL;
- script_save_mapreg();
+ mapreg->save();
- iter = db_iterator(mapreg_db);
+ iter = db_iterator(mapreg->db);
for( m = dbi_first(iter); dbi_exists(iter); m = dbi_next(iter) ) {
- ers_free(mapreg_ers, m);
+ ers_free(mapreg->ers, m);
}
dbi_destroy(iter);
- iter = db_iterator(mapregstr_db);
+ iter = db_iterator(mapreg->str_db);
for( m = dbi_first(iter); dbi_exists(iter); m = dbi_next(iter) ) {
if( m->u.str != NULL ) {
aFree(m->u.str);
}
- ers_free(mapreg_ers, m);
+ ers_free(mapreg->ers, m);
}
dbi_destroy(iter);
- db_destroy(mapreg_db);
- db_destroy(mapregstr_db);
+ db_destroy(mapreg->db);
+ db_destroy(mapreg->str_db);
- ers_destroy(mapreg_ers);
+ ers_destroy(mapreg->ers);
}
void mapreg_init(void) {
- mapreg_db = idb_alloc(DB_OPT_BASE);
- mapregstr_db = idb_alloc(DB_OPT_BASE);
- mapreg_ers = ers_new(sizeof(struct mapreg_save), "mapreg_sql.c::mapreg_ers", ERS_OPT_NONE);
+ mapreg->db = idb_alloc(DB_OPT_BASE);
+ mapreg->str_db = idb_alloc(DB_OPT_BASE);
+ mapreg->ers = ers_new(sizeof(struct mapreg_save), "mapreg_sql.c::mapreg_ers", ERS_OPT_NONE);
- script_load_mapreg();
+ mapreg->load();
- iTimer->add_timer_func_list(script_autosave_mapreg, "script_autosave_mapreg");
- iTimer->add_timer_interval(iTimer->gettick() + MAPREG_AUTOSAVE_INTERVAL, script_autosave_mapreg, 0, 0, MAPREG_AUTOSAVE_INTERVAL);
+ iTimer->add_timer_func_list(mapreg->save_timer, "mapreg_script_autosave_mapreg");
+ iTimer->add_timer_interval(iTimer->gettick() + MAPREG_AUTOSAVE_INTERVAL, mapreg->save_timer, 0, 0, MAPREG_AUTOSAVE_INTERVAL);
}
bool mapreg_config_read(const char* w1, const char* w2) {
if(!strcmpi(w1, "mapreg_db"))
- safestrncpy(mapreg_table, w2, sizeof(mapreg_table));
+ safestrncpy(mapreg->table, w2, sizeof(mapreg->table));
else
return false;
return true;
}
+void mapreg_defaults(void) {
+ mapreg = &mapreg_s;
+
+ /* */
+ mapreg->db = NULL;
+ mapreg->str_db = NULL;
+ mapreg->ers = NULL;
+
+ safestrncpy(mapreg->table, "mapreg", sizeof(mapreg->table));
+ mapreg->i_dirty = false;
+ mapreg->str_dirty = false;
+
+ /* */
+ mapreg->init = mapreg_init;
+ mapreg->final = mapreg_final;
+
+ /* */
+ mapreg->readreg = mapreg_readreg;
+ mapreg->readregstr = mapreg_readregstr;
+ mapreg->setreg = mapreg_setreg;
+ mapreg->setregstr = mapreg_setregstr;
+ mapreg->load = script_load_mapreg;
+ mapreg->save = script_save_mapreg;
+ mapreg->save_timer = script_autosave_mapreg;
+ mapreg->reload = mapreg_reload;
+ mapreg->config_read = mapreg_config_read;
+
+}
diff --git a/src/map/script.c b/src/map/script.c
index 391109fa9..fb8a6d8ec 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2341,7 +2341,7 @@ void get_val(struct script_state* st, struct script_data* data)
data->u.str = pc->readregstr(sd, data->u.num);
break;
case '$':
- data->u.str = mapreg_readregstr(data->u.num);
+ data->u.str = mapreg->readregstr(data->u.num);
break;
case '#':
if( name[1] == '#' )
@@ -2396,7 +2396,7 @@ void get_val(struct script_state* st, struct script_data* data)
data->u.num = pc->readreg(sd, data->u.num);
break;
case '$':
- data->u.num = mapreg_readreg(data->u.num);
+ data->u.num = mapreg->readreg(data->u.num);
break;
case '#':
if( name[1] == '#' )
@@ -2459,7 +2459,7 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
case '@':
return pc->setregstr(sd, num, str);
case '$':
- return mapreg_setregstr(num, str);
+ return mapreg->setregstr(num, str);
case '#':
return (name[1] == '#') ?
pc_setaccountreg2str(sd, name, str) :
@@ -2506,7 +2506,7 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
case '@':
return pc->setreg(sd, num, val);
case '$':
- return mapreg_setreg(num, val);
+ return mapreg->setreg(num, val);
case '#':
return (name[1] == '#') ?
pc_setaccountreg2(sd, name, val) :
@@ -3795,7 +3795,7 @@ void do_final_script(void) {
dbi_destroy(iter);
- mapreg_final();
+ mapreg->final();
script->userfunc_db->destroy(script->userfunc_db, db_script_free_code_sub);
script->autobonus_db->destroy(script->autobonus_db, db_script_free_code_sub);
@@ -3864,7 +3864,7 @@ void do_init_script(void) {
script->parse_builtin();
read_constdb();
- mapreg_init();
+ mapreg->init();
}
int script_reload(void) {
@@ -3894,7 +3894,7 @@ int script_reload(void) {
db_clear(script->st_db);
- mapreg_reload();
+ mapreg->reload();
itemdb->force_name_constants();
@@ -6731,19 +6731,19 @@ BUILDIN(getpartymember)
if(p->party.member[i].account_id){
switch (type) {
case 2:
- mapreg_setreg(reference_uid(script->add_str("$@partymemberaid"), j),p->party.member[i].account_id);
+ mapreg->setreg(reference_uid(script->add_str("$@partymemberaid"), j),p->party.member[i].account_id);
break;
case 1:
- mapreg_setreg(reference_uid(script->add_str("$@partymembercid"), j),p->party.member[i].char_id);
+ mapreg->setreg(reference_uid(script->add_str("$@partymembercid"), j),p->party.member[i].char_id);
break;
default:
- mapreg_setregstr(reference_uid(script->add_str("$@partymembername$"), j),p->party.member[i].name);
+ mapreg->setregstr(reference_uid(script->add_str("$@partymembername$"), j),p->party.member[i].name);
}
j++;
}
}
}
- mapreg_setreg(script->add_str("$@partymembercount"),j);
+ mapreg->setreg(script->add_str("$@partymembercount"),j);
return true;
}
@@ -8538,13 +8538,13 @@ BUILDIN(getmobdrops)
if( itemdb->exists(monster->dropitem[i].nameid) == NULL )
continue;
- mapreg_setreg(reference_uid(script->add_str("$@MobDrop_item"), j), monster->dropitem[i].nameid);
- mapreg_setreg(reference_uid(script->add_str("$@MobDrop_rate"), j), monster->dropitem[i].p);
+ mapreg->setreg(reference_uid(script->add_str("$@MobDrop_item"), j), monster->dropitem[i].nameid);
+ mapreg->setreg(reference_uid(script->add_str("$@MobDrop_rate"), j), monster->dropitem[i].p);
j++;
}
- mapreg_setreg(script->add_str("$@MobDrop_count"), j);
+ mapreg->setreg(script->add_str("$@MobDrop_count"), j);
script_pushint(st, 1);
return true;
@@ -10240,7 +10240,7 @@ BUILDIN(warpwaitingpc)
pc->payzeny(sd, cd->zeny, LOG_TYPE_NPC, NULL);
}
- mapreg_setreg(reference_uid(script->add_str("$@warpwaitingpc"), i), sd->bl.id);
+ mapreg->setreg(reference_uid(script->add_str("$@warpwaitingpc"), i), sd->bl.id);
if( strcmp(map_name,"Random") == 0 )
pc->randomwarp(sd,CLR_TELEPORT);
@@ -10249,7 +10249,7 @@ BUILDIN(warpwaitingpc)
else
pc->setpos(sd, mapindex_name2id(map_name), x, y, CLR_OUTSIGHT);
}
- mapreg_setreg(script->add_str("$@warpwaitingpcnum"), i);
+ mapreg->setreg(script->add_str("$@warpwaitingpcnum"), i);
return true;
}
@@ -15757,12 +15757,12 @@ BUILDIN(waitingroom2bg)
for( i = 0; i < n && i < MAX_BG_MEMBERS; i++ )
{
if( (sd = cd->usersd[i]) != NULL && bg_team_join(bg_id, sd) )
- mapreg_setreg(reference_uid(script->add_str("$@arenamembers"), i), sd->bl.id);
+ mapreg->setreg(reference_uid(script->add_str("$@arenamembers"), i), sd->bl.id);
else
- mapreg_setreg(reference_uid(script->add_str("$@arenamembers"), i), 0);
+ mapreg->setreg(reference_uid(script->add_str("$@arenamembers"), i), 0);
}
- mapreg_setreg(script->add_str("$@arenamembersnum"), i);
+ mapreg->setreg(script->add_str("$@arenamembersnum"), i);
script_pushint(st,bg_id);
return true;
}