summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/equipment.cpp3
-rw-r--r--src/map.cpp9
-rw-r--r--src/net/equipmenthandler.cpp28
3 files changed, 19 insertions, 21 deletions
diff --git a/src/equipment.cpp b/src/equipment.cpp
index 491aff0c..9a87c6b5 100644
--- a/src/equipment.cpp
+++ b/src/equipment.cpp
@@ -45,7 +45,8 @@ Equipment::removeEquipment(Item *item)
void Equipment::removeEquipment(int index)
{
- mEquipment[index] = 0;
+ if (index >= 0 && index < EQUIPMENT_SIZE)
+ mEquipment[index] = 0;
}
void Equipment::setEquipment(int index, Item *item)
diff --git a/src/map.cpp b/src/map.cpp
index ef622ad0..3adc3498 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -24,7 +24,6 @@
#include "map.h"
#include <queue>
-#include <cassert>
#include "beingmanager.h"
#include "configuration.h"
@@ -223,9 +222,9 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
for (; layeri != mLayers.end(); ++layeri)
{
(*layeri)->draw(graphics,
- startX, startY, endX, endY,
- scrollX, scrollY,
- mSprites);
+ startX, startY, endX, endY,
+ scrollX, scrollY,
+ mSprites);
}
drawOverlay(graphics, scrollX, scrollY,
@@ -339,8 +338,6 @@ void Map::removeSprite(SpriteIterator iterator)
mSprites.erase(iterator);
}
-static int const basicCost = 100;
-
Path Map::findPath(int startX, int startY, int destX, int destY)
{
// Path to be built up (empty by default)
diff --git a/src/net/equipmenthandler.cpp b/src/net/equipmenthandler.cpp
index 0fc98175..b5c9fe2b 100644
--- a/src/net/equipmenthandler.cpp
+++ b/src/net/equipmenthandler.cpp
@@ -146,22 +146,22 @@ void EquipmentHandler::handleMessage(MessageIn *msg)
break;
}
- if (equipPoint & 0x8000) { // Arrows
- player_node->mEquipment->setArrows(NULL);
- position = 11;
- } else {
- mask = 1;
- position = 0;
- while (!(equipPoint & mask)) {
- mask <<= 1;
- position++;
- }
+ mask = 1;
+ position = 0;
+ while (!(equipPoint & mask)) {
+ mask <<= 1;
+ position++;
+ }
- item = inventory->getItem(index);
- if (!item)
- break;
+ item = inventory->getItem(index);
+ if (!item)
+ break;
- item->setEquipped(false);
+ item->setEquipped(false);
+ if (equipPoint & 0x8000) { // Arrows
+ player_node->mEquipment->setArrows(NULL);
+ }
+ else {
player_node->mEquipment->removeEquipment(position);
}
logger->log("Unequipping: %i %i(%i) %i",