src/rail_cmd.cpp
branchgamebalance
changeset 9895 7bd07f43b0e3
parent 6513 8342666220ae
child 9903 dc85aaa556ae
equal deleted inserted replaced
9894:70d78ac95d6c 9895:7bd07f43b0e3
   877 			/* Update build vehicle window related to this depot */
   877 			/* Update build vehicle window related to this depot */
   878 			InvalidateWindowData(WC_BUILD_VEHICLE, tile);
   878 			InvalidateWindowData(WC_BUILD_VEHICLE, tile);
   879 
   879 
   880 			/* update power of trains in this depot */
   880 			/* update power of trains in this depot */
   881 			FOR_ALL_VEHICLES(v) {
   881 			FOR_ALL_VEHICLES(v) {
   882 				if (v->type == VEH_Train && IsFrontEngine(v) && v->tile == tile && v->u.rail.track == 0x80) {
   882 				if (v->type == VEH_TRAIN && IsFrontEngine(v) && v->tile == tile && v->u.rail.track == 0x80) {
   883 					TrainPowerChanged(v);
   883 					TrainPowerChanged(v);
   884 				}
   884 				}
   885 			}
   885 			}
   886 		}
   886 		}
   887 	}
   887 	}
  1415 	const DrawTileSprites* dts = &_waypoint_gfx_table[AXIS_X];
  1415 	const DrawTileSprites* dts = &_waypoint_gfx_table[AXIS_X];
  1416 
  1416 
  1417 	DrawTileSequence(x, y, dts->ground_sprite + offset, dts->seq, 0);
  1417 	DrawTileSequence(x, y, dts->ground_sprite + offset, dts->seq, 0);
  1418 }
  1418 }
  1419 
  1419 
  1420 typedef struct SetSignalsData {
  1420 struct SetSignalsData {
  1421 	int cur;
  1421 	int cur;
  1422 	int cur_stack;
  1422 	int cur_stack;
  1423 	bool stop;
  1423 	bool stop;
  1424 	bool has_presignal;
  1424 	bool has_presignal;
  1425 
  1425 
  1433 
  1433 
  1434 	// these are used to keep track of the stack that modifies presignals recursively
  1434 	// these are used to keep track of the stack that modifies presignals recursively
  1435 	TileIndex next_tile[NUM_SSD_STACK];
  1435 	TileIndex next_tile[NUM_SSD_STACK];
  1436 	DiagDirectionByte next_dir[NUM_SSD_STACK];
  1436 	DiagDirectionByte next_dir[NUM_SSD_STACK];
  1437 
  1437 
  1438 } SetSignalsData;
  1438 };
  1439 
  1439 
  1440 static bool SetSignalsEnumProc(TileIndex tile, void* data, Trackdir trackdir, uint length, byte* state)
  1440 static bool SetSignalsEnumProc(TileIndex tile, void* data, Trackdir trackdir, uint length, byte* state)
  1441 {
  1441 {
  1442 	SetSignalsData* ssd = (SetSignalsData*)data;
  1442 	SetSignalsData* ssd = (SetSignalsData*)data;
  1443 
  1443 
  1471 
  1471 
  1472 	return false;
  1472 	return false;
  1473 }
  1473 }
  1474 
  1474 
  1475 /* Struct to parse data from VehicleFromPos to SignalVehicleCheckProc */
  1475 /* Struct to parse data from VehicleFromPos to SignalVehicleCheckProc */
  1476 typedef struct SignalVehicleCheckStruct {
  1476 struct SignalVehicleCheckStruct {
  1477 	TileIndex tile;
  1477 	TileIndex tile;
  1478 	uint track;
  1478 	uint track;
  1479 } SignalVehicleCheckStruct;
  1479 };
  1480 
  1480 
  1481 static void *SignalVehicleCheckProc(Vehicle *v, void *data)
  1481 static void *SignalVehicleCheckProc(Vehicle *v, void *data)
  1482 {
  1482 {
  1483 	const SignalVehicleCheckStruct* dest = (SignalVehicleCheckStruct*)data;
  1483 	const SignalVehicleCheckStruct* dest = (SignalVehicleCheckStruct*)data;
  1484 
  1484 
  1485 	if (v->type != VEH_Train) return NULL;
  1485 	if (v->type != VEH_TRAIN) return NULL;
  1486 
  1486 
  1487 	/* Wrong tile, or no train? Not a match */
  1487 	/* Wrong tile, or no train? Not a match */
  1488 	if (v->tile != dest->tile) return NULL;
  1488 	if (v->tile != dest->tile) return NULL;
  1489 
  1489 
  1490 	/* Are we on the same piece of track? */
  1490 	/* Are we on the same piece of track? */
  1886 }
  1886 }
  1887 
  1887 
  1888 static void ClickTile_Track(TileIndex tile)
  1888 static void ClickTile_Track(TileIndex tile)
  1889 {
  1889 {
  1890 	switch (GetRailTileType(tile)) {
  1890 	switch (GetRailTileType(tile)) {
  1891 		case RAIL_TILE_DEPOT:    ShowDepotWindow(tile, VEH_Train);                  break;
  1891 		case RAIL_TILE_DEPOT:    ShowDepotWindow(tile, VEH_TRAIN);                  break;
  1892 		case RAIL_TILE_WAYPOINT: ShowRenameWaypointWindow(GetWaypointByTile(tile)); break;
  1892 		case RAIL_TILE_WAYPOINT: ShowRenameWaypointWindow(GetWaypointByTile(tile)); break;
  1893 		default: break;
  1893 		default: break;
  1894 	}
  1894 	}
  1895 }
  1895 }
  1896 
  1896 
  1949 	byte fract_coord_leave;
  1949 	byte fract_coord_leave;
  1950 	DiagDirection dir;
  1950 	DiagDirection dir;
  1951 	int length;
  1951 	int length;
  1952 
  1952 
  1953 	// this routine applies only to trains in depot tiles
  1953 	// this routine applies only to trains in depot tiles
  1954 	if (v->type != VEH_Train || !IsTileDepotType(tile, TRANSPORT_RAIL)) return VETSB_CONTINUE;
  1954 	if (v->type != VEH_TRAIN || !IsTileDepotType(tile, TRANSPORT_RAIL)) return VETSB_CONTINUE;
  1955 
  1955 
  1956 	/* depot direction */
  1956 	/* depot direction */
  1957 	dir = GetRailDepotDirection(tile);
  1957 	dir = GetRailDepotDirection(tile);
  1958 
  1958 
  1959 	/* calculate the point where the following wagon should be activated */
  1959 	/* calculate the point where the following wagon should be activated */