summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-02-28 17:06:22 +0000
committermaedhros <maedhros@openttd.org>2007-02-28 17:06:22 +0000
commitf865f0a44550f0433495e494c66928d4e9a82aad (patch)
treeb0213d0f3e5e9163fa7e9265112b64df649060ff /src
parent8108cbbe3c5e9fe49750f195ad242dd6b222adba (diff)
downloadopenttd-f865f0a44550f0433495e494c66928d4e9a82aad.tar.xz
(svn r8944) -Codechange: Move the enum describing the bitmask of Engine.flags to engine.h and give the enum values better names.
Diffstat (limited to 'src')
-rw-r--r--src/engine.cpp22
-rw-r--r--src/engine.h9
2 files changed, 17 insertions, 14 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 54604c64e..69f0136ae 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -28,12 +28,6 @@ AircraftVehicleInfo _aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES];
RoadVehicleInfo _road_vehicle_info[NUM_ROAD_ENGINES];
enum {
- ENGINE_AVAILABLE = 1,
- ENGINE_INTRODUCING = 2,
- ENGINE_PREVIEWING = 4,
-};
-
-enum {
YEAR_ENGINE_AGING_STOPS = 2050,
};
@@ -224,10 +218,10 @@ void EnginesDailyLoop(void)
for (i = 0; i != lengthof(_engines); i++) {
Engine *e = &_engines[i];
- if (e->flags & ENGINE_INTRODUCING) {
- if (e->flags & ENGINE_PREVIEWING) {
+ if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) {
+ if (e->flags & ENGINE_OFFER_WINDOW_OPEN) {
if (e->preview_player != 0xFF && !--e->preview_wait) {
- e->flags &= ~ENGINE_PREVIEWING;
+ e->flags &= ~ENGINE_OFFER_WINDOW_OPEN;
DeleteWindowById(WC_ENGINE_PREVIEW, i);
e->preview_player++;
}
@@ -243,7 +237,7 @@ void EnginesDailyLoop(void)
/* XXX - TTDBUG: TTD has a bug here ???? */
AcceptEnginePreview(i, best_player);
} else {
- e->flags |= ENGINE_PREVIEWING;
+ e->flags |= ENGINE_OFFER_WINDOW_OPEN;
e->preview_wait = 20;
if (IsInteractivePlayer(best_player)) ShowEnginePreviewWindow(i);
}
@@ -285,7 +279,7 @@ static void NewVehicleAvailable(Engine *e)
/* In case the player didn't build the vehicle during the intro period,
* prevent that player from getting future intro periods for a while. */
- if (e->flags & ENGINE_INTRODUCING) {
+ if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) {
FOR_ALL_PLAYERS(p) {
uint block_preview = p->block_preview;
@@ -307,7 +301,7 @@ static void NewVehicleAvailable(Engine *e)
}
}
- e->flags = (e->flags & ~ENGINE_INTRODUCING) | ENGINE_AVAILABLE;
+ e->flags = (e->flags & ~ENGINE_EXCLUSIVE_PREVIEW) | ENGINE_AVAILABLE;
AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
/* Now available for all players */
@@ -349,9 +343,9 @@ void EnginesMonthlyLoop(void)
if (!(e->flags & ENGINE_AVAILABLE) && _date >= (e->intro_date + 365)) {
/* Introduce it to all players */
NewVehicleAvailable(e);
- } else if (!(e->flags & (ENGINE_AVAILABLE|ENGINE_INTRODUCING)) && _date >= e->intro_date) {
+ } else if (!(e->flags & (ENGINE_AVAILABLE|ENGINE_EXCLUSIVE_PREVIEW)) && _date >= e->intro_date) {
/* Introduction date has passed.. show introducing dialog to one player. */
- e->flags |= ENGINE_INTRODUCING;
+ e->flags |= ENGINE_EXCLUSIVE_PREVIEW;
/* Do not introduce new rail wagons */
if (!IsWagon(e - _engines))
diff --git a/src/engine.h b/src/engine.h
index fe77d2c52..d1b06e678 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -124,6 +124,15 @@ enum {
EF_RAIL_IS_MU = 2, ///< Rail vehicle is a multiple-unit (DMU/EMU)
};
+/**
+ * Engine.flags is a bitmask, with the following values.
+ */
+enum {
+ ENGINE_AVAILABLE = 1, ///< This vehicle is available to everyone.
+ ENGINE_EXCLUSIVE_PREVIEW = 2, ///< This vehicle is in the exclusive preview stage, either being used or being offered to a player.
+ ENGINE_OFFER_WINDOW_OPEN = 4, ///< The exclusive offer window is currently open for a player.
+};
+
enum {
NUM_VEHICLE_TYPES = 6
};