src/Char.cpp

00001 #include "Char.h"
00002 #include "cppsqlite3.h"
00003 #include "Logger.h"
00004 
00005 Char::Char(Uint32 serial, Uint16 type, Uint32 dbId)
00006     :IMoveableObject(serial, type),
00007     myId(dbId)
00008 {
00009     CppSQLite3DB accDb;
00010     accDb.open("accounts.db");
00011 
00012     std::ostringstream oss;
00013     oss << myId;
00014     std::string query = "SELECT * FROM characters WHERE id = \""+oss.str()+"\";";
00015     CppSQLite3Query q = accDb.execQuery(query.c_str());
00016 
00017     if (!q.eof()){
00018         setName(q.fieldValue(2));
00019         setPosition(Location(q.getIntField(3),q.getIntField(4),0));
00020     }
00021     else{
00022         Logger::getInstance()->log("Error creating Character with ID "+oss.str(), LOGMODE_DB);
00023     }
00024 
00025     accDb.close();
00026 }
00027 
00028 Char::~Char()
00029 {
00030     //dtor
00031 }
00032 
00033 void Char::update(){
00034 
00035 }
00036 
00037 

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