Fixed all warnings "take address of temporary".

This commit is contained in:
Frank Zago
2011-06-11 04:54:41 +00:00
parent 9775f88045
commit eecb470e74
6 changed files with 111 additions and 69 deletions
+9 -5
View File
@@ -10,14 +10,18 @@
#define PLAYER_OWNS(id) (gh->getPlayerAt(c)==gh->getOwner(id))
#define ERROR_AND_RETURN do {if(c) *c << &SystemMessage("You are not allowed to perform this action!"); \
tlog1<<"Player is not allowed to perform this action!\n"; \
return false;} while(0)
#define ERROR_AND_RETURN \
do { if(c) { \
SystemMessage temp_message("You are not allowed to perform this action!"); \
*c << &temp_message; \
} \
tlog1<<"Player is not allowed to perform this action!\n"; \
return false;} while(0)
#define WRONG_PLAYER_MSG(expectedplayer) do {std::ostringstream oss;\
oss << "You were identified as player " << (int)gh->getPlayerAt(c) << " while expecting " << (int)expectedplayer;\
tlog1 << oss.str() << std::endl; \
if(c) *c << &SystemMessage(oss.str());} while(0)
if(c) { SystemMessage temp_message(oss.str()); *c << &temp_message; } } while(0)
#define ERROR_IF_NOT_OWNS(id) do{if(!PLAYER_OWNS(id)){WRONG_PLAYER_MSG(gh->getOwner(id)); ERROR_AND_RETURN; }}while(0)
#define ERROR_IF_NOT(player) do{if(player != gh->getPlayerAt(c)){WRONG_PLAYER_MSG(player); ERROR_AND_RETURN; }}while(0)
@@ -276,4 +280,4 @@ bool SetSelection::applyGh( CGameHandler *gh )
}
gh->sendAndApply(this);
return true;
}
}