From 2fa455ff7870dc09d75bb89a897c7c1d26eb9020 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Tue, 14 Aug 2007 16:34:34 +0000 Subject: Made it possible to load scripts from strings instead of files. --- src/game-server/testing.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/game-server/testing.cpp') diff --git a/src/game-server/testing.cpp b/src/game-server/testing.cpp index 7b34d79..f32ca68 100644 --- a/src/game-server/testing.cpp +++ b/src/game-server/testing.cpp @@ -5,6 +5,7 @@ #include #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"); -- cgit