summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/Makefile.am4
-rw-r--r--src/engine.h2
-rw-r--r--src/game.cpp6
-rw-r--r--src/inventory.cpp8
-rw-r--r--src/inventory.h8
7 files changed, 24 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d15c616..3a5a424d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-09-25 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/inventory.h, src/inventory.cpp: Added some const qualifiers.
+
2007-09-22 Guillaume Melquiond <guillaume.melquiond@gmail.com>
* src/gui/browserbox.cpp: Removed some useless things.
@@ -498,7 +502,7 @@
src/net/gameserver/player.h, src/net/gameserver/player.cpp,
src/net/protocol.h: Converted trading to new server.
-2007-07-25 Guillaume Melquiond <guillaume.melquiond@gmail.com>
+2007-07-27 Guillaume Melquiond <guillaume.melquiond@gmail.com>
* src/resources/image.cpp: Added support for subimages of subimages.
* src/gui/equipmentwindow.cpp, src/gui/button.cpp, src/gui/slider.cpp,
@@ -508,6 +512,9 @@
src/gui/itemcontainer.cpp, src/gui/checkbox.cpp, src/gui/minimap.cpp,
src/gui/scrollarea.cpp, src/gui/popupmenu.cpp: Removed useless yet
costly dynamic casts.
+
+2007-07-25 Guillaume Melquiond <guillaume.melquiond@gmail.com>
+
* src/net/beinghandler.cpp, src/net/protocol.h: Added being speed to
protocol.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 89528ed3..9714a9de 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -256,6 +256,8 @@ SET(SRCS
resources/image.h
resources/imageloader.cpp
resources/imageloader.h
+ resources/imageset.h
+ resources/imageset.cpp
resources/imagewriter.cpp
resources/imagewriter.h
resources/iteminfo.cpp
@@ -278,8 +280,6 @@ SET(SRCS
resources/soundeffect.h
resources/spritedef.h
resources/spritedef.cpp
- resources/imageset.h
- resources/imageset.cpp
utils/base64.cpp
utils/base64.h
utils/dtor.h
diff --git a/src/Makefile.am b/src/Makefile.am
index aaeb2949..e0a5a41b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -206,6 +206,8 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \
resources/image.h \
resources/imageloader.cpp \
resources/imageloader.h \
+ resources/imageset.h \
+ resources/imageset.cpp \
resources/imagewriter.cpp \
resources/imagewriter.h \
resources/itemdb.cpp \
@@ -228,8 +230,6 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \
resources/soundeffect.cpp \
resources/spritedef.h \
resources/spritedef.cpp \
- resources/imageset.h \
- resources/imageset.cpp \
resources/buddylist.h \
resources/buddylist.cpp \
utils/base64.cpp \
diff --git a/src/engine.h b/src/engine.h
index 161a1e63..826c939f 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -51,7 +51,7 @@ class Engine
void changeMap(const std::string &mapName);
/**
- * Performs engine logic.
+ * Performs engine logic. This method is called 100 times per second.
*/
void logic();
diff --git a/src/game.cpp b/src/game.cpp
index a56f10eb..3e2a9deb 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -252,10 +252,10 @@ Game::Game():
particleEngine = new Particle(NULL);
particleEngine->setupEngine();
- // Initialize timers
+ // Initialize logic and seconds counters
tick_time = 0;
- mLogicCounterId = SDL_AddTimer(10, nextTick, NULL); //Logic counter
- mSecondsCounterId = SDL_AddTimer(1000, nextSecond, NULL);//Seconds counter
+ mLogicCounterId = SDL_AddTimer(10, nextTick, NULL);
+ mSecondsCounterId = SDL_AddTimer(1000, nextSecond, NULL);
// Initialize frame limiting
config.addListener("fpslimit", this);
diff --git a/src/inventory.cpp b/src/inventory.cpp
index d9bd79f8..f6cf04f4 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -91,7 +91,7 @@ void Inventory::removeItemIndex(int index)
mItems[index].setQuantity(0);
}
-bool Inventory::contains(Item *item)
+bool Inventory::contains(Item *item) const
{
for (int i = 0; i < INVENTORY_SIZE; i++) {
if (mItems[i].getId() == item->getId()) {
@@ -102,19 +102,19 @@ bool Inventory::contains(Item *item)
return false;
}
-int Inventory::getFreeSlot()
+int Inventory::getFreeSlot() const
{
Item *i = std::find_if(mItems, mItems + INVENTORY_SIZE,
std::not1(SlotUsed()));
return (i == mItems + INVENTORY_SIZE) ? -1 : (i - mItems);
}
-int Inventory::getNumberOfSlotsUsed()
+int Inventory::getNumberOfSlotsUsed() const
{
return count_if(mItems, mItems + INVENTORY_SIZE, SlotUsed());
}
-int Inventory::getLastUsedSlot()
+int Inventory::getLastUsedSlot() const
{
for (int i = INVENTORY_SIZE - 1; i >= 0; i--) {
if (SlotUsed()(mItems[i])) {
diff --git a/src/inventory.h b/src/inventory.h
index f0d3e4d7..7a9e6ad2 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -69,12 +69,12 @@ class Inventory
/**
* Checks if the given item is in the inventory
*/
- bool contains(Item *item);
+ bool contains(Item *item) const;
/**
* Returns id of next free slot or -1 if all occupied.
*/
- int getFreeSlot();
+ int getFreeSlot() const;
/**
* Reset all item slots.
@@ -84,12 +84,12 @@ class Inventory
/**
* Get the number of slots filled with an item
*/
- int getNumberOfSlotsUsed();
+ int getNumberOfSlotsUsed() const;
/**
* Returns the index of the last occupied slot or 0 if none occupied.
*/
- int getLastUsedSlot();
+ int getLastUsedSlot() const;
static const int NO_SLOT_INDEX = -1; /**< Slot has no index. */
protected: