Changeset - r8363:42190addf5ac
[Not reviewed]
master
0 1 0
bjarni - 16 years ago 2008-01-19 23:34:52
bjarni@openttd.org
(svn r11929) -Fix (r9981)[FS#1624]: [autoreplace] fixed a case where a single headed locomotive caused an assert when being replaced to a dualheaded one
This triggered if the player had enough money to replace and refit one of them but not enough to refit the last one as well
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -21,6 +21,7 @@
 
#include "functions.h"
 
#include "variables.h"
 
#include "autoreplace_func.h"
 
#include "articulated_vehicles.h"
 

	
 
#include "table/strings.h"
 

	
 
@@ -175,7 +176,10 @@ static CommandCost ReplaceVehicle(Vehicl
 
	if (replacement_cargo_type != CT_NO_REFIT) {
 
		/* add refit cost */
 
		CommandCost refit_cost = GetRefitCost(new_engine_type);
 
		if (old_v->type == VEH_TRAIN && IsMultiheaded(old_v)) refit_cost.AddCost(refit_cost); // pay for both ends
 
		if (old_v->type == VEH_TRAIN && RailVehInfo(new_engine_type)->railveh_type == RAILVEH_MULTIHEAD) {
 
			/* Since it's a dualheaded engine we have to pay once more because the rear end is being refitted too. */
 
			refit_cost.AddCost(refit_cost);
 
		}
 
		cost.AddCost(refit_cost);
 
	}
 

	
0 comments (0 inline, 0 general)