Changeset - r14877:8260fce9fd4a
[Not reviewed]
master
0 5 0
alberth - 15 years ago 2010-03-20 15:30:57
alberth@openttd.org
(svn r19483) -Codechange: Code layout fixes, and parentheses reduction.
5 files changed with 8 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/autoreplace.cpp
Show inline comments
 
@@ -82,14 +82,13 @@ CommandCost AddEngineReplacement(EngineR
 

	
 
CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, DoCommandFlag flags)
 
{
 
	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
 
					/* The second becomes the new first element */
 
					*erl = (EngineRenewList)er->next;
 
				} else {
src/misc_cmd.cpp
Show inline comments
 
@@ -50,13 +50,13 @@ CommandCost CmdIncreaseLoan(TileIndex ti
 
			loan = LOAN_INTERVAL;
 
			break;
 
		case 1: // Take a loan as big as possible
 
			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;
 
	}
 

	
 
	/* Overflow protection */
 
	if (c->money + c->current_loan + loan < c->money) return CMD_ERROR;
 
@@ -94,13 +94,13 @@ CommandCost CmdDecreaseLoan(TileIndex ti
 
			break;
 
		case 1: // Pay back as much as possible
 
			loan = max(min(c->current_loan, c->money), (Money)LOAN_INTERVAL);
 
			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;
 
	}
 

	
 
	if (c->money < loan) {
 
		SetDParam(0, loan);
src/order_cmd.cpp
Show inline comments
 
@@ -869,14 +869,13 @@ CommandCost CmdMoveOrder(TileIndex tile,
 
	CommandCost ret = CheckOwnership(v->owner);
 
	ret.SetGlobalErrorMessage();
 
	if (ret.Failed()) return ret;
 

	
 
	/* 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 */
 
	if (moving_one == NULL) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
src/rail_cmd.cpp
Show inline comments
 
@@ -724,14 +724,13 @@ static CommandCost ValidateAutoDrag(Trac
 

	
 
	/* (for diagonal tracks, this is already made sure of by above test), but:
 
	 * for non-diagonal tracks, check if the start and end tile are on 1 line */
 
	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();
 
}
 

	
 
/** Build or remove a stretch of railroad tracks.
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -84,15 +84,15 @@ int CalcBridgeLenCostFactor(int x)
 
		x -= n;
 
	}
 
}
 

	
 
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));
 
}
 

	
 
/**
 
 * Determines if the track on a bridge ramp is flat or goes up/down.
0 comments (0 inline, 0 general)