summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-02-06 02:56:48 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-02-06 02:56:48 +0000
commite2c61ef8ec4f8685c0eafa2284c7485cec489021 (patch)
treecf2805221603b14e679205845fa0734702a8aae2 /src/game.cpp
parent2a7690e2687a43fdc0004684b7de97b2d84cb8b0 (diff)
downloadmana-e2c61ef8ec4f8685c0eafa2284c7485cec489021.tar.gz
mana-e2c61ef8ec4f8685c0eafa2284c7485cec489021.tar.bz2
mana-e2c61ef8ec4f8685c0eafa2284c7485cec489021.tar.xz
mana-e2c61ef8ec4f8685c0eafa2284c7485cec489021.zip
Added a FloorItemManager class.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 75545de4..a2e0912b 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -34,7 +34,7 @@
#include "beingmanager.h"
#include "configuration.h"
#include "engine.h"
-#include "floor_item.h"
+#include "flooritemmanager.h"
#include "graphics.h"
#include "localplayer.h"
#include "log.h"
@@ -133,6 +133,7 @@ HelpWindow *helpWindow;
DebugWindow *debugWindow;
BeingManager *beingManager = NULL;
+FloorItemManager *floorItemManager = NULL;
const int MAX_TIME = 10000;
@@ -277,6 +278,7 @@ Game::Game(Network *network):
engine = new Engine(network);
beingManager = new BeingManager(network);
+ floorItemManager = new FloorItemManager();
// Initialize timers
tick_time = 0;
@@ -352,6 +354,12 @@ Game::~Game()
delete player_node;
destroyGuiWindows();
+ delete beingManager;
+ delete floorItemManager;
+
+ beingManager = NULL;
+ floorItemManager = NULL;
+
if (joypad != NULL)
{
SDL_JoystickClose(joypad);
@@ -536,7 +544,7 @@ void Game::handleInput()
case SDLK_z:
if (!chatWindow->isFocused())
{
- FloorItem *item = find_floor_item_by_cor(
+ FloorItem *item = floorItemManager->findByCoordinates(
player_node->x, player_node->y);
// If none below the player, try the tile in front of
@@ -557,7 +565,7 @@ void Game::handleInput()
case Being::SE: x++; y++; break;
default: break;
}
- item = find_floor_item_by_cor(x, y);
+ item = floorItemManager->findByCoordinates(x, y);
}
if (item)
@@ -774,7 +782,7 @@ void Game::handleInput()
if (joy[JOY_BTN1])
{
- FloorItem *item = find_floor_item_by_cor(
+ FloorItem *item = floorItemManager->findByCoordinates(
player_node->x, player_node->y);
if (item)