From 7d75f5cc97a2d44bb3a7fc3f048c382ca4879c56 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 27 Mar 2010 02:22:14 +0000 Subject: [PATCH] bugfix for order of operations.. after rotating 360 degrees or more the enum didn't reset to 0 --- source/glest_game/game/game_constants.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/glest_game/game/game_constants.h b/source/glest_game/game/game_constants.h index 28d37507f..ca412aaad 100644 --- a/source/glest_game/game/game_constants.h +++ b/source/glest_game/game/game_constants.h @@ -2,6 +2,7 @@ #define _GLEST_GAME_GAMECONSTANTS_H_ #include +#include // ============================================================== // This file is part of Glest (www.glest.org) @@ -65,12 +66,15 @@ public: value = static_cast(v); } operator Enum() { return value; } + //int asInt() { return (int)value; } void operator++() { - value = static_cast(value + 1 % 4); + //printf("In [%s::%s] Line: %d BEFORE +: value = %d\n",__FILE__,__FUNCTION__,__LINE__,asInt()); + value = static_cast((value + 1) % 4); + //printf("In [%s::%s] Line: %d AFTER +: value = %d\n",__FILE__,__FUNCTION__,__LINE__,asInt()); } void operator--() { // mod with negative numbers is a 'grey area', hence the +3 rather than -1 - value = static_cast(value + 3 % 4); + value = static_cast((value + 3) % 4); } private: