src/Account.cpp

00001 #include "Account.h"
00002 #include  "cppsqlite3.h"
00003 #include "Server.h"
00004 #include "Logger.h"
00005 #include "Char.h"
00006 
00007 Account::Account(Server* server,
00008                 Client* client,
00009                 Uint32 id,
00010                 const std::string& username ,
00011                 const std::string& name ,
00012                 const std::string& surname ,
00013                 const std::string& email,
00014                 Uint32 char_id )
00015     :myServer(server),
00016     myClient(client),
00017     myId(id),
00018     myUsername(username),
00019     myName(name),
00020     mySurname(surname),
00021     myEmail(email),
00022     myCharID(char_id),
00023     myChar(NULL)
00024 {
00025     // Builds the Character associated with the account.
00026 
00027 
00028     try{
00029         Uint32 tmpSerial;
00030         myServer->getNextGoSerial(tmpSerial);
00031         myChar = new Char(tmpSerial, GO_PLAYER, myCharID); // We delegate database queries to the Char ctor.
00032 
00033     }
00034     catch(CppSQLite3Exception& e){
00035         std::ostringstream oss;
00036         oss << myCharID;
00037         Logger::getInstance()->log("Error creating Char with id :"+oss.str(), LOGMODE_DB);
00038     }
00039 
00040 }
00041 
00042 Account::~Account(){
00043     if(myChar)
00044         delete myChar;
00045 }

Generated on Mon Dec 3 04:30:12 2007 for lo-testserver by  doxygen 1.3.9.1