summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/chrif.c9
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/pc.c11
-rw-r--r--src/map/script.c2
5 files changed, 10 insertions, 16 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c
index b11640b74..95b874327 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -863,13 +863,8 @@ int chrif_changedsex(int fd)
sd = map_id2sd(acc);
if (acc > 0) {
if (sd != NULL && sd->status.sex != sex) {
- if (sd->status.sex == 0) {
- sd->status.sex = 1;
- sd->sex = 1;
- } else if (sd->status.sex == 1) {
- sd->status.sex = 0;
- sd->sex = 0;
- }
+ sd->status.sex = !sd->status.sex;
+
// to avoid any problem with equipment and invalid sex, equipment is unequiped.
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].nameid && sd->status.inventory[i].equip)
diff --git a/src/map/guild.c b/src/map/guild.c
index 6e3f33646..459c2f42e 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -330,7 +330,7 @@ void guild_makemember(struct guild_member *m,struct map_session_data *sd)
m->char_id =sd->status.char_id;
m->hair =sd->status.hair;
m->hair_color =sd->status.hair_color;
- m->gender =sd->sex;
+ m->gender =sd->status.sex;
m->class_ =sd->status.class_;
m->lv =sd->status.base_level;
// m->exp =0;
diff --git a/src/map/map.h b/src/map/map.h
index c40ca5f86..0cb147e83 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -610,7 +610,7 @@ struct map_session_data {
unsigned intravision : 1; // Maya Purple Card effect allowing to see Hiding/Cloaking people [DracoRPG]
unsigned perfect_hiding : 1; // [Valaris]
} 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]
int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18
diff --git a/src/map/pc.c b/src/map/pc.c
index 838a1fc23..86b8d5cdb 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -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->status.char_id = account_id;
sd->status.char_id = char_id;
+ sd->status.sex = sex;
sd->login_id1 = login_id1;
sd->login_id2 = 0; // at this point, we can not know the value :(
sd->client_tick = client_tick;
- sd->sex = sex;
sd->state.auth = 0;
sd->bl.type = BL_PC;
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;
- memcpy(&sd->status, st, sizeof(*st));
- if (sd->status.sex != sd->sex) {
+ if (st->sex != sd->status.sex) {
clif_authfail_fd(sd->fd, 0);
return 1;
}
+ memcpy(&sd->status, st, sizeof(*st));
//Set the map-server used job id. [Skotlex]
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
sd->class_ = i;
//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->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);
break;
case SP_SEX:
- val= sd->sex;
+ val= sd->status.sex;
break;
case SP_WEIGHT:
val= sd->weight;
@@ -5312,7 +5313,7 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
}
break;
case SP_SEX:
- sd->sex = val;
+ sd->status.sex = val;
break;
case SP_WEIGHT:
sd->weight = val;
diff --git a/src/map/script.c b/src/map/script.c
index b3b559312..420c905b5 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7968,12 +7968,10 @@ int buildin_changesex(struct script_state *st) {
if (sd->status.sex == 0) {
sd->status.sex = 1;
- sd->sex = 1;
if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER)
sd->status.class_ -= 1;
} else if (sd->status.sex == 1) {
sd->status.sex = 0;
- sd->sex = 0;
if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER)
sd->status.class_ += 1;
}