From 08b15ca37fd6cb658a873b36115f2c78be29e272 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Tue, 10 Feb 2009 14:45:26 +0100 Subject: Removed testing.cpp because all of its functionality can now be covered by LUA scripts --- gameserver.cbp | 217 ++++++++++++++++++++--------------------- src/Makefile.am | 1 - src/game-server/mapmanager.cpp | 3 - src/game-server/testing.cpp | 36 ------- src/scripting/lua.cpp | 8 ++ 5 files changed, 116 insertions(+), 149 deletions(-) delete mode 100644 src/game-server/testing.cpp diff --git a/gameserver.cbp b/gameserver.cbp index a2de976..0311d10 100644 --- a/gameserver.cbp +++ b/gameserver.cbp @@ -23,7 +23,7 @@ - @@ -53,111 +53,110 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Makefile.am b/src/Makefile.am index f892382..62cc50f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -138,7 +138,6 @@ tmwserv_game_SOURCES = \ game-server/spawnarea.cpp \ game-server/state.hpp \ game-server/state.cpp \ - game-server/testing.cpp \ game-server/thing.hpp \ game-server/thing.cpp \ game-server/trade.hpp \ diff --git a/src/game-server/mapmanager.cpp b/src/game-server/mapmanager.cpp index 68372ed..2cc37de 100644 --- a/src/game-server/mapmanager.cpp +++ b/src/game-server/mapmanager.cpp @@ -132,9 +132,6 @@ void MapManager::raiseActive(int mapId) MapReader::readMap(file, composite); LOG_INFO("Activated map \"" << file << "\" (id " << mapId << ")"); - // Add some testing stuff - extern void testingMap(MapComposite *); - testingMap(composite); } diff --git a/src/game-server/testing.cpp b/src/game-server/testing.cpp deleted file mode 100644 index 4828df4..0000000 --- a/src/game-server/testing.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* This file is for testing purpose only. It hardcodes some events related - to the game. It should be removed once all the related managers have been - implemented. There are no headers for this file on purpose. */ - -#include - -#include "game-server/gamehandler.hpp" -#include "game-server/item.hpp" -#include "game-server/itemmanager.hpp" -#include "game-server/mapcomposite.hpp" -#include "game-server/state.hpp" -#include "scripting/script.hpp" - -static void dropItem(MapComposite *map, int x, int y, int type) -{ - ItemClass *ic = ItemManager::getItem(type); - assert(ic); - Item *i = new Item(ic, 1); - i->setMap(map); - Point pos(x, y); - i->setPosition(pos); - GameState::insertSafe(i); -} - -void testingMap(MapComposite *map) -{ - switch (map->getID()) - { - case 1: - { - // Drop some items. - dropItem(map, 58 * 32 + 16, 20 * 32 + 16, 508); - dropItem(map, 58 * 32 + 16, 21 * 32 + 16, 524); - } break; - } -} diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 010179b..1cfb876 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -982,6 +982,14 @@ static int get_map_id(lua_State *s) */ static int item_drop(lua_State *s) { + if (!lua_isnumber(s, 1) || + !lua_isnumber(s, 2) || + !lua_isnumber(s, 3)) + { + raiseScriptError(s, "trigger_create called with incorrect parameters."); + return 0; + } + int x = lua_tointeger(s, 1); int y = lua_tointeger(s, 2); int type = lua_tointeger(s, 3); -- cgit