diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-07-27 13:04:24 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-07-27 13:04:24 +0200 |
commit | 006a213747eb8063ad543211b9776caba027ea4a (patch) | |
tree | 5e47f10514095203fc6fed7d4aed4b3a7e1a0754 /src/game-server/inventory.h | |
parent | 01b9c1c451d0c082cdc55475b8546e5638da8369 (diff) | |
download | manaserv-006a213747eb8063ad543211b9776caba027ea4a.tar.gz manaserv-006a213747eb8063ad543211b9776caba027ea4a.tar.bz2 manaserv-006a213747eb8063ad543211b9776caba027ea4a.tar.xz manaserv-006a213747eb8063ad543211b9776caba027ea4a.zip |
Removed the inventory delay mode for now.
I said I wouldn't do it, but I change my mind. Here is why:
The delay mode is used in the trading code, and in the inventory
code for lua only.
In the lua part, the delay mode is useless as it is used only
when the script is requesting removal of more items than owned.
This is something that can't be handled well anyway,
as for the script part, even when the character was still
keeping its items.
Plus, it's not actually an error, IMHO.
In the trading code, it made sense. But the next commit
will bring design changes making the inventory items
and the equipment items not linked anymore. Hence, making
it impossible to trade equipped items, for instance,
which is a good thing IMHO. It will also remove the need
of a delayed inventory mode in that case.
The two cases where it is used will disappear, making it
useless.
Last but no least, the part watching for equipment changes
in the commit() function is not something easy to debug
without first having a proper and working base.
(checking of two multimaps changes, for instance).
We can add it back once the code has been fully debugged
for the most skilled among us.
And yes, I am sure of what I'm currently doing.
For now the whole inventory and trading code is in need of review
but it already was, anyway.
Diffstat (limited to 'src/game-server/inventory.h')
-rw-r--r-- | src/game-server/inventory.h | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/src/game-server/inventory.h b/src/game-server/inventory.h index 4a77ad93..3f8403ae 100644 --- a/src/game-server/inventory.h +++ b/src/game-server/inventory.h @@ -35,30 +35,15 @@ class Inventory /** * Creates a view on the possessions of a character. - * @param delayed If the changes need to be cancelable. */ - Inventory(Character *, bool delayed = false); + Inventory(Character *); /** * Commits delayed changes if applicable. * Sends the update message to the client. */ - ~Inventory(); - - /** - * Commits changes. - * Exclusive to delayed mode. - * @param doRestart Whether to prepare the inventory for more changes - after this. If you are unsure, it is safe (though not - terribly efficient) to leave this as true. - */ - void commit(bool doRestart = true); - - /** - * Cancels changes. - * Exclusive to delayed mode. - */ - void cancel(); + ~Inventory() + {} /** * Sends complete inventory status to the client. @@ -129,19 +114,6 @@ class Inventory unsigned int getItem(unsigned int slot) const; private: - - /** - * Make sure that changes are being done on a copy, not directly. - * No effect when not in delayed mode. - */ - void prepare(); - - /** - * Starts a new notification message. - */ - void restart(); - - /** * Check the inventory is within the slot limit and capacity. * Forcibly delete items from the end if it is not. @@ -164,15 +136,8 @@ class Inventory void changeEquipment(ItemClass *oldI, ItemClass *newI); Possessions *mPoss; /**< Pointer to the modified possessions. */ - /** - * Update message containing inventory changes. - * Note that in sendFull(), this is reused to send all full changes - * (for both inventory and equipment) - */ - MessageOut mInvMsg; - MessageOut mEqmMsg; /**< Update message containing equipment changes */ + Character *mCharacter; /**< Character to notify. */ - bool mDelayed; /**< Delayed changes. */ }; #endif |