From e2ad3e13fb1163f53304bbdbab4c44f12c16731d Mon Sep 17 00:00:00 2001 From: Aaron Marks Date: Tue, 19 Apr 2005 09:30:43 +0000 Subject: Added basic object definition for reviewal. Added basic scripting interface & Squirrel (squirrel.sf.net). --- src/main.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 19e95520..56e0d693 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,6 +27,12 @@ #include #include +#ifdef SCRIPT_SUPPORT +#define SCRIPT_SQUIRREL +#include "script.h" +#include "script-sq.h" +#endif + #define TMW_WORLD_TICK SDL_USEREVENT #define SERVER_PORT 9601 @@ -70,6 +76,16 @@ void initialize() // Initialize world timer at 10 times per second worldTimerID = SDL_AddTimer(100, worldTick, NULL); + + // Initialize scripting subsystem +#ifdef SCRIPT_SUPPORT +#ifdef SCRIPT_SQUIRREL + script = new ScriptSquirrel(); +#else +#error Scripting enabled, but no language defined. +#endif + script->init(); +#endif } /** @@ -82,6 +98,11 @@ void deinitialize() // Quit SDL_net SDLNet_Quit(); + + // Destroy scripting subsystem +#ifdef SCRIPT_SUPPORT + delete script; +#endif } /** @@ -124,6 +145,9 @@ 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 } else if (event.type == SDL_QUIT) { -- cgit v1.2.3-60-g2f50