Disabled automatic pickup of Health Orb (has to be done manually).

This commit is contained in:
Felix Ableitner 2013-09-18 15:39:47 +02:00
parent e0ef9008c6
commit 41b407e611
3 changed files with 9 additions and 11 deletions

View file

@ -187,12 +187,7 @@ Game::updateGui() {
mWindow.getSize().y - mRightGadget->getSize().y);
auto item = mWorld.getClosestItem(mPlayer->getPosition());
auto orb = std::dynamic_pointer_cast<HealthOrb>(item);
if (orb && mPlayer->getHealth() < mPlayer->getMaxHealth()) {
mPlayer->onDamage(- orb->getAmountHealed());
mWorld.remove(item);
}
else if (item) {
if (item) {
mPickupInstruction->setText("F - pick up " + item->getName());
mPickupInstruction->setPosition(
mWindow.getSize().x / 2 - mPickupInstruction->getSize().x / 2,

View file

@ -12,8 +12,6 @@
#include "util/Vector.h"
// TODO: remove right click move (also in readme)
/**
* Creates Game object.
*/

View file

@ -343,7 +343,10 @@ Character::pickUpItem() {
return;
}
std::shared_ptr<Weapon> weapon = std::dynamic_pointer_cast<Weapon>(closest);
auto weapon = std::dynamic_pointer_cast<Weapon>(closest);
auto gadget = std::dynamic_pointer_cast<Gadget>(closest);
auto orb = std::dynamic_pointer_cast<HealthOrb>(closest);
if (weapon) {
mWorld.insert(mActiveWeapon);
mActiveWeapon->drop(getPosition());
@ -351,8 +354,7 @@ Character::pickUpItem() {
? setFirstWeapon(weapon)
: setSecondWeapon(weapon);
}
std::shared_ptr<Gadget> gadget = std::dynamic_pointer_cast<Gadget>(closest);
if (gadget) {
else if (gadget) {
if (mRightGadget) {
mWorld.insert(mRightGadget);
mRightGadget->drop(getPosition());
@ -360,6 +362,9 @@ Character::pickUpItem() {
mRightGadget = mLeftGadget;
mLeftGadget = gadget;
}
else if (orb) {
onDamage(- orb->getAmountHealed());
}
mWorld.remove(closest);
}