summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-05-17 19:16:11 -0600
committerJared Adams <jaxad0127@gmail.com>2010-05-17 21:49:16 -0600
commit3b4e7795c9ab3036988a1a7dfe6f5ed2ad12199d (patch)
treeed0e8cc5b608c31ac79e6d1de03d9ddfc74fa339 /src/game.cpp
parent51945aa1af6f2a6dc15027ef40cf0ccf424d46e1 (diff)
downloadmana-3b4e7795c9ab3036988a1a7dfe6f5ed2ad12199d.tar.gz
mana-3b4e7795c9ab3036988a1a7dfe6f5ed2ad12199d.tar.bz2
mana-3b4e7795c9ab3036988a1a7dfe6f5ed2ad12199d.tar.xz
mana-3b4e7795c9ab3036988a1a7dfe6f5ed2ad12199d.zip
Remove Monster, Player, and NPC classes
Instead of having these three subclasses with minor differences, this commit merges them back into Being. In the future, we can make Beings that are talkable to some, attackable by others, etc. This also puts back support for monster equipment. Also changes remaining references to Being::Type and the constants to refer to ActorSprite::Type. Reviewed-by: Freeyorp
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/game.cpp b/src/game.cpp
index b75d3cdf..c7c1d213 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -37,7 +37,6 @@
#include "localplayer.h"
#include "log.h"
#include "map.h"
-#include "npc.h"
#include "particle.h"
#include "playerrelations.h"
#include "sound.h"
@@ -207,7 +206,7 @@ static void destroyGuiWindows()
Game *Game::mInstance = 0;
Game::Game():
- mLastTarget(Being::UNKNOWN),
+ mLastTarget(ActorSprite::UNKNOWN),
mCurrentMap(0), mMapName("")
{
assert(!mInstance);
@@ -756,7 +755,7 @@ void Game::handleInput()
return;
// Moving player around
- if (player_node->isAlive() && !NPC::isTalking() &&
+ if (player_node->isAlive() && !Being::isTalking() &&
!chatWindow->isInputFocused() && !quitDialog)
{
// Get the state of the keyboard keys
@@ -835,7 +834,7 @@ void Game::handleInput()
{
// Only auto target Monsters
target = beingManager->findNearestLivingBeing(player_node,
- 20, Being::MONSTER);
+ 20, ActorSprite::MONSTER);
}
player_node->attack(target, newTarget);
}
@@ -847,14 +846,14 @@ void Game::handleInput()
(joystick && joystick->buttonPressed(3))) &&
!keyboard.isKeyActive(keyboard.KEY_TARGET))
{
- Being::Type currentTarget = Being::UNKNOWN;
+ ActorSprite::Type currentTarget = ActorSprite::UNKNOWN;
if (keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) ||
(joystick && joystick->buttonPressed(3)))
- currentTarget = Being::MONSTER;
+ currentTarget = ActorSprite::MONSTER;
else if (keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER))
- currentTarget = Being::PLAYER;
+ currentTarget = ActorSprite::PLAYER;
else if (keyboard.isKeyActive(keyboard.KEY_TARGET_NPC))
- currentTarget = Being::NPC;
+ currentTarget = ActorSprite::NPC;
Being *target = beingManager->findNearestLivingBeing(player_node,
20, currentTarget);
@@ -868,7 +867,7 @@ void Game::handleInput()
}
else
{
- mLastTarget = Being::UNKNOWN; // Reset last target
+ mLastTarget = ActorSprite::UNKNOWN; // Reset last target
}
// Talk to the nearest NPC if 't' pressed
@@ -879,8 +878,8 @@ void Game::handleInput()
if (target)
{
- if (target->getType() == Being::NPC)
- static_cast<NPC*>(target)->talk();
+ if (target->canTalk())
+ target->talkTo();
}
}