summaryrefslogtreecommitdiff
path: root/src/game-server/buysell.cpp
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-04-02 22:25:24 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-04-02 22:28:24 +0200
commit4a8080dcf73dab2b6e62b8500fec3bb996bcbf17 (patch)
tree67ef51dbb1b360f9a3e7c38cf0dbeb2b5f001bfd /src/game-server/buysell.cpp
parentad3958701136ff8ae4a4fc749ef616cc8917d2af (diff)
downloadmanaserv-4a8080dcf73dab2b6e62b8500fec3bb996bcbf17.tar.gz
manaserv-4a8080dcf73dab2b6e62b8500fec3bb996bcbf17.tar.bz2
manaserv-4a8080dcf73dab2b6e62b8500fec3bb996bcbf17.tar.xz
manaserv-4a8080dcf73dab2b6e62b8500fec3bb996bcbf17.zip
Fixed multiple warnings and errors that blocked c++0x
This allows the server to compile with c++0x (and enables it). This also includes some coding style / readabillity fixes.
Diffstat (limited to 'src/game-server/buysell.cpp')
-rw-r--r--src/game-server/buysell.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/game-server/buysell.cpp b/src/game-server/buysell.cpp
index ed6d92e4..1e63d523 100644
--- a/src/game-server/buysell.cpp
+++ b/src/game-server/buysell.cpp
@@ -46,7 +46,7 @@ void BuySell::cancel()
delete this;
}
-bool BuySell::registerItem(int id, int amount, int cost)
+bool BuySell::registerItem(unsigned id, int amount, int cost)
{
if (mSell)
{
@@ -57,8 +57,11 @@ bool BuySell::registerItem(int id, int amount, int cost)
amount = nb;
}
- TradedItem it = { id, amount, cost };
- mItems.push_back(it);
+ TradedItem item;
+ item.itemId = id;
+ item.amount = amount;
+ item.cost = cost;
+ mItems.push_back(item);
return true;
}
@@ -76,11 +79,11 @@ int BuySell::registerPlayerItems()
for (InventoryData::const_iterator it = inventoryData.begin(),
it_end = inventoryData.end(); it != it_end; ++it)
{
- unsigned nb = it->second.amount;
- if (!nb)
+ unsigned amount = it->second.amount;
+ if (!amount)
continue;
- int id = it->second.itemId;
+ unsigned id = it->second.itemId;
int cost = -1;
if (itemManager->getItem(id))
{
@@ -106,15 +109,18 @@ int BuySell::registerPlayerItems()
if (i->itemId == id)
{
itemAlreadyAdded = true;
- i->amount += nb;
+ i->amount += amount;
break;
}
}
if (!itemAlreadyAdded)
{
- TradedItem itTrade = { id, nb, cost };
- mItems.push_back(itTrade);
+ TradedItem tradeItem;
+ tradeItem.itemId = id;
+ tradeItem.amount = amount;
+ tradeItem.cost = cost;
+ mItems.push_back(tradeItem);
nbItemsToSell++;
}
}
@@ -142,7 +148,7 @@ bool BuySell::start(Actor *actor)
return true;
}
-void BuySell::perform(int id, int amount)
+void BuySell::perform(unsigned id, int amount)
{
Inventory inv(mChar);
for (TradedItems::iterator i = mItems.begin(),