diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-08 06:48:16 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-08 06:48:16 +0000 |
commit | b2ad735efc1798101018d4e0973d7bea681a1310 (patch) | |
tree | 63fde029e8036e572b1ae4610b0f7b176b61626d /src | |
parent | 1811436903c5383e8f3eeacdd88bd7eece6c7998 (diff) | |
download | hercules-b2ad735efc1798101018d4e0973d7bea681a1310.tar.gz hercules-b2ad735efc1798101018d4e0973d7bea681a1310.tar.bz2 hercules-b2ad735efc1798101018d4e0973d7bea681a1310.tar.xz hercules-b2ad735efc1798101018d4e0973d7bea681a1310.zip |
- Added function status_change_init to initialize all the sc timers. Added sc_data initialization to the npc structures who were missing them.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5953 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/irc.c | 2 | ||||
-rw-r--r-- | src/map/irc.h | 2 | ||||
-rw-r--r-- | src/map/mob.c | 7 | ||||
-rw-r--r-- | src/map/npc.c | 15 | ||||
-rw-r--r-- | src/map/pc.c | 9 | ||||
-rw-r--r-- | src/map/status.c | 10 | ||||
-rw-r--r-- | src/map/status.h | 1 |
7 files changed, 28 insertions, 18 deletions
diff --git a/src/map/irc.c b/src/map/irc.c index 05cc16d56..0731004c4 100644 --- a/src/map/irc.c +++ b/src/map/irc.c @@ -439,7 +439,7 @@ int get_access(char *nick) { return -1;
}
-int irc_rmnames() {
+int irc_rmnames(void) {
int i=0;
for(i=0;i<=MAX_CHANNEL_USERS;i++) {
diff --git a/src/map/irc.h b/src/map/irc.h index d042fc29a..669f26c03 100644 --- a/src/map/irc.h +++ b/src/map/irc.h @@ -48,4 +48,4 @@ int parse_names_packet(char *str); int parse_names(char *str);
int set_access(char *nick,int level);
int get_access(char *nick);
-int irc_rmnames();
+int irc_rmnames(void);
diff --git a/src/map/mob.c b/src/map/mob.c index d237f4109..68addb39c 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -186,7 +186,6 @@ int mob_parse_dataset(struct spawn_data *data) { struct mob_data* mob_spawn_dataset(struct spawn_data *data)
{
struct mob_data *md = aCalloc(1, sizeof(struct mob_data));
- int i;
md->bl.id= npc_get_new_npc_id();
md->bl.type = BL_MOB;
md->bl.subtype = MONS;
@@ -210,9 +209,10 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data) md->spawn_n = -1;
md->deletetimer = -1;
md->skillidx = -1;
- for (i = 0; i < MAX_STATUSCHANGE; i++)
- md->sc.data[i].timer = -1;
status_set_viewdata(&md->bl, md->class_);
+ status_change_init(&md->bl);
+ unit_dataset(&md->bl);
+
map_addiddb(&md->bl);
return md;
}
@@ -708,7 +708,6 @@ int mob_spawn (struct mob_data *md) md->state.skillstate = MSS_IDLE;
md->next_walktime = tick+rand()%5000+1000;
md->last_linktime = tick;
- unit_dataset(&md->bl);
/* Guardians should be spawned using mob_spawn_guardian! [Skotlex]
* and the Emperium is spawned using mob_once_spawn.
diff --git a/src/map/npc.c b/src/map/npc.c index 3c20b5691..13e1cc195 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1494,8 +1494,9 @@ int npc_parse_warp (char *w1,char *w2,char *w3,char *w4) nd->bl.type = BL_NPC;
nd->bl.subtype = WARP;
map_addblock(&nd->bl);
- unit_dataset(&nd->bl);
status_set_viewdata(&nd->bl, nd->class_);
+ status_change_init(&nd->bl);
+ unit_dataset(&nd->bl);
clif_spawn(&nd->bl);
strdb_put(npcname_db, nd->name, nd);
@@ -1580,12 +1581,13 @@ static int npc_parse_shop (char *w1, char *w2, char *w3, char *w4) npc_shop++;
nd->bl.type = BL_NPC;
nd->bl.subtype = SHOP;
- unit_dataset(&nd->bl);
- nd->ud.dir = dir;
if (m >= 0) {
nd->n = map_addnpc(m,nd);
map_addblock(&nd->bl);
status_set_viewdata(&nd->bl, nd->class_);
+ status_change_init(&nd->bl);
+ unit_dataset(&nd->bl);
+ nd->ud.dir = dir;
clif_spawn(&nd->bl);
} else
// we skip map_addnpc, but still add it to the list of ID's
@@ -1880,13 +1882,15 @@ static int npc_parse_script (char *w1,char *w2,char *w3,char *w4,char *first_lin npc_script++;
nd->bl.type = BL_NPC;
nd->bl.subtype = SCRIPT;
- unit_dataset(&nd->bl);
- nd->ud.dir = dir;
for (i = 0; i < MAX_EVENTTIMER; i++)
nd->eventtimer[i] = -1;
if (m >= 0) {
nd->n = map_addnpc(m, nd);
+ status_set_viewdata(&nd->bl, nd->class_);
+ status_change_init(&nd->bl);
+ unit_dataset(&nd->bl);
+ nd->ud.dir = dir;
map_addblock(&nd->bl);
if (evflag) { // イベント型
struct event_data *ev = (struct event_data *)aCalloc(1, sizeof(struct event_data));
@@ -1894,7 +1898,6 @@ static int npc_parse_script (char *w1,char *w2,char *w3,char *w4,char *first_lin ev->pos = 0;
strdb_put(ev_db, nd->exname, ev);
} else {
- status_set_viewdata(&nd->bl, nd->class_);
clif_spawn(&nd->bl);
}
} else {
diff --git a/src/map/pc.c b/src/map/pc.c index a5cacfea8..5852edc08 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -415,7 +415,6 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo sd->state.auth = 0;
sd->bl.type = BL_PC;
sd->canlog_tick = gettick();
- unit_dataset(&sd->bl);
sd->state.waitingdisconnect = 0;
return 0;
@@ -677,14 +676,12 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t //Set here because we need the inventory data for weapon sprite parsing.
status_set_viewdata(&sd->bl, sd->status.class_);
+ status_change_init(&sd->bl);
+ unit_dataset(&sd->bl);
+
// pet
sd->pet_hungry_timer = -1;
- // ステ?タス異常の初期化
- for(i = 0; i < MAX_STATUSCHANGE; i++) {
- sd->sc.data[i].timer=-1;
- }
- sd->sc.count=0;
if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
(pc_isGM(sd) >= get_atcommand_level(AtCommand_Hide)))
sd->status.option &= (OPTION_MASK | OPTION_INVISIBLE);
diff --git a/src/map/status.c b/src/map/status.c index 9b0dbfc03..511cf9416 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -3401,6 +3401,16 @@ struct status_change *status_get_sc(struct block_list *bl) return NULL;
}
+void status_change_init(struct block_list *bl)
+{
+ struct status_change *sc = status_get_sc(bl);
+ int i;
+ nullpo_retv(sc);
+ memset(sc, 0, sizeof (struct status_change));
+ for (i=0; i< SC_MAX; i++)
+ sc->data[i].timer = -1;
+}
+
//Returns defense against the specified status change.
//Return range is 0 (no resist) to 10000 (inmunity)
int status_get_sc_def(struct block_list *bl, int type)
diff --git a/src/map/status.h b/src/map/status.h index df6cde41f..4df0cbec4 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -483,6 +483,7 @@ int status_get_race2(struct block_list *bl); struct view_data *status_get_viewdata(struct block_list *bl);
void status_set_viewdata(struct block_list *bl, int class_);
+void status_change_init(struct block_list *bl);
struct status_change *status_get_sc(struct block_list *bl);
int status_get_matk1(struct block_list *bl);
|