Explorar el Código

- Modified the error reporting in map_freeblock_unlock so that when there's an error, the reported line number is the file's linenumber plus the object's type *10000. This is for debug information to help track down the already-freed error.
- pc_adopt will now preserve the kid's job/job-level/experience. This means that if you adopt a Swordman level 45, it will become a baby-swordman level 45, with the exact same exp as before.


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

skotlex hace 18 años
padre
commit
5c8103cb76
Se han modificado 3 ficheros con 23 adiciones y 3 borrados
  1. 7 0
      Changelog-Trunk.txt
  2. 2 1
      src/map/map.c
  3. 14 2
      src/map/pc.c

+ 7 - 0
Changelog-Trunk.txt

@@ -4,6 +4,13 @@ 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/08/31
+	* Modified the error reporting in map_freeblock_unlock so that when there's
+	  an error, the reported line number is the file's linenumber plus the
+	  object's type *10000. This is for debug information to help track down the
+	  already-freed error. [Skotlex]
+	* pc_adopt will now preserve the kid's job/job-level/experience. This means
+	  that if you adopt a Swordman level 45, it will become a baby-swordman level
+	  45, with the exact same exp as before. [Skotlex]
 	* Fixed new mob's name not sent to the client when the mob is morphed [Toms]
 	* Added setting attack_walk_delay which specifies whether a character
 	  should (or not) be able to move inmediately after starting a normal attack

+ 2 - 1
src/map/map.c

@@ -296,7 +296,8 @@ int map_freeblock_unlock_sub(char *file, int lineno)
 		for (i = 0; i < block_free_count; i++)
 		{	//Directly calling aFree shouldn't be a leak, as Free remembers the size the original pointed to memory was allocated with? [Skotlex]
 //			aFree(block_free[i]);
-			_mfree(block_free[i], file, lineno, __func__);
+//			_mfree(block_free[i], file, lineno, __func__);
+			_mfree(block_free[i], file, block_free[i]->type*100000+lineno, __func__);
 			block_free[i] = NULL;
 		}
 		block_free_count = 0;

+ 14 - 2
src/map/pc.c

@@ -6677,7 +6677,8 @@ int pc_divorce(struct map_session_data *sd)
  */
 int pc_adoption(struct map_session_data *sd,struct map_session_data *dstsd, struct map_session_data *jasd)
 {       
-	int j;          
+	int j,level, job;
+	unsigned int exp;
 	if (sd == NULL || dstsd == NULL || jasd == NULL ||
 		sd->status.partner_id <= 0 || dstsd->status.partner_id <= 0 ||
 		sd->status.partner_id != dstsd->status.char_id || dstsd->status.partner_id != sd->status.char_id ||
@@ -6692,8 +6693,19 @@ int pc_adoption(struct map_session_data *sd,struct map_session_data *dstsd, stru
 		if(jasd->status.inventory[j].nameid>0 && jasd->status.inventory[j].equip!=0)
 			pc_unequipitem(jasd, j, 3);
 	}
-	if (pc_jobchange(jasd, 4023, 0) == 0)
+
+	//Preserve level and exp.
+	level = jasd->status.job_level;
+	exp = jasd->status.job_exp;
+	job = jasd->class_|JOBL_BABY; //Preserve current Job by babyfying it. [Skotlex]
+	job = pc_mapid2jobid(job, jasd->status.sex);
+	if (job != -1 && pc_jobchange(jasd, job, 0) == 0)
 	{	//Success, and give Junior the Baby skills. [Skotlex]
+		//Restore job level and experience.
+		jasd->status.job_level = level;
+		jasd->status.job_exp = exp;
+		clif_updatestatus(jasd,SP_JOBLEVEL);
+		clif_updatestatus(jasd,SP_JOBEXP);
 		pc_skill(jasd,WE_BABY,1,0);
 		pc_skill(jasd,WE_CALLPARENT,1,0);
 		clif_displaymessage(jasd->fd, msg_txt(12)); // Your job has been changed.