1092 StationSpec *statspec = _cur_grffile->stations[stid + i]; |
1092 StationSpec *statspec = _cur_grffile->stations[stid + i]; |
1093 |
1093 |
1094 /* Check that the station we are modifying is defined. */ |
1094 /* Check that the station we are modifying is defined. */ |
1095 if (statspec == NULL && prop != 0x08) { |
1095 if (statspec == NULL && prop != 0x08) { |
1096 grfmsg(2, "StationChangeInfo: Attempt to modify undefined station %u, ignoring", stid + i); |
1096 grfmsg(2, "StationChangeInfo: Attempt to modify undefined station %u, ignoring", stid + i); |
1097 continue; |
1097 return false; |
1098 } |
1098 } |
1099 |
1099 |
1100 switch (prop) { |
1100 switch (prop) { |
1101 case 0x08: { // Class ID |
1101 case 0x08: { // Class ID |
1102 StationSpec **spec = &_cur_grffile->stations[stid + i]; |
1102 StationSpec **spec = &_cur_grffile->stations[stid + i]; |
1433 for (int i = 0; i < numinfo; i++) { |
1433 for (int i = 0; i < numinfo; i++) { |
1434 HouseSpec *housespec = _cur_grffile->housespec[hid + i]; |
1434 HouseSpec *housespec = _cur_grffile->housespec[hid + i]; |
1435 |
1435 |
1436 if (prop != 0x08 && housespec == NULL) { |
1436 if (prop != 0x08 && housespec == NULL) { |
1437 grfmsg(2, "TownHouseChangeInfo: Attempt to modify undefined house %u. Ignoring.", hid + i); |
1437 grfmsg(2, "TownHouseChangeInfo: Attempt to modify undefined house %u. Ignoring.", hid + i); |
1438 continue; |
1438 return false; |
1439 } |
1439 } |
1440 |
1440 |
1441 switch (prop) { |
1441 switch (prop) { |
1442 case 0x08: { // Substitute building type, and definition of a new house |
1442 case 0x08: { // Substitute building type, and definition of a new house |
1443 HouseSpec **house = &_cur_grffile->housespec[hid + i]; |
1443 HouseSpec **house = &_cur_grffile->housespec[hid + i]; |
1449 _house_specs[hid + i].enabled = false; |
1449 _house_specs[hid + i].enabled = false; |
1450 continue; |
1450 continue; |
1451 } else if (subs_id >= NEW_HOUSE_OFFSET) { |
1451 } else if (subs_id >= NEW_HOUSE_OFFSET) { |
1452 /* The substitute id must be one of the original houses. */ |
1452 /* The substitute id must be one of the original houses. */ |
1453 grfmsg(2, "TownHouseChangeInfo: Attempt to use new house %u as substitute house for %u. Ignoring.", subs_id, hid + i); |
1453 grfmsg(2, "TownHouseChangeInfo: Attempt to use new house %u as substitute house for %u. Ignoring.", subs_id, hid + i); |
1454 return false; |
1454 continue; |
1455 } |
1455 } |
1456 |
1456 |
1457 /* Allocate space for this house. */ |
1457 /* Allocate space for this house. */ |
1458 if (*house == NULL) *house = CallocT<HouseSpec>(1); |
1458 if (*house == NULL) *house = CallocT<HouseSpec>(1); |
1459 |
1459 |
1907 for (int i = 0; i < numinfo; i++) { |
1907 for (int i = 0; i < numinfo; i++) { |
1908 uint sound = sid + i + _cur_grffile->sound_offset - GetNumOriginalSounds(); |
1908 uint sound = sid + i + _cur_grffile->sound_offset - GetNumOriginalSounds(); |
1909 |
1909 |
1910 if (sound >= GetNumSounds()) { |
1910 if (sound >= GetNumSounds()) { |
1911 grfmsg(1, "SoundEffectChangeInfo: Sound %d not defined (max %d)", sound, GetNumSounds()); |
1911 grfmsg(1, "SoundEffectChangeInfo: Sound %d not defined (max %d)", sound, GetNumSounds()); |
1912 continue; |
1912 return false; |
1913 } |
1913 } |
1914 |
1914 |
1915 switch (prop) { |
1915 switch (prop) { |
1916 case 0x08: // Relative volume |
1916 case 0x08: // Relative volume |
1917 GetSound(sound)->volume = grf_load_byte(&buf); |
1917 GetSound(sound)->volume = grf_load_byte(&buf); |
1963 for (int i = 0; i < numinfo; i++) { |
1963 for (int i = 0; i < numinfo; i++) { |
1964 IndustryTileSpec *tsp = _cur_grffile->indtspec[indtid + i]; |
1964 IndustryTileSpec *tsp = _cur_grffile->indtspec[indtid + i]; |
1965 |
1965 |
1966 if (prop != 0x08 && tsp == NULL) { |
1966 if (prop != 0x08 && tsp == NULL) { |
1967 grfmsg(2, "IndustryTilesChangeInfo: Attempt to modify undefined industry tile %u. Ignoring.", indtid + i); |
1967 grfmsg(2, "IndustryTilesChangeInfo: Attempt to modify undefined industry tile %u. Ignoring.", indtid + i); |
1968 continue; |
1968 return false; |
1969 } |
1969 } |
1970 |
1970 |
1971 switch (prop) { |
1971 switch (prop) { |
1972 case 0x08: { // Substitute industry tile type |
1972 case 0x08: { // Substitute industry tile type |
1973 IndustryTileSpec **tilespec = &_cur_grffile->indtspec[indtid + i]; |
1973 IndustryTileSpec **tilespec = &_cur_grffile->indtspec[indtid + i]; |
1974 byte subs_id = grf_load_byte(&buf); |
1974 byte subs_id = grf_load_byte(&buf); |
1975 |
1975 |
1976 if (subs_id >= NEW_INDUSTRYTILEOFFSET) { |
1976 if (subs_id >= NEW_INDUSTRYTILEOFFSET) { |
1977 /* The substitute id must be one of the original industry tile. */ |
1977 /* The substitute id must be one of the original industry tile. */ |
1978 grfmsg(2, "IndustryTilesChangeInfo: Attempt to use new industry tile %u as substitute industry tile for %u. Ignoring.", subs_id, indtid + i); |
1978 grfmsg(2, "IndustryTilesChangeInfo: Attempt to use new industry tile %u as substitute industry tile for %u. Ignoring.", subs_id, indtid + i); |
1979 return false; |
1979 continue; |
1980 } |
1980 } |
1981 |
1981 |
1982 /* Allocate space for this industry. */ |
1982 /* Allocate space for this industry. */ |
1983 if (*tilespec == NULL) { |
1983 if (*tilespec == NULL) { |
1984 int tempid; |
1984 int tempid; |
2005 byte ovrid = grf_load_byte(&buf); |
2005 byte ovrid = grf_load_byte(&buf); |
2006 |
2006 |
2007 /* The industry being overridden must be an original industry. */ |
2007 /* The industry being overridden must be an original industry. */ |
2008 if (ovrid >= NEW_INDUSTRYTILEOFFSET) { |
2008 if (ovrid >= NEW_INDUSTRYTILEOFFSET) { |
2009 grfmsg(2, "IndustryTilesChangeInfo: Attempt to override new industry tile %u with industry tile id %u. Ignoring.", ovrid, indtid + i); |
2009 grfmsg(2, "IndustryTilesChangeInfo: Attempt to override new industry tile %u with industry tile id %u. Ignoring.", ovrid, indtid + i); |
2010 return false; |
2010 continue; |
2011 } |
2011 } |
2012 |
2012 |
2013 _industile_mngr.Add(indtid + i, _cur_grffile->grfid, ovrid); |
2013 _industile_mngr.Add(indtid + i, _cur_grffile->grfid, ovrid); |
2014 } break; |
2014 } break; |
2015 |
2015 |
2075 for (int i = 0; i < numinfo; i++) { |
2075 for (int i = 0; i < numinfo; i++) { |
2076 IndustrySpec *indsp = _cur_grffile->industryspec[indid + i]; |
2076 IndustrySpec *indsp = _cur_grffile->industryspec[indid + i]; |
2077 |
2077 |
2078 if (prop != 0x08 && indsp == NULL) { |
2078 if (prop != 0x08 && indsp == NULL) { |
2079 grfmsg(2, "IndustriesChangeInfo: Attempt to modify undefined industry %u. Ignoring.", indid + i); |
2079 grfmsg(2, "IndustriesChangeInfo: Attempt to modify undefined industry %u. Ignoring.", indid + i); |
2080 continue; |
2080 return false; |
2081 } |
2081 } |
2082 |
2082 |
2083 switch (prop) { |
2083 switch (prop) { |
2084 case 0x08: { // Substitute industry type |
2084 case 0x08: { // Substitute industry type |
2085 IndustrySpec **indspec = &_cur_grffile->industryspec[indid + i]; |
2085 IndustrySpec **indspec = &_cur_grffile->industryspec[indid + i]; |
2091 _industry_specs[indid + i].enabled = false; |
2091 _industry_specs[indid + i].enabled = false; |
2092 continue; |
2092 continue; |
2093 } else if (subs_id >= NEW_INDUSTRYOFFSET) { |
2093 } else if (subs_id >= NEW_INDUSTRYOFFSET) { |
2094 /* The substitute id must be one of the original industry. */ |
2094 /* The substitute id must be one of the original industry. */ |
2095 grfmsg(2, "_industry_specs: Attempt to use new industry %u as substitute industry for %u. Ignoring.", subs_id, indid + i); |
2095 grfmsg(2, "_industry_specs: Attempt to use new industry %u as substitute industry for %u. Ignoring.", subs_id, indid + i); |
2096 return false; |
2096 continue; |
2097 } |
2097 } |
2098 |
2098 |
2099 /* Allocate space for this industry. |
2099 /* Allocate space for this industry. |
2100 * Only need to do it once. If ever it is called again, it should not |
2100 * Only need to do it once. If ever it is called again, it should not |
2101 * do anything */ |
2101 * do anything */ |
2118 byte ovrid = grf_load_byte(&buf); |
2118 byte ovrid = grf_load_byte(&buf); |
2119 |
2119 |
2120 /* The industry being overridden must be an original industry. */ |
2120 /* The industry being overridden must be an original industry. */ |
2121 if (ovrid >= NEW_INDUSTRYOFFSET) { |
2121 if (ovrid >= NEW_INDUSTRYOFFSET) { |
2122 grfmsg(2, "IndustriesChangeInfo: Attempt to override new industry %u with industry id %u. Ignoring.", ovrid, indid + i); |
2122 grfmsg(2, "IndustriesChangeInfo: Attempt to override new industry %u with industry id %u. Ignoring.", ovrid, indid + i); |
2123 return false; |
2123 continue; |
2124 } |
2124 } |
2125 indsp->grf_prop.override = ovrid; |
2125 indsp->grf_prop.override = ovrid; |
2126 _industry_mngr.Add(indid + i, _cur_grffile->grfid, ovrid); |
2126 _industry_mngr.Add(indid + i, _cur_grffile->grfid, ovrid); |
2127 } break; |
2127 } break; |
2128 |
2128 |