summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-03-20 15:30:57 +0000
committeralberth <alberth@openttd.org>2010-03-20 15:30:57 +0000
commitf05a8635fdaea2bf3e9148a070d3750afbba8ebc (patch)
tree4a02a67c38cdf022a8c068ecb316dcbde16a640b
parent073f627930ba7816302afe10dcd2b44031c70fb6 (diff)
downloadopenttd-f05a8635fdaea2bf3e9148a070d3750afbba8ebc.tar.xz
(svn r19483) -Codechange: Code layout fixes, and parentheses reduction.
-rw-r--r--src/autoreplace.cpp3
-rw-r--r--src/misc_cmd.cpp4
-rw-r--r--src/order_cmd.cpp3
-rw-r--r--src/rail_cmd.cpp3
-rw-r--r--src/tunnelbridge_cmd.cpp6
5 files changed, 8 insertions, 11 deletions
diff --git a/src/autoreplace.cpp b/src/autoreplace.cpp
index 867e27394..ff3544fba 100644
--- a/src/autoreplace.cpp
+++ b/src/autoreplace.cpp
@@ -85,8 +85,7 @@ CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, Group
EngineRenew *er = (EngineRenew *)(*erl);
EngineRenew *prev = NULL;
- while (er)
- {
+ while (er) {
if (er->from == engine && er->group_id == group) {
if (flags & DC_EXEC) {
if (prev == NULL) { // First element
diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp
index ffa6450af..688f15a25 100644
--- a/src/misc_cmd.cpp
+++ b/src/misc_cmd.cpp
@@ -53,7 +53,7 @@ CommandCost CmdIncreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
loan = _economy.max_loan - c->current_loan;
break;
case 2: // Take the given amount of loan
- if ((((int32)p1 < LOAN_INTERVAL) || c->current_loan + (int32)p1 > _economy.max_loan || (p1 % LOAN_INTERVAL) != 0)) return CMD_ERROR;
+ if ((int32)p1 < LOAN_INTERVAL || c->current_loan + (int32)p1 > _economy.max_loan || p1 % LOAN_INTERVAL != 0) return CMD_ERROR;
loan = p1;
break;
}
@@ -97,7 +97,7 @@ CommandCost CmdDecreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
loan -= loan % LOAN_INTERVAL;
break;
case 2: // Repay the given amount of loan
- if ((p1 % LOAN_INTERVAL != 0) || ((int32)p1 < LOAN_INTERVAL)) return CMD_ERROR; // Invalid amount to loan
+ if (p1 % LOAN_INTERVAL != 0 || (int32)p1 < LOAN_INTERVAL) return CMD_ERROR; // Invalid amount to loan
loan = p1;
break;
}
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 4d7487185..8735fec6c 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -872,8 +872,7 @@ CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Don't make senseless movements */
if (moving_order >= v->GetNumOrders() || target_order >= v->GetNumOrders() ||
- moving_order == target_order || v->GetNumOrders() <= 1)
- return CMD_ERROR;
+ moving_order == target_order || v->GetNumOrders() <= 1) return CMD_ERROR;
Order *moving_one = v->GetOrder(moving_order);
/* Don't move an empty order */
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 71a5f3dde..c25ba9107 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -727,8 +727,7 @@ static CommandCost ValidateAutoDrag(Trackdir *trackdir, TileIndex start, TileInd
if (!IsDiagonalTrackdir(*trackdir)) {
trdx = _trackdelta[*trackdir].x;
trdy = _trackdelta[*trackdir].y;
- if (abs(dx) != abs(dy) && abs(dx) + abs(trdy) != abs(dy) + abs(trdx))
- return CMD_ERROR;
+ if (abs(dx) != abs(dy) && abs(dx) + abs(trdy) != abs(dy) + abs(trdx)) return CMD_ERROR;
}
return CommandCost();
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 36d0c07b8..b2ef22ee2 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -87,9 +87,9 @@ int CalcBridgeLenCostFactor(int x)
Foundation GetBridgeFoundation(Slope tileh, Axis axis)
{
- if ((tileh == SLOPE_FLAT) ||
- (((tileh == SLOPE_NE) || (tileh == SLOPE_SW)) && (axis == AXIS_X)) ||
- (((tileh == SLOPE_NW) || (tileh == SLOPE_SE)) && (axis == AXIS_Y))) return FOUNDATION_NONE;
+ if (tileh == SLOPE_FLAT ||
+ ((tileh == SLOPE_NE || tileh == SLOPE_SW) && axis == AXIS_X) ||
+ ((tileh == SLOPE_NW || tileh == SLOPE_SE) && axis == AXIS_Y)) return FOUNDATION_NONE;
return (HasSlopeHighestCorner(tileh) ? InclinedFoundation(axis) : FlatteningFoundation(tileh));
}