src/newgrf_industries.cpp
changeset 7671 21bc11c5265d
parent 7668 fd98cd8a83fd
child 7685 20852b29c17b
--- a/src/newgrf_industries.cpp	Thu Oct 04 20:20:23 2007 +0000
+++ b/src/newgrf_industries.cpp	Fri Oct 05 01:46:49 2007 +0000
@@ -211,6 +211,20 @@
 		/* 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);