- Removed sd->sex since it's redundant (we can always use sd->status.sex)

- If somehow a player logs out and it's saved with 0 hp, on login his state will be set to dead as well so he can respawn (otherwise that leads to a stuck char)


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9398 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-12-03 19:46:43 +00:00
parent 7831807dc5
commit 231f495291
6 changed files with 13 additions and 16 deletions

View File

@ -4,6 +4,9 @@ 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/12/03 2006/12/03
* If somehow a player logs out and it's saved with 0 hp, on login his state
will be set to dead as well so he can respawn (otherwise that leads to a
stuck char) [Skotlex]
* Fixed even share exp flutuating as described in: * Fixed even share exp flutuating as described in:
http://www.eathena.ws/board/index.php?showtopic=126139 http://www.eathena.ws/board/index.php?showtopic=126139
thanks to TheUltraMague for the fix. [FlavioJS] thanks to TheUltraMague for the fix. [FlavioJS]

View File

@ -863,13 +863,8 @@ int chrif_changedsex(int fd)
sd = map_id2sd(acc); sd = map_id2sd(acc);
if (acc > 0) { if (acc > 0) {
if (sd != NULL && sd->status.sex != sex) { if (sd != NULL && sd->status.sex != sex) {
if (sd->status.sex == 0) { sd->status.sex = !sd->status.sex;
sd->status.sex = 1;
sd->sex = 1;
} else if (sd->status.sex == 1) {
sd->status.sex = 0;
sd->sex = 0;
}
// to avoid any problem with equipment and invalid sex, equipment is unequiped. // to avoid any problem with equipment and invalid sex, equipment is unequiped.
for (i = 0; i < MAX_INVENTORY; i++) { for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].nameid && sd->status.inventory[i].equip) if (sd->status.inventory[i].nameid && sd->status.inventory[i].equip)

View File

@ -330,7 +330,7 @@ void guild_makemember(struct guild_member *m,struct map_session_data *sd)
m->char_id =sd->status.char_id; m->char_id =sd->status.char_id;
m->hair =sd->status.hair; m->hair =sd->status.hair;
m->hair_color =sd->status.hair_color; m->hair_color =sd->status.hair_color;
m->gender =sd->sex; m->gender =sd->status.sex;
m->class_ =sd->status.class_; m->class_ =sd->status.class_;
m->lv =sd->status.base_level; m->lv =sd->status.base_level;
// m->exp =0; // m->exp =0;

View File

@ -610,7 +610,7 @@ struct map_session_data {
unsigned intravision : 1; // Maya Purple Card effect allowing to see Hiding/Cloaking people [DracoRPG] unsigned intravision : 1; // Maya Purple Card effect allowing to see Hiding/Cloaking people [DracoRPG]
unsigned perfect_hiding : 1; // [Valaris] unsigned perfect_hiding : 1; // [Valaris]
} special_state; } special_state;
int login_id1, login_id2, sex; int login_id1, login_id2;
unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex] unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex]
int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18 int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18

View File

@ -360,10 +360,10 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo
sd->bl.id = account_id; sd->bl.id = account_id;
sd->status.char_id = account_id; sd->status.char_id = account_id;
sd->status.char_id = char_id; sd->status.char_id = char_id;
sd->status.sex = sex;
sd->login_id1 = login_id1; sd->login_id1 = login_id1;
sd->login_id2 = 0; // at this point, we can not know the value :( sd->login_id2 = 0; // at this point, we can not know the value :(
sd->client_tick = client_tick; sd->client_tick = client_tick;
sd->sex = sex;
sd->state.auth = 0; sd->state.auth = 0;
sd->bl.type = BL_PC; sd->bl.type = BL_PC;
sd->canlog_tick = gettick(); sd->canlog_tick = gettick();
@ -576,12 +576,12 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t
} }
sd->login_id2 = login_id2; sd->login_id2 = login_id2;
memcpy(&sd->status, st, sizeof(*st));
if (sd->status.sex != sd->sex) { if (st->sex != sd->status.sex) {
clif_authfail_fd(sd->fd, 0); clif_authfail_fd(sd->fd, 0);
return 1; return 1;
} }
memcpy(&sd->status, st, sizeof(*st));
//Set the map-server used job id. [Skotlex] //Set the map-server used job id. [Skotlex]
i = pc_jobid2mapid(sd->status.class_); i = pc_jobid2mapid(sd->status.class_);
@ -593,6 +593,7 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t
} else } else
sd->class_ = i; sd->class_ = i;
//Initializations to null/0 unneeded since map_session_data was filled with 0 upon allocation. //Initializations to null/0 unneeded since map_session_data was filled with 0 upon allocation.
if(!sd->status.hp) pc_setdead(sd);
sd->state.connect_new = 1; sd->state.connect_new = 1;
sd->followtimer = -1; // [MouseJstr] sd->followtimer = -1; // [MouseJstr]
@ -5177,7 +5178,7 @@ int pc_readparam(struct map_session_data *sd,int type)
val= pc_mapid2jobid(sd->class_&MAPID_BASEMASK, sd->status.sex); val= pc_mapid2jobid(sd->class_&MAPID_BASEMASK, sd->status.sex);
break; break;
case SP_SEX: case SP_SEX:
val= sd->sex; val= sd->status.sex;
break; break;
case SP_WEIGHT: case SP_WEIGHT:
val= sd->weight; val= sd->weight;
@ -5312,7 +5313,7 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
} }
break; break;
case SP_SEX: case SP_SEX:
sd->sex = val; sd->status.sex = val;
break; break;
case SP_WEIGHT: case SP_WEIGHT:
sd->weight = val; sd->weight = val;

View File

@ -7968,12 +7968,10 @@ int buildin_changesex(struct script_state *st) {
if (sd->status.sex == 0) { if (sd->status.sex == 0) {
sd->status.sex = 1; sd->status.sex = 1;
sd->sex = 1;
if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER) if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER)
sd->status.class_ -= 1; sd->status.class_ -= 1;
} else if (sd->status.sex == 1) { } else if (sd->status.sex == 1) {
sd->status.sex = 0; sd->status.sex = 0;
sd->sex = 0;
if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER) if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER)
sd->status.class_ += 1; sd->status.class_ += 1;
} }