Browse Source

- Removed char_nick2id from char-sql server as it's no longer needed.
- Fixed quitting the map server not properly saving the storage before deleting it.


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

skotlex 19 years ago
parent
commit
d3ffb31cc4
6 changed files with 13 additions and 27 deletions
  1. 4 0
      Changelog-Trunk.txt
  2. 0 17
      src/char_sql/char.c
  3. 0 1
      src/char_sql/char.h
  4. 3 4
      src/char_sql/int_party.c
  5. 0 3
      src/map/map.c
  6. 6 2
      src/map/unit.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ 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/06/07
+	* Removed char_nick2id from char-sql server as it's no longer needed.
+	  [Skotlex]
+	* Fixed quitting the map server not properly saving the storage before
+	  deleting it. Thanks to Adam for pointing it out. [Skotlex]
 	* Cleaned status_get_sc_tick/status_get_sc_def to use the status_data
 	  function. [Skotlex]
 	* SC_STOP's chance and duration can't be reduced anymore. [Skotlex]

+ 0 - 17
src/char_sql/char.c

@@ -4398,20 +4398,3 @@ int char_married(int pl1,int pl2) {
 		else
 			return 0;
 }
-
-int char_nick2id (char *name) {
-		int char_id = 0;
-		sprintf (tmp_sql, "SELECT `char_id` FROM `%s` WHERE `name` = '%s'", char_db, name);
-		if (mysql_query (&mysql_handle, tmp_sql)) {
-			ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
-			ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
-		}
-		sql_res = mysql_store_result (&mysql_handle);
-		sql_row = sql_res?mysql_fetch_row(sql_res):NULL;
-		if (sql_row)
-			char_id = atoi (sql_row[0]);
-		else
-			ShowError ("CHAR: nick2id Failed!\n");
-		if (sql_res) mysql_free_result (sql_res);
-		return char_id;
-}

+ 0 - 1
src/char_sql/char.h

@@ -52,7 +52,6 @@ int mapif_sendall(unsigned char *buf,unsigned int len);
 int mapif_sendallwos(int fd,unsigned char *buf,unsigned int len);
 int mapif_send(int fd,unsigned char *buf,unsigned int len);
 
-int char_nick2id (char *name);
 int char_married(int pl1,int pl2);
 int char_child(int parent_id, int child_id);
 

+ 3 - 4
src/char_sql/int_party.c

@@ -291,10 +291,9 @@ int party_check_exp_share(struct party *p)
 	if((dudes/1000 >= 2) && (dudes%1000 == 3) && maxlv-minlv>party_share_level)
 	{
 		int pl1=0,pl2=0,pl3=0;
-		pl1=char_nick2id(p->member[oi[0]].name);
-		pl2=char_nick2id(p->member[oi[1]].name);
-		pl3=char_nick2id(p->member[oi[2]].name);
-		ShowDebug("PARTY: group of 3 Id1 %d lv %d name %s Id2 %d lv %d name %s Id3 %d lv %d name %s\n",pl1,p->member[oi[0]].lv,p->member[oi[0]].name,pl2,p->member[oi[1]].lv,p->member[oi[1]].name,pl3,p->member[oi[2]].lv,p->member[oi[2]].name);
+		pl1=p->member[oi[0]].char_id;
+		pl2=p->member[oi[1]].char_id;
+		pl3=p->member[oi[2]].char_id;
 		if (char_married(pl1,pl2) && char_child(pl1,pl3))
 			return 1;
 		if (char_married(pl1,pl3) && char_child(pl1,pl2))

+ 0 - 3
src/map/map.c

@@ -1662,9 +1662,6 @@ int map_quit(struct map_session_data *sd) {
 			npc_script_event(sd, NPCE_LOGOUT);
 		if (sd->pd) unit_free(&sd->pd->bl);
 		unit_free(&sd->bl);
-		pc_clean_skilltree(sd);
-		if(sd->pet.intimate > 0)
-			intif_save_petdata(sd->status.account_id,&sd->pet);
 		chrif_save(sd,1);
 	} else { //Try to free some data, without saving anything (this could be invoked on map server change. [Skotlex]
 		if (sd->bl.prev != NULL)

+ 6 - 2
src/map/unit.c

@@ -1618,9 +1618,9 @@ int unit_free(struct block_list *bl) {
 		pc_cleareventtimer(sd);		
 		pc_delspiritball(sd,sd->spiritball,1);
 		chrif_save_scdata(sd); //Save status changes, then clear'em out from memory. [Skotlex]
-		storage_delete(sd->status.account_id);
 		pc_makesavestatus(sd);
 		sd->state.waitingdisconnect = 1;
+		pc_clean_skilltree(sd);
 	} else if( bl->type == BL_PET ) {
 		struct pet_data *pd = (struct pet_data*)bl;
 		struct map_session_data *sd = pd->msd;
@@ -1662,7 +1662,11 @@ int unit_free(struct block_list *bl) {
 			aFree (pd->loot);
 			pd->loot = NULL;
 		}
-		if (sd) sd->pd = NULL;
+		if (sd) {
+			if(sd->pet.intimate > 0)
+				intif_save_petdata(sd->status.account_id,&sd->pet);
+			sd->pd = NULL;
+		}
 	} else if(bl->type == BL_MOB) {
 		struct mob_data *md = (struct mob_data*)bl;
 		if(md->deletetimer!=-1)