summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-09-30 21:07:23 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-09-30 21:07:23 +0200
commit0eac9c5e43034866fd6a65479789022467afd335 (patch)
tree047a98200fce70ab942ff6ea8c72d52687b9fc21 /src
parent2a3af0a501c2374119970c0511e1fc23b204b8d4 (diff)
downloadmanaserv-0eac9c5e43034866fd6a65479789022467afd335.tar.gz
manaserv-0eac9c5e43034866fd6a65479789022467afd335.tar.bz2
manaserv-0eac9c5e43034866fd6a65479789022467afd335.tar.xz
manaserv-0eac9c5e43034866fd6a65479789022467afd335.zip
Actually send and store the equipment slot
I was wrong to assume that we do not need it. The accountserver needs to send the info the the client in order to display the equipment on the character selection page.
Diffstat (limited to 'src')
-rw-r--r--src/account-server/storage.cpp11
-rw-r--r--src/game-server/charactercomponent.cpp10
2 files changed, 6 insertions, 15 deletions
diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp
index 2a3bcf0b..3adea078 100644
--- a/src/account-server/storage.cpp
+++ b/src/account-server/storage.cpp
@@ -510,19 +510,15 @@ CharacterData *Storage::getCharacterBySQL(Account *owner)
unsigned short slot = toUint(itemInfo(k, 2));
item.itemId = toUint(itemInfo(k, 3));
item.amount = toUint(itemInfo(k, 4));
+ item.equipmentSlot = toUint(itemInfo(k, 5));
inventoryData[slot] = item;
- if (toUint(itemInfo(k, 5)) != 0)
+ if (item.equipmentSlot != 0)
{
// The game server will set the right slot anyway,
// but this speeds up checking if the item is equipped
- item.equipmentSlot = 1;
equipmentData.insert(slot);
}
- else
- {
- item.equipmentSlot = 0;
- }
}
}
poss.setInventory(inventoryData);
@@ -850,10 +846,9 @@ bool Storage::updateCharacter(CharacterData *character)
unsigned short slot = itemIt->first;
unsigned itemId = itemIt->second.itemId;
unsigned amount = itemIt->second.amount;
- bool equipped = itemIt->second.equipmentSlot != 0;
assert(itemId);
sql << base << slot << ", " << itemId << ", " << amount << ", "
- << (equipped ? 1 : 0) << ");";
+ << itemIt->second.equipmentSlot << ");";
mDb->execSql(sql.str());
}
diff --git a/src/game-server/charactercomponent.cpp b/src/game-server/charactercomponent.cpp
index 344a8959..1fe7cd46 100644
--- a/src/game-server/charactercomponent.cpp
+++ b/src/game-server/charactercomponent.cpp
@@ -278,19 +278,15 @@ void CharacterComponent::serialize(Entity &entity, MessageOut &msg)
// inventory - must be last because size isn't transmitted
const Possessions &poss = getPossessions();
- const EquipData &equipData = poss.getEquipment();
const InventoryData &inventoryData = poss.getInventory();
for (InventoryData::const_iterator itemIt = inventoryData.begin(),
itemIt_end = inventoryData.end(); itemIt != itemIt_end; ++itemIt)
{
msg.writeInt16(itemIt->first); // slot id
- msg.writeInt16(itemIt->second.itemId); // item id
- msg.writeInt16(itemIt->second.amount); // amount
- if (equipData.find(itemIt->first) != equipData.end())
- msg.writeInt8(1); // equipped
- else
- msg.writeInt8(0); // not equipped
+ msg.writeInt16(itemIt->second.itemId);
+ msg.writeInt16(itemIt->second.amount);
+ msg.writeInt8(itemIt->second.equipmentSlot);
}
}