src/ship_cmd.cpp
changeset 9045 2e2f3fc16905
parent 9036 6368fe55fd6d
child 9070 dd0121143eba
equal deleted inserted replaced
9044:d01d22d12fce 9045:2e2f3fc16905
   280 	{ 0, -1}
   280 	{ 0, -1}
   281 };
   281 };
   282 
   282 
   283 static void CheckShipLeaveDepot(Vehicle *v)
   283 static void CheckShipLeaveDepot(Vehicle *v)
   284 {
   284 {
   285 	TileIndex tile;
       
   286 	Axis axis;
       
   287 	uint m;
       
   288 
       
   289 	if (!v->IsInDepot()) return;
   285 	if (!v->IsInDepot()) return;
   290 
   286 
   291 	tile = v->tile;
   287 	TileIndex tile = v->tile;
   292 	axis = GetShipDepotAxis(tile);
   288 	Axis axis = GetShipDepotAxis(tile);
   293 
   289 
   294 	/* Check first side */
   290 	/* Check first (north) side */
   295 	if (_ship_sometracks[axis] & GetTileShipTrackStatus(TILE_ADD(tile, ToTileIndexDiff(_ship_leave_depot_offs[axis])))) {
   291 	if (_ship_sometracks[axis] & GetTileShipTrackStatus(TILE_ADD(tile, ToTileIndexDiff(_ship_leave_depot_offs[axis])))) {
   296 		m = (axis == AXIS_X) ? 0x101 : 0x207;
   292 		v->direction = ReverseDir(AxisToDirection(axis));
   297 	/* Check second side */
   293 	/* Check second (south) side */
   298 	} else if (_ship_sometracks[axis + 2] & GetTileShipTrackStatus(TILE_ADD(tile, -2 * ToTileIndexDiff(_ship_leave_depot_offs[axis])))) {
   294 	} else if (_ship_sometracks[axis + 2] & GetTileShipTrackStatus(TILE_ADD(tile, -2 * ToTileIndexDiff(_ship_leave_depot_offs[axis])))) {
   299 		m = (axis == AXIS_X) ? 0x105 : 0x203;
   295 		v->direction = AxisToDirection(axis);
   300 	} else {
   296 	} else {
   301 		return;
   297 		return;
   302 	}
   298 	}
   303 	v->direction    = (Direction)GB(m, 0, 8);
   299 
   304 	v->u.ship.state = (TrackBits)GB(m, 8, 8);
   300 	v->u.ship.state = AxisToTrackBits(axis);
   305 	v->vehstatus &= ~VS_HIDDEN;
   301 	v->vehstatus &= ~VS_HIDDEN;
   306 
   302 
   307 	v->cur_speed = 0;
   303 	v->cur_speed = 0;
   308 	RecalcShipStuff(v);
   304 	RecalcShipStuff(v);
   309 
   305