ship.h
author bjarni
Mon, 14 Aug 2006 15:03:01 +0000
changeset 4262 4657d940a84c
parent 3962 c8e21d1c5a6c
child 4638 8abe4f10b94b
permissions -rw-r--r--
(svn r5888) -Fix: [autoreplace] if vehicles breakdowns and service are turned off, the vehicles failed to enter any depots
now they will quickly go to a depot if set to be replaced
the tradeoff is that a vehicle set to be replaced and without a depot in the orders will forget about the orders and head for a depot. If the replace fails (lack of money), it will exit and try to head for the depot again
also all vehicles of that type will rush to the depots at once, risking causing traffic jams. This is because there is no way to even it out like normal depot visits offers
Tip: add a depot to the orders of all vehicles, set it to service only and it will always be skipped unless the vehicle is set to be replaced. This should help on the jam issue and if the replace fails, the vehicle will go though a whole round of the orders and make more money before trying again
3962
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
     1
/* $Id$ */
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
     2
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
     3
#include "vehicle.h"
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
     4
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
     5
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
     6
static inline bool IsShipInDepot(const Vehicle* v)
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
     7
{
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
     8
	assert(v->type == VEH_Ship);
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
     9
	return v->u.ship.state == 0x80;
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
    10
}
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
    11
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
    12
static inline bool IsShipInDepotStopped(const Vehicle* v)
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
    13
{
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
    14
	return IsShipInDepot(v) && v->vehstatus & VS_STOPPED;
c8e21d1c5a6c (svn r5121) Add forgotten file in r5120
tron
parents:
diff changeset
    15
}