summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2005-01-19 10:00:37 +0000
committercelestar <celestar@openttd.org>2005-01-19 10:00:37 +0000
commit941da5dc946d7188e73de4abbe0f6b6e30000763 (patch)
treecec393074c8cf3a6653936b13c6fc1eb0ec344e1
parenta6d1544447ffa9047ea77c8b1d3fa7665c475c55 (diff)
downloadopenttd-941da5dc946d7188e73de4abbe0f6b6e30000763.tar.xz
(svn r1565) -Fix: [ 1104969 ] Aircraft in hangar messages are now revalidated before
display -CodeChange: replaced one if (foo) return true else return false by return (foo)
-rw-r--r--aircraft_cmd.c12
-rw-r--r--train_cmd.c5
2 files changed, 11 insertions, 6 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 85384c6c0..58168db9b 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -1199,6 +1199,13 @@ static void AircraftEntersTerminal(Vehicle *v)
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
}
+static bool ValidateAircraftInHangar( uint data_a, uint data_b )
+{
+ Vehicle *v = GetVehicle(data_a);
+
+ return (IsAircraftHangarTile(v->tile) && (v->vehstatus & VS_STOPPED));
+}
+
static void AircraftEnterHangar(Vehicle *v)
{
Order old_order;
@@ -1225,11 +1232,12 @@ static void AircraftEnterHangar(Vehicle *v)
if (v->owner == _local_player) {
SetDParam(0, v->unitnumber);
- AddNewsItem(
+ AddValidatedNewsItem(
STR_A014_AIRCRAFT_IS_WAITING_IN,
NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
v->index,
- 0);
+ 0,
+ ValidateAircraftInHangar);
}
}
}
diff --git a/train_cmd.c b/train_cmd.c
index 0f0fd6c5a..9bf9d210c 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -2622,10 +2622,7 @@ static const byte _depot_track_ind[4] = {0,1,0,1};
bool ValidateTrainInDepot( uint data_a, uint data_b )
{
Vehicle *v = GetVehicle(data_a);
- if (v->u.rail.track == 0x80 && (v->vehstatus | VS_STOPPED))
- return true;
- else
- return false;
+ return (v->u.rail.track == 0x80 && (v->vehstatus | VS_STOPPED));
}
void TrainEnterDepot(Vehicle *v, uint tile)