summaryrefslogtreecommitdiff
path: root/src/game-server
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-09 21:24:56 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-09 21:24:56 +0000
commit031709fc8f63bd6fa2399361bbce96667b767e36 (patch)
treea861adad005952920c6ab2f4123ed168aba9bf3b /src/game-server
parent8b6b751ab16c212078dbebc15c7250cad16c4d8d (diff)
downloadmanaserv-031709fc8f63bd6fa2399361bbce96667b767e36.tar.gz
manaserv-031709fc8f63bd6fa2399361bbce96667b767e36.tar.bz2
manaserv-031709fc8f63bd6fa2399361bbce96667b767e36.tar.xz
manaserv-031709fc8f63bd6fa2399361bbce96667b767e36.zip
Moved creation of testing NPC from C++ to Lua.
Diffstat (limited to 'src/game-server')
-rw-r--r--src/game-server/testing.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/game-server/testing.cpp b/src/game-server/testing.cpp
index 19156203..d08f2ee6 100644
--- a/src/game-server/testing.cpp
+++ b/src/game-server/testing.cpp
@@ -10,18 +10,10 @@
#include "game-server/itemmanager.hpp"
#include "game-server/mapcomposite.hpp"
#include "game-server/mapmanager.hpp"
-#include "game-server/npc.hpp"
#include "game-server/state.hpp"
#include "net/messageout.hpp"
#include "scripting/script.hpp"
-// For testing purpose only, the NPC class is not meant to be inherited!!
-struct DummyNPC: NPC
-{
- DummyNPC(): NPC(110, Script::create("lua", "test.lua"))
- {}
-};
-
static void dropItem(MapComposite *map, int x, int y, int type)
{
ItemClass *ic = ItemManager::getItem(type);
@@ -43,11 +35,14 @@ void testingMap(MapComposite *map)
dropItem(map, 58 * 32 + 16, 20 * 32 + 16, 508);
dropItem(map, 58 * 32 + 16, 21 * 32 + 16, 524);
- // Add an NPC
- NPC *q = new DummyNPC;
- q->setMap(map);
- q->setPosition(Point(50 * 32 + 16, 19 * 32 + 16));
- GameState::insert(q);
+ // Associate a script
+ Script *s = Script::create("lua", "test.lua");
+ if (s)
+ {
+ s->setMap(map);
+ s->prepare("initialize");
+ s->execute();
+ }
} break;
}
}