Bandaid fix to CopyCharacter function.

This commit is contained in:
JJ 2013-12-02 22:20:46 -05:00
parent 0f54830bc5
commit 02c9007765
2 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 12/02/2013 ==
JJ: Bandaid fix to CopyCharacter function.
== 11/29/2013 == == 11/29/2013 ==
demonstar55: Stacking issues should be resolved now, probably could be optimized more, but went from 3 loops that do stuff to 3 where only 2 really does stuff and one breaks early in most cases, so slightly better demonstar55: Stacking issues should be resolved now, probably could be optimized more, but went from 3 loops that do stuff to 3 where only 2 really does stuff and one breaks early in most cases, so slightly better

View File

@ -1670,6 +1670,7 @@ bool Database::MoveCharacterToZone(uint32 iCharID, const char* iZonename) {
} }
uint8 Database::CopyCharacter(const char* oldname, const char* newname, uint32 acctid) { uint8 Database::CopyCharacter(const char* oldname, const char* newname, uint32 acctid) {
//TODO: Rewrite better function
char errbuf[MYSQL_ERRMSG_SIZE]; char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0; char *query = 0;
MYSQL_RES *result; MYSQL_RES *result;
@ -1677,7 +1678,7 @@ uint8 Database::CopyCharacter(const char* oldname, const char* newname, uint32 a
PlayerProfile_Struct* pp; PlayerProfile_Struct* pp;
ExtendedProfile_Struct* ext; ExtendedProfile_Struct* ext;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT profile, guild, guildrank, extprofile FROM character_ WHERE name='%s'", oldname), errbuf, &result)) { if (RunQuery(query, MakeAnyLenString(&query, "SELECT profile, extprofile FROM character_ WHERE name='%s'", oldname), errbuf, &result)) {
safe_delete_array(query); safe_delete_array(query);
row = mysql_fetch_row(result); row = mysql_fetch_row(result);
@ -1685,7 +1686,7 @@ uint8 Database::CopyCharacter(const char* oldname, const char* newname, uint32 a
pp = (PlayerProfile_Struct*)row[0]; pp = (PlayerProfile_Struct*)row[0];
strcpy(pp->name, newname); strcpy(pp->name, newname);
ext = (ExtendedProfile_Struct*)row[3]; ext = (ExtendedProfile_Struct*)row[1];
mysql_free_result(result); mysql_free_result(result);
} }
@ -1711,7 +1712,6 @@ uint8 Database::CopyCharacter(const char* oldname, const char* newname, uint32 a
return 0; return 0;
} }
// @merth: Need to copy inventory as well (and shared bank?)
if (affected_rows == 0) { if (affected_rows == 0) {
return 0; return 0;
} }