train_cmd.c
changeset 1128 d3ffc98b92ad
parent 1109 1bab892228cd
child 1132 7378651941bf
equal deleted inserted replaced
1127:b7eaa0592b30 1128:d3ffc98b92ad
   484 			InvalidateWindow(WC_COMPANY, v->owner);
   484 			InvalidateWindow(WC_COMPANY, v->owner);
   485 		}
   485 		}
   486 	}
   486 	}
   487 	_cmd_build_rail_veh_var1 = _railveh_unk1[p1];
   487 	_cmd_build_rail_veh_var1 = _railveh_unk1[p1];
   488 	_cmd_build_rail_veh_score = _railveh_score[p1];
   488 	_cmd_build_rail_veh_score = _railveh_score[p1];
       
   489 
       
   490 	InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); // updates the replace Train window
       
   491 
   489 	return value;
   492 	return value;
   490 }
   493 }
   491 
   494 
   492 
   495 
   493 bool IsTrainDepotTile(TileIndex tile)
   496 bool IsTrainDepotTile(TileIndex tile)
   845 			}
   848 			}
   846 			if ( (v=v->next) == last || p2 != 1) break;
   849 			if ( (v=v->next) == last || p2 != 1) break;
   847 		}
   850 		}
   848 		if (last) cost -= last->value;
   851 		if (last) cost -= last->value;
   849 	}
   852 	}
       
   853 	InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); // updates the replace Train window
   850 
   854 
   851 	return cost;
   855 	return cost;
   852 }
   856 }
   853 
   857 
   854 static void UpdateTrainDeltaXY(Vehicle *v, int direction)
   858 static void UpdateTrainDeltaXY(Vehicle *v, int direction)
  2397 
  2401 
  2398 	if (state <= 240 && !(v->tick_counter&3)) {
  2402 	if (state <= 240 && !(v->tick_counter&3)) {
  2399 		ChangeTrainDirRandomly(v);
  2403 		ChangeTrainDirRandomly(v);
  2400 	}
  2404 	}
  2401 
  2405 
  2402 	if (state >= 4440 && !(v->tick_counter&0x1F))
  2406 	if (state >= 4440 && !(v->tick_counter&0x1F)) {
  2403 		DeleteLastWagon(v);
  2407 		DeleteLastWagon(v);
       
  2408 		InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train);
       
  2409 	}
  2404 }
  2410 }
  2405 
  2411 
  2406 static void HandleBrokenTrain(Vehicle *v)
  2412 static void HandleBrokenTrain(Vehicle *v)
  2407 {
  2413 {
  2408 	if (v->breakdown_ctr != 1) {
  2414 	if (v->breakdown_ctr != 1) {