From a3450f23b09e8d5c66f710fbaf085d6d3b6d8122 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 4 Dec 2012 21:41:39 +0000 Subject: Set item timestamp when flags are set or unset. --- src/core/item.cc | 18 ++++++++++++++++++ src/core/item.h | 12 +++--------- 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'src/core') diff --git a/src/core/item.cc b/src/core/item.cc index b6e5bd8..9191687 100644 --- a/src/core/item.cc +++ b/src/core/item.cc @@ -49,6 +49,24 @@ void Item::set_id(const unsigned int id) item_id = id; } +void Item::set_flags(const unsigned int flags) +{ + item_flags = flags; + set_timestamp(game() ? game()->timestamp() : 1); +} + +void Item::set_flag(Flags flag) +{ + item_flags |= flag; + set_timestamp(game() ? game()->timestamp() : 1); +} + +void Item::unset_flag(Flags flag) +{ + item_flags &= ~flag; + set_timestamp(game() ? game()->timestamp() : 1); +} + void Item::set_amount(const long amount) { item_amount = amount; diff --git a/src/core/item.h b/src/core/item.h index ae6a158..6388838 100644 --- a/src/core/item.h +++ b/src/core/item.h @@ -138,23 +138,17 @@ public: /** * @brief set all item flags */ - inline void set_flags(const unsigned int flags) { - item_flags = flags; - } + void set_flags(const unsigned int flags); /** * @brief set item flag */ - inline void set_flag(Flags flag) { - item_flags |= flag; - } + void set_flag(Flags flag); /** * @brief unset item flag */ - inline void unset_flag(Flags flag) { - item_flags &= ~flag; - } + void unset_flag(Flags flag); /** * @brief set the dirty flag -- cgit v1.2.3