- pc_follow_timer possible triggering crash.
- pc_reg_received to use battle_status.hp instead of status.hp
[Added]: 
- macro map_id2index for non-cyptic mapid to mapindex conversion.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6822 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
Lance 2006-05-29 16:15:48 +00:00
parent 048bd9bd8f
commit 4d5a8c5079
3 changed files with 20 additions and 10 deletions

View File

@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/05/29 2006/05/29
* [Fixed]:
- pc_follow_timer possible triggering crash.
- pc_reg_received to use battle_status.hp instead of status.hp
[Added]:
- macro map_id2index for non-cyptic mapid to mapindex conversion. [Lance]
* Added a division by zero check in mob_dead to prevent the (impossible) * Added a division by zero check in mob_dead to prevent the (impossible)
case where a mob dies with received damage of zero. [Skotlex] case where a mob dies with received damage of zero. [Skotlex]
* Modified skill_get_range2 to return range 9 for skills with range 0 for * Modified skill_get_range2 to return range 9 for skills with range 0 for

View File

@ -53,6 +53,8 @@
#define MAX_SEARCH 5 #define MAX_SEARCH 5
#define MAX_DUEL 1024 #define MAX_DUEL 1024
#define map_id2index(id) map[(id)].index
//These mark the ID of the jobs, as expected by the client. [Skotlex] //These mark the ID of the jobs, as expected by the client. [Skotlex]
enum { enum {
JOB_NOVICE, JOB_NOVICE,
@ -1278,7 +1280,7 @@ extern char db_path[256];
// gat?ヨァ // gat?ヨァ
int map_getcell(int,int,int,cell_t); int map_getcell(int,int,int,cell_t);
int map_getcellp(struct map_data*,int,int,cell_t); int map_getcellp(struct map_data*,int,int,int);
void map_setcell(int,int,int,int); void map_setcell(int,int,int,int);
extern int map_read_flag; // 0: grfォユォ。ォ、ォ・1: ォュォ罩テォキォ・2: ォュォ罩テォキォ・?<3F>) extern int map_read_flag; // 0: grfォユォ。ォ、ォ・1: ォュォ罩テォキォ・2: ォュォ罩テォキォ・?<3F>)
enum { enum {

View File

@ -795,8 +795,7 @@ int pc_reg_received(struct map_session_data *sd)
sd->mission_count = pc_readglobalreg(sd,"TK_MISSION_COUNT"); sd->mission_count = pc_readglobalreg(sd,"TK_MISSION_COUNT");
} }
if(sd->status.hp <= 0){ if(sd->battle_status.hp == 0){
sd->status.hp = 0;
pc_setrestartvalue(sd, 1); pc_setrestartvalue(sd, 1);
} }
@ -3644,7 +3643,8 @@ char * job_name(int class_) {
int pc_follow_timer(int tid,unsigned int tick,int id,int data) int pc_follow_timer(int tid,unsigned int tick,int id,int data)
{ {
struct map_session_data *sd, *tsd; struct map_session_data *sd;
struct block_list *tbl;
sd = map_id2sd(id); sd = map_id2sd(id);
nullpo_retr(0, sd); nullpo_retr(0, sd);
@ -3660,19 +3660,22 @@ int pc_follow_timer(int tid,unsigned int tick,int id,int data)
if (pc_isdead(sd)) if (pc_isdead(sd))
return 0; return 0;
if ((tsd = map_id2sd(sd->followtarget)) == NULL || pc_isdead(tsd)) if ((tbl = map_id2bl(sd->followtarget)) == NULL)
return 0;
if(tbl->type == BL_PC && pc_isdead((TBL_PC *)tbl))
return 0; return 0;
// either player or target is currently detached from map blocks (could be teleporting), // either player or target is currently detached from map blocks (could be teleporting),
// but still connected to this map, so we'll just increment the timer and check back later // but still connected to this map, so we'll just increment the timer and check back later
if (sd->bl.prev != NULL && tsd->bl.prev != NULL && if (sd->bl.prev != NULL && tbl->prev != NULL &&
sd->ud.skilltimer == -1 && sd->ud.attacktimer == -1 && sd->ud.walktimer == -1) sd->ud.skilltimer == -1 && sd->ud.attacktimer == -1 && sd->ud.walktimer == -1)
{ {
if((sd->bl.m == tsd->bl.m) && unit_can_reach_bl(&sd->bl,&tsd->bl, AREA_SIZE, 0, NULL, NULL)) { if((sd->bl.m == tbl->m) && unit_can_reach_bl(&sd->bl,tbl, AREA_SIZE, 0, NULL, NULL)) {
if (!check_distance_bl(&sd->bl, &tsd->bl, 5)) if (!check_distance_bl(&sd->bl, tbl, 5))
unit_walktobl(&sd->bl, &tsd->bl, 5, 0); unit_walktobl(&sd->bl, tbl, 5, 0);
} else } else
pc_setpos(sd, tsd->mapindex, tsd->bl.x, tsd->bl.y, 3); pc_setpos(sd, map_id2index(tbl->m), tbl->x, tbl->y, 3);
} }
sd->followtimer = add_timer( sd->followtimer = add_timer(
tick + 1000, // increase time a bit to loosen up map's load tick + 1000, // increase time a bit to loosen up map's load