(svn r11181) -Codechange: add support for newgrf callback 14A (Belugas)
authorglx
Fri, 28 Sep 2007 17:09:50 +0000
changeset 8146 fae08d49a223
parent 8145 19efa5646e94
child 8147 93775539c977
(svn r11181) -Codechange: add support for newgrf callback 14A (Belugas)
src/industry_cmd.cpp
src/newgrf_callbacks.h
--- a/src/industry_cmd.cpp	Fri Sep 28 17:04:52 2007 +0000
+++ b/src/industry_cmd.cpp	Fri Sep 28 17:09:50 2007 +0000
@@ -1459,6 +1459,11 @@
 	i->last_month_production[1] = i->production_rate[1] * 8;
 	i->founder = _current_player;
 
+	if (HASBIT(indspec->callback_flags, CBM_IND_DECIDE_COLOUR)) {
+		uint16 res = GetIndustryCallback(CBID_INDUSTRY_DECIDE_COLOUR, 0, 0, i, type, INVALID_TILE);
+		if (res != CALLBACK_FAILED) i->random_color = GB(res, 0, 4);
+	}
+
 	if (HASBIT(indspec->callback_flags, CBM_IND_INPUT_CARGO_TYPES)) {
 		for (j = 0; j < lengthof(i->accepts_cargo); j++) i->accepts_cargo[j] = CT_INVALID;
 		for (j = 0; j < lengthof(i->accepts_cargo); j++) {
--- a/src/newgrf_callbacks.h	Fri Sep 28 17:04:52 2007 +0000
+++ b/src/newgrf_callbacks.h	Fri Sep 28 17:09:50 2007 +0000
@@ -193,7 +193,7 @@
 	CBID_STATION_LAND_SLOPE_CHECK        = 0x149, // not implemented
 
 	/** Called to determine the color of an industry. */
-	CBID_INDUSTRY_DECIDE_COLOUR          = 0x14A, // not implemented
+	CBID_INDUSTRY_DECIDE_COLOUR          = 0x14A,
 
 	/** Customize the input cargo types of a newly build industry. */
 	CBID_INDUSTRY_INPUT_CARGO_TYPES      = 0x14B,