diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-07-07 16:50:47 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-07-07 16:50:47 +0000 |
commit | 04e694b067a21dee8e13368c17d1815cc0624ce4 (patch) | |
tree | a57ab98d76040838fa369e6823544baeb19d1bbc /src/game-server/testing.cpp | |
parent | 60b4a57bdfe664a6729b3573a6a614621b6c2b2c (diff) | |
download | manaserv-04e694b067a21dee8e13368c17d1815cc0624ce4.tar.gz manaserv-04e694b067a21dee8e13368c17d1815cc0624ce4.tar.bz2 manaserv-04e694b067a21dee8e13368c17d1815cc0624ce4.tar.xz manaserv-04e694b067a21dee8e13368c17d1815cc0624ce4.zip |
Simplified code by using map pointers only, instead of using both map IDs and map pointers.
Diffstat (limited to 'src/game-server/testing.cpp')
-rw-r--r-- | src/game-server/testing.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/game-server/testing.cpp b/src/game-server/testing.cpp index cd2f08fb..495b3617 100644 --- a/src/game-server/testing.cpp +++ b/src/game-server/testing.cpp @@ -6,48 +6,50 @@ #include "defines.h" #include "game-server/itemmanager.hpp" +#include "game-server/mapcomposite.hpp" +#include "game-server/mapmanager.hpp" #include "game-server/spawnarea.hpp" #include "game-server/state.hpp" #include "game-server/trigger.hpp" -static Rectangle rectA = { 56 * 32, 12 * 32, 5 * 32, 32 }; -static WarpAction warpA(3, 44 * 32 + 16, 80 * 32 + 16); -static Rectangle rectB = { 42 * 32, 88 * 32, 5 * 32, 32 }; -static WarpAction warpB(1, 58 * 32 + 16, 17 * 32 + 16); - -static void dropItem(int map, int x, int y, int type) +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->setMapId(map); + i->setMap(map); Point pos(x, y); i->setPosition(pos); gameState->insert(i); } -void testingMap(int id) +void testingMap(MapComposite *map) { - switch (id) + static Rectangle rectA = { 56 * 32, 12 * 32, 5 * 32, 32 }; + static WarpAction warpA(mapManager->getMap(3), 44 * 32 + 16, 80 * 32 + 16); + static Rectangle rectB = { 42 * 32, 88 * 32, 5 * 32, 32 }; + static WarpAction warpB(mapManager->getMap(1), 58 * 32 + 16, 17 * 32 + 16); + + switch (map->getID()) { case 1: { // Create maggot spawn area Rectangle maggotSpawnRect = { 720, 900, 320, 320 }; - gameState->insert(new SpawnArea(1, maggotSpawnRect)); + gameState->insert(new SpawnArea(map, maggotSpawnRect)); // Portal to map 3 - gameState->insert(new TriggerArea(1, rectA, &warpA)); + gameState->insert(new TriggerArea(map, rectA, &warpA)); // Drop some items - dropItem(1, 58 * 32 + 16, 20 * 32 + 16, 508); - dropItem(1, 58 * 32 + 16, 21 * 32 + 16, 524); + dropItem(map, 58 * 32 + 16, 20 * 32 + 16, 508); + dropItem(map, 58 * 32 + 16, 21 * 32 + 16, 524); } break; case 3: { // Portal to map 1 - gameState->insert(new TriggerArea(3, rectB, &warpB)); + gameState->insert(new TriggerArea(map, rectB, &warpB)); } break; } } |