summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--src/accounthandler.cpp9
-rw-r--r--src/dalstorage.cpp10
3 files changed, 22 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 5aeee76a..3c0dc58e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2005-12-08 Yohann Ferreira <bertram@cegetel.net>
+ * src/dalstorage.cpp, src/accounthandler.cpp: Temporary
+ made a workaround the character misloading at login.
+ Work is to be made to see why the mapInfo recordset is
+ buggy. Also made the server more verbose about characters.
+
+2005-12-08 Yohann Ferreira <bertram@cegetel.net>
+
* src/dalstorage.cpp, src/dalstorage.h, src/storage.h:
Radically improve the getEmailList() again based on
MrLindejer's good idea.
diff --git a/src/accounthandler.cpp b/src/accounthandler.cpp
index b3e89edd..fbb5c803 100644
--- a/src/accounthandler.cpp
+++ b/src/accounthandler.cpp
@@ -97,13 +97,17 @@ void AccountHandler::receiveMessage(NetComputer &computer, MessageIn &message)
tmwserv::Beings &chars = computer.getAccount()->getCharacters();
result.writeByte(chars.size());
+ std::cout << username << "'s account has " << chars.size() << " character(s)." << std::endl;
+
for (unsigned int i = 0; i < chars.size(); i++) {
result.writeString(chars[i]->getName());
+ std::cout << chars[i]->getName() << ", ";
result.writeByte(chars[i]->getLevel());
result.writeByte(chars[i]->getMoney());
//result.writeString(chars[i]->getRawStatistics(),
// sizeof(tmwserv::RawStatistics));
}
+ std::cout << std::endl;
}
}
break;
@@ -193,7 +197,7 @@ void AccountHandler::receiveMessage(NetComputer &computer, MessageIn &message)
{
result.writeShort(SMSG_CHAR_CREATE_RESPONSE);
result.writeByte(CREATE_TOO_MUCH_CHARACTERS);
- std::cout << "Already has 3 characters. Can't create another Character." << std::endl;
+ std::cout << "Already has " << MAX_OF_CHARACTERS << " characters. Can't create another Character." << std::endl;
break;
}
@@ -207,6 +211,9 @@ void AccountHandler::receiveMessage(NetComputer &computer, MessageIn &message)
tmwserv::BeingPtr newCharacter(new tmwserv::Being(name, sex, 1, 0, stats));
computer.getAccount()->addCharacter(newCharacter);
+ std::cout << "Character " << name << " was created for "
+ << computer.getAccount()->getName() << "'s account." << std::endl;
+
store.flush(); // flush changes
result.writeShort(SMSG_CHAR_CREATE_RESPONSE);
result.writeByte(CREATE_OK);
diff --git a/src/dalstorage.cpp b/src/dalstorage.cpp
index f8b8c2db..be71c90b 100644
--- a/src/dalstorage.cpp
+++ b/src/dalstorage.cpp
@@ -225,6 +225,9 @@ DALStorage::getAccount(const std::string& userName)
if (!charInfo.isEmpty()) {
Beings beings;
+ std::cout << userName << "'s account has " << charInfo.rows()
+ << " character(s) in database." << std::endl;
+
for (unsigned int i = 0; i < charInfo.rows(); ++i) {
RawStatistics stats = {
toUshort(charInfo(i, 9)), // strength
@@ -252,6 +255,7 @@ DALStorage::getAccount(const std::string& userName)
sql = ss.str();
// should be impossible for this to fail due to db referential integrity
+/* This is buggy for now as the map table is empty.
const RecordSet& mapInfo = mDb->execSql(sql);
if (!mapInfo.isEmpty())
@@ -262,13 +266,13 @@ DALStorage::getAccount(const std::string& userName)
{
// TODO: Set player to default map and one of the default location
}
-
+*/
mCharacters.push_back(being);
beings.push_back(being);
- }
+ } // End of for each characters
account->setCharacters(beings);
- }
+ } // End if there are characters.
return account.get();
}