From a3e61c0e830c46b51c0d135962ad361c02b93243 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 1 Aug 2010 21:32:16 -0600 Subject: Remove isActive methods from buy/sell windows Uses a state variable in PlayerInfo instead. Moves isTalking from Being to PlayerInfo. Also some small cleanups. Reviewed-by: Chuck Miller --- src/event.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/event.cpp') diff --git a/src/event.cpp b/src/event.cpp index 65fdee8a..d503ad58 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -96,4 +96,24 @@ double Event::getFloat(const std::string &key) const throw (BadEvent) return static_cast(it->second)->getData(); } +void Event::setBool(const std::string &key, bool value) throw (BadEvent) +{ + if (mData.find(key) != mData.end()) + throw KEY_ALREADY_EXISTS; + + mData[key] = new BoolData(value); +} + +bool Event::getBool(const std::string &key) const throw (BadEvent) +{ + VariableMap::const_iterator it = mData.find(key); + if (it == mData.end()) + throw BAD_KEY; + + if (it->second->getType() != VariableData::DATA_BOOL) + throw BAD_VALUE; + + return static_cast(it->second)->getData(); +} + } // namespace Mana -- cgit v1.2.3-70-g09d2