فهرست منبع

- 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

skotlex 18 سال پیش
والد
کامیت
231f495291
6فایلهای تغییر یافته به همراه13 افزوده شده و 16 حذف شده
  1. 3 0
      Changelog-Trunk.txt
  2. 2 7
      src/map/chrif.c
  3. 1 1
      src/map/guild.c
  4. 1 1
      src/map/map.h
  5. 6 5
      src/map/pc.c
  6. 0 2
      src/map/script.c

+ 3 - 0
Changelog-Trunk.txt

@@ -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.
 
 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:
 	  http://www.eathena.ws/board/index.php?showtopic=126139
 	  thanks to TheUltraMague for the fix. [FlavioJS]

+ 2 - 7
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)

+ 1 - 1
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;

+ 1 - 1
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

+ 6 - 5
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;

+ 0 - 2
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;
 	}