RumorState.cpp 588 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * RumorState.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "RumorState.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. bool RumorState::update(int id, int extra)
  14. {
  15. if(vstd::contains(last, type))
  16. {
  17. if(last[type].first != id)
  18. {
  19. last[type].first = id;
  20. last[type].second = extra;
  21. }
  22. else
  23. return false;
  24. }
  25. else
  26. last[type] = std::make_pair(id, extra);
  27. return true;
  28. }
  29. VCMI_LIB_NAMESPACE_END