Changeset - r11337:9b00fd51efbb
[Not reviewed]
master
0 1 0
frosch - 15 years ago 2009-03-12 19:40:16
frosch@openttd.org
(svn r15692) -Fix [FS#2721]: Just sell the old engines after autorenew/replace. Don't bother about trains exceeding the trainlimit, which will be sold anyway.
1 file changed with 5 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -513,7 +513,7 @@ static CommandCost ReplaceChain(Vehicle 
 
					*chain = new_head;
 
				}
 

	
 
				/* Transfer cargo of old vehicles and sell them*/
 
				/* Transfer cargo of old vehicles and sell them */
 
				for (int i = 0; i < num_units; i++) {
 
					Vehicle *w = old_vehs[i];
 
					/* Is the vehicle again part of the new chain?
 
@@ -522,7 +522,10 @@ static CommandCost ReplaceChain(Vehicle 
 

	
 
					if ((flags & DC_EXEC) != 0) TransferCargo(w, new_head, true);
 

	
 
					cost.AddCost(DoCommand(0, w->index, 0, flags, GetCmdSellVeh(w)));
 
					/* Sell the vehicle.
 
					 * Note: This might temporarly construct new trains, so use DC_AUTOREPLACE to prevent
 
					 *       it from failing due to engine limits. */
 
					cost.AddCost(DoCommand(0, w->index, 0, flags | DC_AUTOREPLACE, GetCmdSellVeh(w)));
 
					if ((flags & DC_EXEC) != 0) {
 
						old_vehs[i] = NULL;
 
						if (i == 0) old_head = NULL;
0 comments (0 inline, 0 general)