summaryrefslogtreecommitdiff
path: root/src/game-server/testing.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-14 16:34:34 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-14 16:34:34 +0000
commit2fa455ff7870dc09d75bb89a897c7c1d26eb9020 (patch)
tree8417c6fd49f862f00234683e3a06a8d50a4f281c /src/game-server/testing.cpp
parenta88aa0a9af24962f8eea11e039fcf34dade66037 (diff)
downloadmanaserv-2fa455ff7870dc09d75bb89a897c7c1d26eb9020.tar.gz
manaserv-2fa455ff7870dc09d75bb89a897c7c1d26eb9020.tar.bz2
manaserv-2fa455ff7870dc09d75bb89a897c7c1d26eb9020.tar.xz
manaserv-2fa455ff7870dc09d75bb89a897c7c1d26eb9020.zip
Made it possible to load scripts from strings instead of files.
Diffstat (limited to 'src/game-server/testing.cpp')
-rw-r--r--src/game-server/testing.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/game-server/testing.cpp b/src/game-server/testing.cpp
index 7b34d79a..f32ca68c 100644
--- a/src/game-server/testing.cpp
+++ b/src/game-server/testing.cpp
@@ -5,6 +5,7 @@
#include <cassert>
#include "defines.h"
+#include "resourcemanager.h"
#include "game-server/gamehandler.hpp"
#include "game-server/item.hpp"
#include "game-server/itemmanager.hpp"
@@ -36,9 +37,18 @@ void testingMap(MapComposite *map)
dropItem(map, 58 * 32 + 16, 21 * 32 + 16, 524);
// Associate a script
- Script *s = Script::create("lua", "test.lua");
+ Script *s = Script::create("lua");
if (s)
{
+ ResourceManager *resman = ResourceManager::getInstance();
+ int fileSize;
+ char *buffer = (char *)resman->loadFile("test.lua", fileSize);
+ if (buffer)
+ {
+ s->load(buffer);
+ free(buffer);
+ }
+
map->setScript(s);
s->setMap(map);
s->prepare("initialize");