Implemented the changes to ConfigUtility in the client and server

The server's changes were easy. The clients means that the constructors
for each scene have one less argument, and each scene has one less member.
The exception to this is LobbyMenu, where the config is used in multiple
places, so it was easier to have the config's reference as a member.

To replace the config's usage, I added this line in most cases:

ConfigUtility& config = ConfigUtility::GetSingleton();

The only requirement is that ConfigUtility::Create() and
ConfigUtility::Delete() are called from the main() function.
This commit is contained in:
Kayne Ruse
2014-08-03 23:20:39 +10:00
parent c830fa0537
commit fd320767c5
20 changed files with 59 additions and 56 deletions
+10
View File
@@ -21,6 +21,9 @@
*/
#include "server_application.hpp"
//singletons
#include "config_utility.hpp"
#include <stdexcept>
#include <iostream>
@@ -28,10 +31,17 @@ using namespace std;
int main(int argc, char** argv) {
try {
//create the singletons
ConfigUtility::Create();
//call the server's routines
ServerApplication app;
app.Init(argc, argv);
app.Proc();
app.Quit();
//delete the singletons
ConfigUtility::Delete();
}
catch(exception& e) {
cerr << "Fatal exception thrown: " << e.what() << endl;
+1 -1
View File
@@ -83,7 +83,7 @@ private:
sqlite3* database = nullptr;
lua_State* luaState = nullptr;
UDPNetworkUtility network;
ConfigUtility config;
ConfigUtility& config = ConfigUtility::GetSingleton();
//simple tables
std::map<int, ClientData> clientMap;