summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-08-17 08:40:09 +0000
committertruelight <truelight@openttd.org>2004-08-17 08:40:09 +0000
commita21fa401276c009ffdff7ca19fd505e5a92a9f03 (patch)
tree992ac2e3eec0208547e07b801bd2aa2f792cda88
parentb4e9a3d1d40d87f79394db4c4425d006aee253da (diff)
downloadopenttd-a21fa401276c009ffdff7ca19fd505e5a92a9f03.tar.xz
(svn r72) -Add: build_date of station (viewable with Query tool)
-rw-r--r--lang/english.txt1
-rw-r--r--misc_gui.c10
-rw-r--r--station_cmd.c14
-rw-r--r--ttd.h1
4 files changed, 25 insertions, 1 deletions
diff --git a/lang/english.txt b/lang/english.txt
index 1876aab77..698c74c05 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -2499,3 +2499,4 @@ STR_B005_COAL_MINE_SUBSIDENCE_LEAVES :{BLACK}{BIGFONT}Coal mine subsidence leave
STR_BRIBE_FAILED :{WHITE}Your attempted bribery has been
STR_BRIBE_FAILED_2 :{WHITE}discovered by a regional investigator
+STR_BUILD_DATE :{BLACK}Built in: {LTBLUE}{DATE_LONG}
diff --git a/misc_gui.c b/misc_gui.c
index f86f2c8f5..0bae394a0 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -102,6 +102,11 @@ static void LandInfoWndProc(Window *w, WindowEvent *e)
if (str != (STR_01CE_CARGO_ACCEPTED - 1))
DrawStringMultiCenter(140, 76, str, 276);
+
+ if (lid->td.build_date != 0) {
+ SET_DPARAM16(0,lid->td.build_date);
+ DrawStringCentered(140,71, STR_BUILD_DATE, 0);
+ }
}
}
@@ -145,7 +150,10 @@ static void Place_LandInfo(uint tile)
lid.costclear = DoCommandByTile(tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR);
p->money64 = old_money;
UpdatePlayerMoney32(p);
-
+
+ // Becuase build_date is not set yet in every TileDesc, we make sure it is empty
+ lid.td.build_date = 0;
+
GetAcceptedCargo(tile, &lid.ac);
GetTileDesc(tile, &lid.td);
diff --git a/station_cmd.c b/station_cmd.c
index df9a387f8..6019957de 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -820,6 +820,8 @@ int32 CmdBuildRailroadStation(int x_org, int y_org, uint32 flags, uint32 p1, uin
st->trainst_w = finalvalues[1];
st->trainst_h = finalvalues[2];
+ st->build_date = _date;
+
tile_delta = direction ? TILE_XY(0,1) : TILE_XY(1,0);
layout_ptr = alloca(numtracks * plat_len);
@@ -1086,6 +1088,8 @@ int32 CmdBuildBusStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
st->facilities |= FACIL_BUS_STOP;
st->bus_stop_status = 3;
st->owner = _current_player;
+
+ st->build_date = _date;
ModifyTile(tile,
MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT |
@@ -1197,6 +1201,8 @@ int32 CmdBuildTruckStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
st->truck_stop_status = 3;
st->owner = _current_player;
+ st->build_date = _date;
+
ModifyTile(tile,
MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT |
MP_MAP2 | MP_MAP3LO_CLEAR | MP_MAP3HI_CLEAR | MP_MAP5,
@@ -1388,6 +1394,8 @@ int32 CmdBuildAirport(int x, int y, uint32 flags, uint32 p1, uint32 p2)
st->facilities |= FACIL_AIRPORT;
st->airport_type = (byte)p1;
st->airport_flags = 0;
+
+ st->build_date = _date;
/* if airport was demolished while planes were en-route to it, the positions can no longer
be the same (v->u.air.pos), since different airports have different indexes. So update
@@ -1488,6 +1496,8 @@ int32 CmdBuildBuoy(int x, int y, uint32 flags, uint32 p1, uint32 p2)
st->facilities |= FACIL_DOCK;
st->had_vehicle_of_type |= HVOT_BUOY;
st->owner = OWNER_NONE;
+
+ st->build_date = _date;
ModifyTile(ti.tile,
MP_SETTYPE(MP_STATION) |
@@ -1637,6 +1647,8 @@ int32 CmdBuildDock(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (!st->facilities) st->xy = tile;
st->facilities |= FACIL_DOCK;
st->owner = _current_player;
+
+ st->build_date = _date;
ModifyTile(tile,
MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT |
@@ -1806,6 +1818,7 @@ static void GetTileDesc_Station(uint tile, TileDesc *td)
StringID str;
td->owner = _map_owner[tile];
+ td->build_date = DEREF_STATION(_map2[tile])->build_date;
m5 = _map5[tile];
(str=STR_305E_RAILROAD_STATION, m5 < 8) ||
@@ -2364,6 +2377,7 @@ void BuildOilRig(uint tile)
st->delete_ctr = 0;
st->last_vehicle = INVALID_VEHICLE;
st->facilities = FACIL_AIRPORT | FACIL_DOCK;
+ st->build_date = _date;
for(j=0; j!=NUM_CARGO; j++) {
st->goods[j].waiting_acceptance = 0;
st->goods[j].days_since_pickup = 0;
diff --git a/ttd.h b/ttd.h
index 77f8cb039..3846148de 100644
--- a/ttd.h
+++ b/ttd.h
@@ -207,6 +207,7 @@ typedef struct AcceptedCargo {
typedef struct TileDesc {
StringID str;
byte owner;
+ uint16 build_date;
uint32 dparam[2];
} TileDesc;