diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-06 21:36:50 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-11 13:43:00 +0200 |
commit | aa04597c5f8bb806996d604699fc8ebff6d53bdd (patch) | |
tree | 20e6a79a873605b62c80011fd5c80351f60df6fb /src/game-server/buysell.cpp | |
parent | d95fccfca8575d8fb06988e558a338e37776961a (diff) | |
download | manaserv-aa04597c5f8bb806996d604699fc8ebff6d53bdd.tar.gz manaserv-aa04597c5f8bb806996d604699fc8ebff6d53bdd.tar.bz2 manaserv-aa04597c5f8bb806996d604699fc8ebff6d53bdd.tar.xz manaserv-aa04597c5f8bb806996d604699fc8ebff6d53bdd.zip |
Converted the Character class into a component
A CharacterData was created as a proxy class in order to allow using the
old serialization method.
Diffstat (limited to 'src/game-server/buysell.cpp')
-rw-r--r-- | src/game-server/buysell.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/game-server/buysell.cpp b/src/game-server/buysell.cpp index 1e63d523..e73e13c5 100644 --- a/src/game-server/buysell.cpp +++ b/src/game-server/buysell.cpp @@ -30,15 +30,15 @@ #include <algorithm> -BuySell::BuySell(Character *c, bool sell): +BuySell::BuySell(Being *c, bool sell): mCurrencyId(ATTR_GP), mChar(c), mSell(sell) { - c->setBuySell(this); + c->getComponent<CharacterComponent>()->setBuySell(this); } BuySell::~BuySell() { - mChar->setBuySell(NULL); + mChar->getComponent<CharacterComponent>()->setBuySell(nullptr); } void BuySell::cancel() @@ -75,7 +75,9 @@ int BuySell::registerPlayerItems() // We parse the player inventory and add all item // in a sell list. - const InventoryData &inventoryData = mChar->getPossessions().getInventory(); + auto *component = mChar->getComponent<CharacterComponent>(); + const InventoryData &inventoryData = + component->getPossessions().getInventory(); for (InventoryData::const_iterator it = inventoryData.begin(), it_end = inventoryData.end(); it != it_end; ++it) { @@ -144,7 +146,7 @@ bool BuySell::start(Actor *actor) msg.writeInt16(i->amount); msg.writeInt16(i->cost); } - mChar->getClient()->send(msg); + mChar->getComponent<CharacterComponent>()->getClient()->send(msg); return true; } |