src/roadveh.h
author rubidium
Fri, 01 Jun 2007 20:54:09 +0000
branchnoai
changeset 9625 3301b1b3889c
parent 9620 31e38d28a0af
child 9627 6a7c8ead2328
permissions -rw-r--r--
(svn r10016) [NoAI] -Sync with trunk r9914:r10015.
3959
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
     1
/* $Id$ */
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
     2
9574
698395509d12 (svn r9575) [NoAI] -Sync with trunk r9504:9574
glx
parents: 6585
diff changeset
     3
/** @file src/roadveh.h Road vehicle states */
698395509d12 (svn r9575) [NoAI] -Sync with trunk r9504:9574
glx
parents: 6585
diff changeset
     4
4666
850b5b6e4bac (svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents: 4653
diff changeset
     5
#ifndef ROADVEH_H
850b5b6e4bac (svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents: 4653
diff changeset
     6
#define ROADVEH_H
850b5b6e4bac (svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents: 4653
diff changeset
     7
3959
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
     8
#include "vehicle.h"
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
     9
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
    10
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
    11
static inline bool IsRoadVehInDepot(const Vehicle* v)
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
    12
{
6585
7da94b26498a (svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents: 6037
diff changeset
    13
	assert(v->type == VEH_ROAD);
3959
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
    14
	return v->u.road.state == 254;
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
    15
}
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
    16
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
    17
static inline bool IsRoadVehInDepotStopped(const Vehicle* v)
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
    18
{
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
    19
	return IsRoadVehInDepot(v) && v->vehstatus & VS_STOPPED;
e2bbaa8d4978 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents:
diff changeset
    20
}
4653
091f530bae28 (svn r6529) -Fix r6513: [depot window] added missing switch in CcCloneVehicle()
bjarni
parents: 3959
diff changeset
    21
6037
7409c8f581e1 (svn r8338) -Codechange: merged road vehicle build window into the other ones
bjarni
parents: 5726
diff changeset
    22
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2);
4653
091f530bae28 (svn r6529) -Fix r6513: [depot window] added missing switch in CcCloneVehicle()
bjarni
parents: 3959
diff changeset
    23
void CcCloneRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2);
4666
850b5b6e4bac (svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents: 4653
diff changeset
    24
9620
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    25
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    26
/**
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    27
 * This class 'wraps' Vehicle; you do not actually instantiate this class.
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    28
 * You create a Vehicle using AllocateVehicle, so it is added to the pool
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    29
 * and you reinitialize that to a Train using:
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    30
 *   v = new (v) RoadVehicle();
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    31
 *
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    32
 * As side-effect the vehicle type is set correctly.
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    33
 */
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    34
struct RoadVehicle : public Vehicle {
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    35
	/** Initializes the Vehicle to a road vehicle */
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    36
	RoadVehicle() { this->type = VEH_ROAD; }
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    37
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    38
	/** We want to 'destruct' the right class. */
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    39
	virtual ~RoadVehicle() {}
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    40
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    41
	const char *GetTypeString() const { return "road vehicle"; }
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    42
	void MarkDirty();
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    43
	void UpdateDeltaXY(Direction direction);
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    44
	ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; }
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    45
	WindowClass GetVehicleListWindowClass() const { return WC_ROADVEH_LIST; }
9625
3301b1b3889c (svn r10016) [NoAI] -Sync with trunk r9914:r10015.
rubidium
parents: 9620
diff changeset
    46
	bool IsPrimaryVehicle() const { return true; }
9620
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    47
};
31e38d28a0af (svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents: 9574
diff changeset
    48
4666
850b5b6e4bac (svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents: 4653
diff changeset
    49
#endif /* ROADVEH_H */