Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-09 20:05:56 +0000
committerStijn Buys <ingar@osirion.org>2013-11-09 20:05:56 +0000
commit45ea16384fdc077ca07e21e309170894bdf88860 (patch)
treec8217626d04431bbec249f4e5a30110501cd2d06
parent1cd17df40fb8b36b117e47797e2783d03d911d24 (diff)
Iterator cleanups.
-rw-r--r--src/core/inventory.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/core/inventory.cc b/src/core/inventory.cc
index e079256..9c7ad2b 100644
--- a/src/core/inventory.cc
+++ b/src/core/inventory.cc
@@ -52,11 +52,9 @@ void Inventory::set_dirty(const bool dirty)
void Inventory::add(Item *item)
{
- assert(item != (Item *) 0x81);
-
// assign an id
unsigned int id = 0;
- for (Items::iterator it = inventory_items.begin(); it != inventory_items.end(); it++) {
+ for (Items::iterator it = inventory_items.begin(); it != inventory_items.end(); ++it) {
if ((*it)->id() > id) {
id = (*it)->id();
}
@@ -69,7 +67,7 @@ void Inventory::add(Item *item)
void Inventory::erase(Item *item)
{
- for (Items::iterator it = inventory_items.begin(); it != inventory_items.end(); it++) {
+ for (Items::iterator it = inventory_items.begin(); it != inventory_items.end(); ++it) {
if ((*it) == item) {
delete (*it);
(*it) = 0;
@@ -82,7 +80,7 @@ void Inventory::erase(Item *item)
void Inventory::erase(const unsigned int id)
{
- for (Items::iterator it = inventory_items.begin(); it != inventory_items.end(); it++) {
+ for (Items::iterator it = inventory_items.begin(); it != inventory_items.end(); ++it) {
if ((*it)->id() == id) {
delete (*it);
(*it) = 0;
@@ -95,7 +93,7 @@ void Inventory::erase(const unsigned int id)
Item *Inventory::find(Item *item) const
{
- for (Items::const_iterator it = inventory_items.begin(); it != inventory_items.end(); it++) {
+ for (Items::const_iterator it = inventory_items.begin(); it != inventory_items.end(); ++it) {
if ((*it) == item) {
return item;
}
@@ -106,7 +104,7 @@ Item *Inventory::find(Item *item) const
Item *Inventory::find(const Info *info) const
{
// sarch the inventory for a specified item type
- for (Items::const_iterator it = inventory_items.begin(); it != inventory_items.end(); it++) {
+ for (Items::const_iterator it = inventory_items.begin(); it != inventory_items.end(); ++it) {
Item *item = (*it);
if (item->info() == info) {
return item;
@@ -119,7 +117,7 @@ Item *Inventory::find(const Info *info) const
Item *Inventory::find(const unsigned int id) const
{
// sarch the inventory for a specified item id
- for (Items::const_iterator it = inventory_items.begin(); it != inventory_items.end(); it++) {
+ for (Items::const_iterator it = inventory_items.begin(); it != inventory_items.end(); ++it) {
Item *item = (*it);
if (item->id() == id) {
return item;
@@ -131,7 +129,7 @@ Item *Inventory::find(const unsigned int id) const
void Inventory::clear()
{
- for (Items::iterator it = inventory_items.begin(); it != inventory_items.end(); it++) {
+ for (Items::iterator it = inventory_items.begin(); it != inventory_items.end(); ++it) {
Item *item = (*it);
delete item;
}
@@ -142,7 +140,7 @@ void Inventory::clear()
void Inventory::recalculate()
{
inventory_capacity_used = 0;
- for (Items::const_iterator it = inventory_items.begin(); it != inventory_items.end(); it++) {
+ for (Items::const_iterator it = inventory_items.begin(); it != inventory_items.end(); ++it) {
const Item *item = (*it);
inventory_capacity_used += item->amount() * item->info()->volume();
}