summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-10-05 01:46:49 +0000
committerbelugas <belugas@openttd.org>2007-10-05 01:46:49 +0000
commit060656289745b03b58cd36c4297a196b476f796b (patch)
treed4a1c657d2262ddd8457933ea62601043eae90eb /src
parentf54a8231297bd267948c467101926a6c31422202 (diff)
downloadopenttd-060656289745b03b58cd36c4297a196b476f796b.tar.xz
(svn r11202) -Feature: [NewGRF] Add support for var 45 for Industries.
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_industries.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index add6b1874..327891c2d 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -211,6 +211,20 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte par
/* Layout number */
case 0x44: return industry->selected_layout;
+ /* player info */
+ case 0x45: {
+ byte colour1, colour2; ///< Not initializing these two will give some kind of random
+ bool is_ai = false;
+ if (IsValidPlayer(industry->founder)) {
+ const Player *p = GetPlayer(industry->founder);
+ const Livery *l = &p->livery[LS_DEFAULT];
+ is_ai = p->is_ai;
+ colour1 = l->colour1;
+ colour2 = l->colour2;
+ }
+ return industry->founder | (is_ai ? 0x10000 : 0) | ((colour1 + colour2 * 16) << 24);
+ }
+
/* Get industry ID at offset param */
case 0x60: return GetIndustryIDAtOffset(GetNearbyTile(parameter, industry->xy), industry);