- Corrected mob spawn utilization of the delay1/delay2 values (one is respawn delay base, the second is random variance added on top of it). Cleaned up related code.
- Changed abit map_add_block to prevent adding a player object which is invalid (not authed, waiting to be disconnected) git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11964 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
e0611bf8b5
commit
146ca072bb
@ -3,6 +3,10 @@ Date Added
|
||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||
|
||||
2007/12/22
|
||||
* Corrected mob spawn utilization of the delay1/delay2 values (one is
|
||||
respawn delay base, the second is random variance added on top of it).
|
||||
Cleaned up related code. [Skotlex]
|
||||
2007/12/19
|
||||
* Fixed yet another buffer overflow, in @adopt [ultramage]
|
||||
* Changes to the configure script. [FlavioJS]
|
||||
|
@ -349,10 +349,6 @@ int map_addblock_sub (struct block_list *bl, int flag)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef CELL_NOSTACK
|
||||
map_addblcell(bl);
|
||||
#endif
|
||||
|
||||
pos = x/BLOCK_SIZE+(y/BLOCK_SIZE)*map[m].bxs;
|
||||
if (bl->type == BL_MOB) {
|
||||
bl->next = map[m].block_mob[pos];
|
||||
@ -361,14 +357,13 @@ int map_addblock_sub (struct block_list *bl, int flag)
|
||||
map[m].block_mob[pos] = bl;
|
||||
map[m].block_mob_count[pos]++;
|
||||
} else {
|
||||
bl->next = map[m].block[pos];
|
||||
bl->prev = &bl_head;
|
||||
if (bl->next) bl->next->prev = bl;
|
||||
map[m].block[pos] = bl;
|
||||
map[m].block_count[pos]++;
|
||||
if (bl->type == BL_PC && flag)
|
||||
{
|
||||
struct map_session_data* sd;
|
||||
if (!sd->state.auth) {
|
||||
ShowError("map_addblock: Attempted to add a non-authed player (%d:%d)!\n", sd->status.account_id, sd->status.char_id);
|
||||
return 1;
|
||||
}
|
||||
if (map[m].users++ == 0 && battle_config.dynamic_mobs) //Skotlex
|
||||
map_spawnmobs(m);
|
||||
sd = (struct map_session_data*)bl;
|
||||
@ -378,8 +373,17 @@ int map_addblock_sub (struct block_list *bl, int flag)
|
||||
pet_menu(sd, 3); //Option 3 is return to egg.
|
||||
}
|
||||
}
|
||||
bl->next = map[m].block[pos];
|
||||
bl->prev = &bl_head;
|
||||
if (bl->next) bl->next->prev = bl;
|
||||
map[m].block[pos] = bl;
|
||||
map[m].block_count[pos]++;
|
||||
}
|
||||
|
||||
#ifdef CELL_NOSTACK
|
||||
map_addblcell(bl);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -924,8 +924,7 @@ struct mob_data {
|
||||
unsigned int tdmg; //Stores total damage given to the mob, for exp calculations. [Skotlex]
|
||||
int level;
|
||||
int target_id,attacked_id;
|
||||
unsigned int next_walktime;
|
||||
unsigned int last_deadtime,last_spawntime,last_thinktime,last_linktime;
|
||||
unsigned int next_walktime,last_thinktime,last_linktime;
|
||||
short move_fail_count;
|
||||
short lootitem_count;
|
||||
short min_chase;
|
||||
|
@ -612,24 +612,19 @@ static int mob_delayspawn(int tid, unsigned int tick, int m, int n)
|
||||
*------------------------------------------*/
|
||||
int mob_setdelayspawn(struct mob_data *md)
|
||||
{
|
||||
unsigned int spawntime, spawntime1, spawntime2, spawntime3;
|
||||
|
||||
unsigned int spawntime;
|
||||
|
||||
if (!md->spawn) //Doesn't has respawn data!
|
||||
return unit_free(&md->bl,1);
|
||||
|
||||
spawntime1 = md->last_spawntime + md->spawn->delay1;
|
||||
spawntime2 = md->last_deadtime + md->spawn->delay2;
|
||||
spawntime3 = gettick() + 5000 + rand()%5000; //Lupus
|
||||
// spawntime = max(spawntime1,spawntime2,spawntime3);
|
||||
if (DIFF_TICK(spawntime1, spawntime2) > 0)
|
||||
spawntime = spawntime1;
|
||||
else
|
||||
spawntime = spawntime2;
|
||||
if (DIFF_TICK(spawntime3, spawntime) > 0)
|
||||
spawntime = spawntime3;
|
||||
spawntime = md->spawn->delay1; //Base respawn time
|
||||
if (md->spawn->delay2) //random variance
|
||||
spawntime+= rand()%md->spawn->delay2;
|
||||
|
||||
add_timer(spawntime, mob_delayspawn, md->bl.id, 0);
|
||||
if (spawntime < 5000) //Min respawn time (is it needed?)
|
||||
spawntime = 5000;
|
||||
|
||||
add_timer(gettick()+spawntime, mob_delayspawn, md->bl.id, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -646,7 +641,6 @@ int mob_spawn (struct mob_data *md)
|
||||
int i=0;
|
||||
unsigned int c =0, tick = gettick();
|
||||
|
||||
md->last_spawntime = md->last_thinktime = tick;
|
||||
if (md->bl.prev != NULL)
|
||||
unit_remove_map(&md->bl,2);
|
||||
else
|
||||
@ -2221,7 +2215,6 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
|
||||
}
|
||||
|
||||
mob_deleteslave(md);
|
||||
md->last_deadtime=tick;
|
||||
|
||||
map_freeblock_unlock();
|
||||
|
||||
|
@ -2182,11 +2182,6 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c
|
||||
return strchr(start,'\n');// skip and continue
|
||||
}
|
||||
|
||||
//Fixed according to latest kRO update (needs optimization)
|
||||
temp = mob.delay1;
|
||||
mob.delay1 += mob.delay2;
|
||||
mob.delay2 = temp;
|
||||
|
||||
mob.num = (unsigned short)num;
|
||||
mob.class_ = (short) class_;
|
||||
mob.x = (unsigned short)x;
|
||||
|
Loading…
x
Reference in New Issue
Block a user