mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r19483) -Codechange: Code layout fixes, and parentheses reduction.
This commit is contained in:
parent
073f627930
commit
f05a8635fd
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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();
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user