Issue information

Issue ID
#20
Status
Working as Intended
Severity
None
Started
Hercules Elf Bot
Sep 6, 2007 16:00
Last Post
Hercules Elf Bot
Mar 15, 2012 13:07
Confirmation
N/A

Hercules Elf Bot - Sep 6, 2007 16:00

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=20

Short summary:
The charserver doesn't display the character list properly. When first logging in, the server allows you to create a character on the same position where a character already exists - although it logs you in with the original character's data. Other side-effects include not displaying newly created chars, etc etc.

When a player gets to the charserver, his auth data comes with him...br />
CODE
        ///////////////////////////////////////////////////////////////////////
         // receive auth information
         case 0x2750:
             account.CCharAccount::frombuffer( RFIFOP(fd,2) );
             char_db.saveAccount(account);
             ...
and overwrites what was there previously, due to an apparently failed lookup (shouldn't happen I assume since the cAccountList object had the value inserted at startup)
CODE
bool CCharDB_mem::saveAccount(CCharAccount& account)
{
     size_t pos;
     if( cAccountList.find(account,0,pos) )
     {    // exist -> update list entry
         cAccountList[pos].CCharAccount::operator=(account);
         return true;
     }
     else
     {    // create new
->        return cAccountList.insert(account);
     }
}
I'd also like to point out that 'account' is of type CCharAccount, while the container is of type CCharCharAccount[] (inherited object that contains the character list array).

And for even more detail, it sorta blows up here
CODE
CCharCharAccount(const CCharAccount& c) : CCharAccount?    
    {
        memset(charlist,0,sizeof(charlist));
    }
which is what gets inserted after the previous (correct) entry has been deleted from the list.

Here's the complete stack trace for when visual studio hit the data breakpoint (the character list for the account entry being deleted):
CODE
char-server.exe!memset(unsigned char * dst=0x000000dd, unsigned char value='(', unsigned long count=44255200)  Line 127
char-server.exe!_free_dbg_nolock(void * pUserData=0x02a34800, int nBlockUse=1)  Line 1417 + 0x1b bytes
char-server.exe!_free_dbg(void * pUserData=0x02a34800, int nBlockUse=1)  Line 1245 + 0xd bytes
char-server.exe!free(void * pUserData=0x02a34800)  Line 49 + 0xb bytes
char-server.exe!operator delete[](void * p=0x02a34800)  Line 77 + 0x9 bytes
char-server.exe!CCharCharAccount::`vector deleting destructor'()  + 0x42 bytes
char-server.exe!basics::allocator_w_dy<CCharCharAccount>::checkwrite(unsigned int addsize=1)  Line 443 + 0x1f bytes
char-server.exe!basics::slist<CCharCharAccount,basics::allocator_w_dy<CCharCharAccount> >::convert_append_multiple<CCharCharAccount>(const CCharCharAccount & elem={...}, unsigned int cnt=1)  Line 1633 + 0x28 bytes
char-server.exe!basics::slist<CCharCharAccount,basics::allocator_w_dy<CCharCharAccount> >::insert(const CCharCharAccount & elem={...}, unsigned int cnt=1, unsigned int __formal=4294967295)  Line 1660
char-server.exe!CCharDB_mem::saveAccount(CCharAccount & account={...})  Line 504 + 0x32 bytes
char-server.exe!CCharDB::saveAccount(CCharAccount & account={...})  Line 281 + 0x23 bytes
char-server.exe!parse_tologin(int fd=0)  Line 1185
char-server.exe!process_read(unsigned int fd=0)  Line 1137 + 0x13 bytes
char-server.exe!process_fdset(fd_set * fds=0x0017beec, void (unsigned int)* func=0x004e83e3)  Line 1188 + 0x7 bytes
char-server.exe!do_sendrecv(int next=4939)  Line 1392 + 0x11 bytes
char-server.exe!main(int argc=1, char * * argv=0x02e02178)  Line 308 + 0x9 bytes


This post has been edited by DracoRPG: Sep 7 2007, 05:56 AM