summaryrefslogtreecommitdiff
path: root/src/players.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-05-25 08:13:01 +0000
committerrubidium <rubidium@openttd.org>2007-05-25 08:13:01 +0000
commit0819f3a9a0229186fbd0624f590764553c7e7178 (patch)
tree20cb72fbcb2123cac75bfc9f3a06d9e590278b3a /src/players.cpp
parentd5d94e230fe92fe461becdf9043034651141ab73 (diff)
downloadopenttd-0819f3a9a0229186fbd0624f590764553c7e7178.tar.xz
(svn r9917) -Codechange: prepare some more areas for more road types.
Diffstat (limited to 'src/players.cpp')
-rw-r--r--src/players.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/players.cpp b/src/players.cpp
index b172f89b1..14a2ab117 100644
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -472,6 +472,7 @@ Player *DoStartupNewPlayer(bool is_ai)
p->share_owners[0] = p->share_owners[1] = p->share_owners[2] = p->share_owners[3] = PLAYER_SPECTATOR;
p->avail_railtypes = GetPlayerRailtypes(p->index);
+ p->avail_roadtypes = GetPlayerRoadtypes(p->index);
p->inaugurated_year = _cur_year;
p->face = ConvertFromOldPlayerFace(Random());
@@ -609,6 +610,24 @@ byte GetPlayerRailtypes(PlayerID p)
return rt;
}
+byte GetPlayerRoadtypes(PlayerID p)
+{
+ byte rt = 0;
+ EngineID i;
+
+ for (i = 0; i != TOTAL_NUM_ENGINES; i++) {
+ const Engine* e = GetEngine(i);
+ const EngineInfo *ei = EngInfo(i);
+
+ if (e->type == VEH_ROAD && HASBIT(ei->climates, _opt.landscape) &&
+ (HASBIT(e->player_avail, p) || _date >= e->intro_date + 365)) {
+ SETBIT(rt, HASBIT(ei->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
+ }
+ }
+
+ return rt;
+}
+
static void DeletePlayerStuff(PlayerID pi)
{
Player *p;