src/newgrf.cpp
changeset 7927 21746ebe2ddb
parent 7783 467bf38f954f
child 7955 7a2abd093498
equal deleted inserted replaced
7926:d2628f1c4772 7927:21746ebe2ddb
  1240 				housespec->random_colour[0] = 0x04;  // those 4 random colours are the base colour
  1240 				housespec->random_colour[0] = 0x04;  // those 4 random colours are the base colour
  1241 				housespec->random_colour[1] = 0x08;  // for all new houses
  1241 				housespec->random_colour[1] = 0x08;  // for all new houses
  1242 				housespec->random_colour[2] = 0x0C;  // they stand for red, blue, orange and green
  1242 				housespec->random_colour[2] = 0x0C;  // they stand for red, blue, orange and green
  1243 				housespec->random_colour[3] = 0x06;
  1243 				housespec->random_colour[3] = 0x06;
  1244 
  1244 
       
  1245 				/* Make sure that the third cargo type is valid in this
       
  1246 				 * climate. This can cause problems when copying the properties
       
  1247 				 * of a house that accepts food, where the new house is valid
       
  1248 				 * in the temperate climate. */
       
  1249 				if (!GetCargo(housespec->accepts_cargo[2])->IsValid()) {
       
  1250 					housespec->cargo_acceptance[2] = 0;
       
  1251 				}
       
  1252 
  1245 				/**
  1253 				/**
  1246 				 * New houses do not (currently) expect to have a default start
  1254 				 * New houses do not (currently) expect to have a default start
  1247 				 * date before 1930, as this breaks the build date stuff.
  1255 				 * date before 1930, as this breaks the build date stuff.
  1248 				 * @see FinaliseHouseArray() for more details.
  1256 				 * @see FinaliseHouseArray() for more details.
  1249 				 */
  1257 				 */
  1278 			case 0x0F: { // Goods/candy, food/fizzy drinks acceptance
  1286 			case 0x0F: { // Goods/candy, food/fizzy drinks acceptance
  1279 				int8 goods = grf_load_byte(&buf);
  1287 				int8 goods = grf_load_byte(&buf);
  1280 
  1288 
  1281 				/* If value of goods is negative, it means in fact food or, if in toyland, fizzy_drink acceptance.
  1289 				/* If value of goods is negative, it means in fact food or, if in toyland, fizzy_drink acceptance.
  1282 				 * Else, we have "standard" 3rd cargo type, goods or candy, for toyland once more */
  1290 				 * Else, we have "standard" 3rd cargo type, goods or candy, for toyland once more */
  1283 				housespec->accepts_cargo[2] = (goods >= 0) ? ((_opt.landscape == LT_TOYLAND) ? CT_CANDY : CT_GOODS) :
  1291 				CargoID cid = (goods >= 0) ? ((_opt.landscape == LT_TOYLAND) ? CT_CANDY : CT_GOODS) :
  1284 						((_opt.landscape == LT_TOYLAND) ? CT_FIZZY_DRINKS : CT_FOOD);
  1292 						((_opt.landscape == LT_TOYLAND) ? CT_FIZZY_DRINKS : CT_FOOD);
  1285 
  1293 
       
  1294 				/* Make sure the cargo type is valid in this climate. */
       
  1295 				if (!GetCargo(cid)->IsValid()) goods = 0;
       
  1296 
       
  1297 				housespec->accepts_cargo[2] = cid;
  1286 				housespec->cargo_acceptance[2] = abs(goods); // but we do need positive value here
  1298 				housespec->cargo_acceptance[2] = abs(goods); // but we do need positive value here
  1287 			} break;
  1299 			} break;
  1288 
  1300 
  1289 			case 0x10: // Local authority rating decrease on removal
  1301 			case 0x10: // Local authority rating decrease on removal
  1290 				housespec->remove_rating_decrease = grf_load_word(&buf);
  1302 				housespec->remove_rating_decrease = grf_load_word(&buf);