summaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-10 08:37:41 +0000
committertron <tron@openttd.org>2006-06-10 08:37:41 +0000
commit0a72639c2d7254c37cd6f8ab0a9fa0f4d63fd2ea (patch)
treeddcc7798b94be03152e4b31cee4bf48bc73774e4 /command.c
parent15c945c9263ffd64f01fd3da92fcb4efb17fe691 (diff)
downloadopenttd-0a72639c2d7254c37cd6f8ab0a9fa0f4d63fd2ea.tar.xz
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
Diffstat (limited to 'command.c')
-rw-r--r--command.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/command.c b/command.c
index 9749c8e85..ef8ef74db 100644
--- a/command.c
+++ b/command.c
@@ -314,7 +314,10 @@ bool IsValidCommand(uint cmd)
_command_proc_table[cmd].proc != NULL;
}
-byte GetCommandFlags(uint cmd) {return _command_proc_table[cmd & 0xFF].flags;}
+byte GetCommandFlags(uint cmd)
+{
+ return _command_proc_table[cmd & 0xFF].flags;
+}
static int _docommand_recursive;
@@ -344,9 +347,11 @@ int32 DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
goto error;
}
- if (_docommand_recursive == 1) {
- if (!(flags&DC_QUERY_COST) && res != 0 && !CheckPlayerHasMoney(res))
- goto error;
+ if (_docommand_recursive == 1 &&
+ !(flags & DC_QUERY_COST) &&
+ res != 0 &&
+ !CheckPlayerHasMoney(res)) {
+ goto error;
}
if (!(flags & DC_EXEC)) {
@@ -496,12 +501,14 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
#endif /* ENABLE_NETWORK */
// update last build coordinate of player.
- if ( tile != 0 && _current_player < MAX_PLAYERS) GetPlayer(_current_player)->last_build_coordinate = tile;
+ if (tile != 0 && _current_player < MAX_PLAYERS) {
+ GetPlayer(_current_player)->last_build_coordinate = tile;
+ }
/* Actually try and execute the command. If no cost-type is given
* use the construction one */
_yearly_expenses_type = EXPENSES_CONSTRUCTION;
- res2 = proc(tile, flags|DC_EXEC, p1, p2);
+ res2 = proc(tile, flags | DC_EXEC, p1, p2);
// If notest is on, it means the result of the test can be different than
// the real command.. so ignore the test
@@ -517,8 +524,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
SubtractMoneyFromPlayer(res2);
if (IsLocalPlayer() && _game_mode != GM_EDITOR) {
- if (res2 != 0)
- ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2);
+ if (res2 != 0) ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2);
if (_additional_cash_required) {
SetDParam(0, _additional_cash_required);
ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x,y);