mirror of
https://github.com/vcmi/vcmi.git
synced 2026-06-19 22:57:37 +02:00
Fixed all warnings "take address of temporary".
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user