diff options
-rw-r--r-- | ChangeLog | 72 | ||||
-rw-r--r-- | src/accounthandler.cpp | 12 | ||||
-rw-r--r-- | src/configuration.h | 2 | ||||
-rw-r--r-- | src/main.cpp | 2 |
4 files changed, 54 insertions, 34 deletions
@@ -1,51 +1,57 @@ +2005-12-02 Yohann Ferreira <bertram@cegetel.net> + + * src/main.cpp, src/accounthandler.h, src/accounthandler.cpp, + src/configuration.h: Made the accounthandler reopen the db for + SQLite to enable registering ! Now working. + 2005-11-21 Aaron Marks <nymacro@gmail.com> - * src/state.cpp: Re-ordered a few statements to work better. - * src/dalstorage.cpp: Now sets being's current map when getting a - player's account. - + * src/state.cpp: Re-ordered a few statements to work better. + * src/dalstorage.cpp: Now sets being's current map when getting a + player's account. + 2005-11-16 Aaron Marks <nymacro@gmail.com> - * src/state.h, src/state.cpp: Updated world related functions. - * src/accounthandler.cpp: Now adds players who have selected a - character to the game world. - * src/object.h: Updated to include member variable for current map - the object is located. + * src/state.h, src/state.cpp: Updated world related functions. + * src/accounthandler.cpp: Now adds players who have selected a + character to the game world. + * src/object.h: Updated to include member variable for current map + the object is located. 2005-11-15 Aaron Marks <nymacro@gmail.com> - * src/state.h, src/state.cpp: Updated world representation, added - various methods which provide easy access to the game world. - * src/defines.h: Added "private message" message. - * src/client.cpp, scripts/init.rb: Added experimental remote access - to Ruby's functionality. + * src/state.h, src/state.cpp: Updated world representation, added + various methods which provide easy access to the game world. + * src/defines.h: Added "private message" message. + * src/client.cpp, scripts/init.rb: Added experimental remote access + to Ruby's functionality. 2005-11-14 Aaron Marks <nymacro@gmail.com> - * src/bindings.i: Enabled "directors", allowing scripting language - to override virtual functions. + * src/bindings.i: Enabled "directors", allowing scripting language + to override virtual functions. 2005-11-12 Aaron Marks <nymacro@gmail.com> - * src/main.cpp: Added scripting with Ruby support - * src/bindings.i: Created basic SWIG bindings. - * src/Makefile.am: Updated to support Ruby & generate SWIG - bindings. - * configure.ac: Updated to detect SWIG & Ruby, using them - appropriately. - * scripts/init.rb: Server initialization test script. + * src/main.cpp: Added scripting with Ruby support + * src/bindings.i: Created basic SWIG bindings. + * src/Makefile.am: Updated to support Ruby & generate SWIG + bindings. + * configure.ac: Updated to detect SWIG & Ruby, using them + appropriately. + * scripts/init.rb: Server initialization test script. 2005-11-10 Aaron Marks <nymacro@gmail.com> - * src/client.cpp: Updated client to support moving and equipping. - * src/being.h, src/being.cpp: Added "hasItem" - * src/state.cpp: Added beings updating. - + * src/client.cpp: Updated client to support moving and equipping. + * src/being.h, src/being.cpp: Added "hasItem" + * src/state.cpp: Added beings updating. + 2005-10-24 Yohann Ferreira <Bertram@cegetel.net> - * src/main.cpp: Added more useful infos at startup. - * src/dal/dataprovider.h, src/dal/dataprovider.cpp, - src/dal/sqlitedataprovider.cpp, src/dal/mysqldataprovider.cpp, - src/dal/pqdataprovider.cpp, src/main.cpp, src/client.cpp: - Grammar corrections, and a little bit of work on getting the name - of the Db. + * src/main.cpp: Added more useful infos at startup. + * src/dal/dataprovider.h, src/dal/dataprovider.cpp, + src/dal/sqlitedataprovider.cpp, src/dal/mysqldataprovider.cpp, + src/dal/pqdataprovider.cpp, src/main.cpp, src/client.cpp: + Grammar corrections, and a little bit of work on getting the name + of the Db. diff --git a/src/accounthandler.cpp b/src/accounthandler.cpp index 30e726d5..df4c1f9f 100644 --- a/src/accounthandler.cpp +++ b/src/accounthandler.cpp @@ -27,6 +27,7 @@ #include "account.h" #include "messageout.h" #include "state.h" +#include "configuration.h" #include <iostream> using tmwserv::Account; @@ -40,8 +41,18 @@ using tmwserv::Storage; */ void AccountHandler::receiveMessage(NetComputer &computer, MessageIn &message) { + Storage &store = Storage::instance("tmw"); +#if defined (SQLITE_SUPPORT) + // Reopen the db in this thread for sqlite, to avoid + // Library Call out of sequence problem due to thread safe. + store.setUser(config.getValue("dbuser", "")); + store.setPassword(config.getValue("dbpass", "")); + store.close(); + store.open(); +#endif + MessageOut result; switch (message.getId()) @@ -59,6 +70,7 @@ void AccountHandler::receiveMessage(NetComputer &computer, MessageIn &message) // see if the account exists Account *acc = store.getAccount(username); + if (!acc) { // account doesn't exist -- send error to client std::cout << "Account does not exist " << username << std::endl; diff --git a/src/configuration.h b/src/configuration.h index 75699f30..4c26f714 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -116,4 +116,6 @@ class Configuration std::string configPath; /**< Location of config file */ }; +extern Configuration config; + #endif diff --git a/src/main.cpp b/src/main.cpp index 1909d057..f197b14c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -168,7 +168,7 @@ void initialize() config.setValue("dbhost", ""); #ifdef WIN32 - std::string configPath = ""; + std::string configPath = "."; #else std::string configPath = getenv("HOME"); #endif |