summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAaron Marks <nymacro@gmail.com>2005-05-09 09:47:20 +0000
committerAaron Marks <nymacro@gmail.com>2005-05-09 09:47:20 +0000
commitef30b72e8ad5379a7c7ee49b0ff680bde15daa66 (patch)
tree1fbe0f0ce2125bad89e548b1f2a1d392ee751205 /src/main.cpp
parentb6f88ad42d2acf514804777e9cf0f4979566c163 (diff)
downloadmanaserv-ef30b72e8ad5379a7c7ee49b0ff680bde15daa66.tar.gz
manaserv-ef30b72e8ad5379a7c7ee49b0ff680bde15daa66.tar.bz2
manaserv-ef30b72e8ad5379a7c7ee49b0ff680bde15daa66.tar.xz
manaserv-ef30b72e8ad5379a7c7ee49b0ff680bde15daa66.zip
Renamed script-sq.* script-squirrel.*.
Renamed ScriptingInterface to Script (to save typing :)). Updated skill tree definition.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index c3b86cf5..d30501b1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,9 +30,12 @@
#include <SDL.h>
#include <SDL_net.h>
+#include "skill.h"
+
#include "log.h"
#define LOG_FILE "tmwserv.log"
+// Scripting
#ifdef SCRIPT_SUPPORT
#include "script.h"
@@ -44,8 +47,13 @@
#ifdef SCRIPT_RUBY_SUPPORT
#include "script-ruby.h"
#endif
+#ifdef SCRIPT_LUA_SUPPORT
+#include "script-lua.h"
+#endif
+
std::string scriptLanguage = "squirrel";
#endif
+//
#define TMW_WORLD_TICK SDL_USEREVENT
#define SERVER_PORT 9601
@@ -54,6 +62,8 @@ SDL_TimerID worldTimerID; /**< Timer ID of world timer */
int worldTime = 0; /**< Current world time in 100ms ticks */
bool running = true; /**< Determines if server keeps running */
+Skill skillTree("base"); /**< Skill tree */
+
/**
* SDL timer callback, sends a <code>TMW_WORLD_TICK</code> event.
*/
@@ -101,7 +111,7 @@ void initialize()
if (scriptLanguage == "squirrel")
{
- script = new ScriptSquirrel();
+ script = new ScriptSquirrel("main.nut");
script->init();
}
#endif
@@ -125,6 +135,17 @@ void deinitialize()
delete logger;
}
+
+/**
+ * Update game world
+ */
+void updateWorld()
+{
+#ifdef SCRIPT_SUPPORT
+ script->update();
+#endif
+}
+
/**
* Main function, initializes and runs server.
*/
@@ -166,9 +187,8 @@ int main(int argc, char *argv[])
// - Handle all messages that are in the message queue
// - Update all active objects/beings
-#ifdef SCRIPT_SUPPORT
- script->update();
-#endif
+ updateWorld();
+
}
else if (event.type == SDL_QUIT)
{