summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorMateusz Kaduk <mateusz.kaduk@gmail.com>2005-05-22 05:48:22 +0000
committerMateusz Kaduk <mateusz.kaduk@gmail.com>2005-05-22 05:48:22 +0000
commit198d4aac190c28ab245fb979336c06cb0c51776c (patch)
tree95638b542c6aba1384c15e5a7e5b6da2bf2b65f3 /src/main.cpp
parentc816b6cdf4d8e7eb9e16b8b5db80c72376461e46 (diff)
downloadmanaserv-198d4aac190c28ab245fb979336c06cb0c51776c.tar.gz
manaserv-198d4aac190c28ab245fb979336c06cb0c51776c.tar.bz2
manaserv-198d4aac190c28ab245fb979336c06cb0c51776c.tar.xz
manaserv-198d4aac190c28ab245fb979336c06cb0c51776c.zip
Added main.h with database reference, opening and closing database
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index db9b6ae7..afcfe239 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -24,6 +24,7 @@
#define TMWSERV_VERSION "0.0.1"
#include <iostream>
+#include "main.h"
#include "netsession.h"
#include "connectionhandler.h"
#include "accounthandler.h"
@@ -63,6 +64,7 @@ int worldTime = 0; /**< Current world time in 100ms ticks */
bool running = true; /**< Determines if server keeps running */
Skill skillTree("base"); /**< Skill tree */
+SQLiteWrapper sqlite; /**< Database */
/**
* SDL timer callback, sends a <code>TMW_WORLD_TICK</code> event.
@@ -111,6 +113,14 @@ void initialize()
if (scriptLanguage == "squirrel")
script = new ScriptSquirrel("main.nut");
#endif
+
+ // Open database
+ if (sqlite.Open("tmw.db")) {
+ std::cout << "tmw.db created or opened" << std::endl;
+ }
+ else {
+ std::cout << "couldn't open tmw.db" << std::endl;
+ }
}
/**
@@ -129,6 +139,14 @@ void deinitialize()
delete script;
#endif
delete logger;
+
+ // Close database
+ if (sqlite.Close()) {
+ std::cout << "tmw.db closed" << std::endl;
+ }
+ else {
+ std::cout << "couldn't close tmw.db" << std::endl;
+ }
}