Просмотр исходного кода

- Some cleaning on the homunc speed calculating code, so that it correctly uses the default walk speed if the player has no speed yet.
- Some speed up code when loading status changes (use a pointer instead of memcpy'ing all the time)


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9359 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 18 лет назад
Родитель
Сommit
e4e42fbcb7
4 измененных файлов с 17 добавлено и 10 удалено
  1. 3 0
      Changelog-Trunk.txt
  2. 5 5
      src/map/chrif.c
  3. 1 1
      src/map/pc.c
  4. 8 4
      src/map/status.c

+ 3 - 0
Changelog-Trunk.txt

@@ -3,6 +3,9 @@ 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.
 
+2006/11/29
+	* Some cleaning on the homunc speed calculating code, so that it correctly
+	  uses the default walk speed if the player has no speed yet. [Skotlex]
 2006/11/28
 	* Fixed a typo which made the wedding_ignore_palette setting not work when
 	  you log on with them equipped [Skotlex]

+ 5 - 5
src/map/chrif.c

@@ -1258,7 +1258,7 @@ int chrif_load_scdata(int fd)
 {	//Retrieve and load sc_data for a player. [Skotlex]
 #ifdef ENABLE_SC_SAVING
 	struct map_session_data *sd;
-	struct status_change_data data;
+	struct status_change_data *data;
 	int aid, cid, i, count;
 	RFIFOHEAD(fd);
 
@@ -1279,13 +1279,13 @@ int chrif_load_scdata(int fd)
 	count = RFIFOW(fd,12); //sc_count
 	for (i = 0; i < count; i++)
 	{
-		memcpy(&data, RFIFOP(fd,14 + i*sizeof(struct status_change_data)), sizeof(struct status_change_data));
-		if (data.tick < 1)
+		data = (struct status_change_data*)RFIFOP(fd,14 + i*sizeof(struct status_change_data));
+		if (data->tick < 1)
 		{	//Protection against invalid tick values. [Skotlex]
-			ShowWarning("chrif_load_scdata: Received invalid duration (%d ms) for status change %d (character %s)\n", data.tick, data.type, sd->status.name);
+			ShowWarning("chrif_load_scdata: Received invalid duration (%d ms) for status change %d (character %s)\n", data->tick, data->type, sd->status.name);
 			continue;
 		}
-		status_change_start(&sd->bl, data.type, 10000, data.val1, data.val2, data.val3, data.val4, data.tick, 15);
+		status_change_start(&sd->bl, data->type, 10000, data->val1, data->val2, data->val3, data->val4, data->tick, 15);
 	}
 #endif
 	return 0;

+ 1 - 1
src/map/pc.c

@@ -666,7 +666,7 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t
 		intif_request_petdata(sd->status.account_id, sd->status.char_id, sd->status.pet_id);
 
 	// Homunculus [albator]
-	if (sd->status.hom_id > 0)	
+	if (sd->status.hom_id > 0)
 		intif_homunculus_requestload(sd->status.account_id, sd->status.hom_id);
 
 	if (sd->status.party_id > 0 && party_search(sd->status.party_id) == NULL)

+ 8 - 4
src/map/status.c

@@ -2364,10 +2364,11 @@ int status_calc_homunculus(struct homun_data *hd, int first)
 		status->size = hd->homunculusDB->size ;
 		status->rhw.range = 1 + status->size;
 		status->mode = MD_CANMOVE|MD_CANATTACK|MD_ASSIST|MD_AGGRESSIVE|MD_CASTSENSOR;
-		if (battle_config.slaves_inherit_speed && hd->master)
+		status->speed = DEFAULT_WALK_SPEED;
+		if (battle_config.slaves_inherit_speed&1 &&
+			hd->master && hd->master->state.auth) //Master needs be authed to have valid speed.
 			status->speed = status_get_speed(&hd->master->bl);
-		else
-			status->speed = DEFAULT_WALK_SPEED;
+
 		status->hp = 1;
 		status->sp = 1;
 	}
@@ -2849,7 +2850,10 @@ void status_calc_bl_sub_hom(struct homun_data *hd, unsigned long flag)	//[orn]
 
 	if(flag&SCB_MATK) //Hom Min Matk is always the same as Max Matk
 		status->matk_min = status->matk_max;
-	
+
+	if(flag&SCB_SPEED && battle_config.slaves_inherit_speed&1 && hd->master)
+		status->speed = status_get_speed(&hd->master->bl);
+
 	if(flag&(SCB_ASPD|SCB_AGI|SCB_DEX)) {
 		flag|=SCB_ASPD;