diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-07-10 06:17:06 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-07-10 06:17:06 +0000 |
commit | 9ef634559f3cde232586b1dc6fd00bea3f3d8e53 (patch) | |
tree | 541295af8a6fbfe15b09da353680be6dd4d6b3ff /src/map/npc.c | |
parent | 9c100697bf79604fcef8b7eedbadeed45c63b41b (diff) | |
download | hercules-9ef634559f3cde232586b1dc6fd00bea3f3d8e53.tar.gz hercules-9ef634559f3cde232586b1dc6fd00bea3f3d8e53.tar.bz2 hercules-9ef634559f3cde232586b1dc6fd00bea3f3d8e53.tar.xz hercules-9ef634559f3cde232586b1dc6fd00bea3f3d8e53.zip |
* Merged changes from trunk [14827:14894/trunk].
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/renewal@14895 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index d070b6886..dd3a671b0 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -356,7 +356,7 @@ bool npc_event_isspecial(const char* eventname) /*========================================== * 時計イベント実行 *------------------------------------------*/ -int npc_event_do_clock(int tid, unsigned int tick, int id, intptr data) +int npc_event_do_clock(int tid, unsigned int tick, int id, intptr_t data) { static struct tm ev_tm_b; // tracks previous execution time time_t timer; @@ -455,7 +455,7 @@ struct timer_event_data { /*========================================== * triger 'OnTimerXXXX' events *------------------------------------------*/ -int npc_timerevent(int tid, unsigned int tick, int id, intptr data) +int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data) { int next; int old_rid, old_timer; @@ -498,9 +498,9 @@ int npc_timerevent(int tid, unsigned int tick, int id, intptr data) next = nd->u.scr.timer_event[ ted->next ].timer - nd->u.scr.timer_event[ ted->next - 1 ].timer; ted->time += next; if( sd ) - sd->npc_timer_id = add_timer(tick+next,npc_timerevent,id,(intptr)ted); + sd->npc_timer_id = add_timer(tick+next,npc_timerevent,id,(intptr_t)ted); else - nd->u.scr.timerid = add_timer(tick+next,npc_timerevent,id,(intptr)ted); + nd->u.scr.timerid = add_timer(tick+next,npc_timerevent,id,(intptr_t)ted); } else { @@ -570,13 +570,13 @@ int npc_timerevent_start(struct npc_data* nd, int rid) if( sd ) { ted->rid = sd->bl.id; // Attach only the player if attachplayerrid was used. - sd->npc_timer_id = add_timer(tick+next,npc_timerevent,nd->bl.id,(intptr)ted); + sd->npc_timer_id = add_timer(tick+next,npc_timerevent,nd->bl.id,(intptr_t)ted); } else { ted->rid = 0; nd->u.scr.timertick = tick; // Set when timer is started - nd->u.scr.timerid = add_timer(tick+next,npc_timerevent,nd->bl.id,(intptr)ted); + nd->u.scr.timerid = add_timer(tick+next,npc_timerevent,nd->bl.id,(intptr_t)ted); } return 0; @@ -1164,8 +1164,8 @@ static int npc_buylist_sub(struct map_session_data* sd, int n, unsigned short* i // save list of bought items for( i = 0; i < n; i++ ) { - script_setarray_pc(sd, "@bought_nameid", i, (void*)(intptr)item_list[i*2+1], &key_nameid); - script_setarray_pc(sd, "@bought_quantity", i, (void*)(intptr)item_list[i*2], &key_amount); + script_setarray_pc(sd, "@bought_nameid", i, (void*)(intptr_t)item_list[i*2+1], &key_nameid); + script_setarray_pc(sd, "@bought_quantity", i, (void*)(intptr_t)item_list[i*2], &key_amount); } // invoke event @@ -1369,8 +1369,9 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list) // custom merchant shop exp bonus if( battle_config.shop_exp > 0 && z > 0 && (skill = pc_checkskill(sd,MC_DISCOUNT)) > 0 ) { - if( sd->status.skill[MC_DISCOUNT].flag != 0 ) - skill = sd->status.skill[MC_DISCOUNT].flag - 2; + if( sd->status.skill[MC_DISCOUNT].flag >= SKILL_FLAG_REPLACED_LV_0 ) + skill = sd->status.skill[MC_DISCOUNT].flag - SKILL_FLAG_REPLACED_LV_0; + if( skill > 0 ) { z = z * (double)skill * (double)battle_config.shop_exp/10000.; @@ -1401,8 +1402,8 @@ static int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short* { idx = item_list[i*2]-2; - script_setarray_pc(sd, "@sold_nameid", i, (void*)(intptr)sd->status.inventory[idx].nameid, &key_nameid); - script_setarray_pc(sd, "@sold_quantity", i, (void*)(intptr)item_list[i*2+1], &key_amount); + script_setarray_pc(sd, "@sold_nameid", i, (void*)(intptr_t)sd->status.inventory[idx].nameid, &key_nameid); + script_setarray_pc(sd, "@sold_quantity", i, (void*)(intptr_t)item_list[i*2+1], &key_amount); } // invoke event @@ -1505,8 +1506,9 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list) // custom merchant shop exp bonus if( battle_config.shop_exp > 0 && z > 0 && ( skill = pc_checkskill(sd,MC_OVERCHARGE) ) > 0) { - if( sd->status.skill[MC_OVERCHARGE].flag != 0 ) - skill = sd->status.skill[MC_OVERCHARGE].flag - 2; + if( sd->status.skill[MC_OVERCHARGE].flag >= SKILL_FLAG_REPLACED_LV_0 ) + skill = sd->status.skill[MC_OVERCHARGE].flag - SKILL_FLAG_REPLACED_LV_0; + if( skill > 0 ) { z = z * (double)skill * (double)battle_config.shop_exp/10000.; @@ -2734,13 +2736,13 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c // check monster ID if exists! if( mobdb_checkid(class_) == 0 ) { - ShowError("npc_parse_mob: Unknown mob ID : %s %s (file '%s', line '%d').\n", w3, w4, filepath, strline(buffer,start-buffer)); + ShowError("npc_parse_mob: Unknown mob ID %d (file '%s', line '%d').\n", class_, filepath, strline(buffer,start-buffer)); return strchr(start,'\n');// skip and continue } if( num < 1 || num > 1000 ) { - ShowError("npc_parse_mob: Invalid number of monsters (must be inside the range [1,1000]) : %s %s (file '%s', line '%d').\n", w3, w4, filepath, strline(buffer,start-buffer)); + ShowError("npc_parse_mob: Invalid number of monsters %d, must be inside the range [1,1000] (file '%s', line '%d').\n", num, filepath, strline(buffer,start-buffer)); return strchr(start,'\n');// skip and continue } @@ -2786,7 +2788,7 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c } if(mob.delay1>0xfffffff || mob.delay2>0xfffffff) { - ShowError("npc_parse_mob: wrong monsters spawn delays : %s %s (file '%s', line '%d').\n", w3, w4, filepath, strline(buffer,start-buffer)); + ShowError("npc_parse_mob: Invalid spawn delays %u %u (file '%s', line '%d').\n", mob.delay1, mob.delay2, filepath, strline(buffer,start-buffer)); return strchr(start,'\n');// skip and continue } @@ -2801,7 +2803,7 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c //Verify dataset. if( !mob_parse_dataset(&mob) ) { - ShowError("npc_parse_mob: Invalid dataset : %s %s (file '%s', line '%d').\n", w3, w4, filepath, strline(buffer,start-buffer)); + ShowError("npc_parse_mob: Invalid dataset for monster ID %d (file '%s', line '%d').\n", class_, filepath, strline(buffer,start-buffer)); return strchr(start,'\n');// skip and continue } |