ship.h
author bjarni
Fri, 08 Sep 2006 10:47:39 +0000
changeset 4574 497540b4a75f
parent 3962 c8e21d1c5a6c
child 4638 8abe4f10b94b
permissions -rw-r--r--
(svn r6424) -Codechange: [autoreplace] removed a loop though all vehicles from each time the window is redrawn
To do this, the player struct contains an array, that contains the count of each engine type that the player owns
Those arrays are updated each time a vehicle is build or deleted and is calculated on load (it's not saved)
It's possible to access the arrays outside of the autoreplace GUI, so feel free to read from them in other patches as well
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
}