Changeset - r23156:a3b45a3c1810
[Not reviewed]
master
0 1 0
Peter Nelson - 6 years ago 2018-05-18 17:02:53
peter1138@openttd.org
Change: Allow only one ship to leave depot at a time.
1 file changed with 12 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/ship_cmd.cpp
Show inline comments
 
@@ -319,6 +319,14 @@ void Ship::UpdateDeltaXY()
 
	this->z_extent      = 6;
 
}
 

	
 
/**
 
 * Test-procedure for HasVehicleOnPos to check for a ship.
 
 */
 
static Vehicle *EnsureNoVisibleShipProc(Vehicle *v, void *data)
 
{
 
	return v->type == VEH_SHIP && (v->vehstatus & VS_HIDDEN) == 0 ? v : NULL;
 
}
 

	
 
static bool CheckShipLeaveDepot(Ship *v)
 
{
 
	if (!v->IsChainInDepot()) return false;
 
@@ -333,6 +341,10 @@ static bool CheckShipLeaveDepot(Ship *v)
 
	/* Don't leave depot if no destination set */
 
	if (v->dest_tile == 0) return true;
 

	
 
	/* Don't leave depot if another vehicle is already entering/leaving */
 
	/* This helps avoid CPU load if many ships are set to start at the same time */
 
	if (HasVehicleOnPos(v->tile, NULL, &EnsureNoVisibleShipProc)) return true;
 

	
 
	TileIndex tile = v->tile;
 
	Axis axis = GetShipDepotAxis(tile);
 

	
0 comments (0 inline, 0 general)