1264 if (ind_behav & (INDUSTRYBEH_ONLY_INTOWN | INDUSTRYBEH_TOWN1200_MORE)) { |
1264 if (ind_behav & (INDUSTRYBEH_ONLY_INTOWN | INDUSTRYBEH_TOWN1200_MORE)) { |
1265 if (!IsTileType(cur_tile, MP_HOUSE)) { |
1265 if (!IsTileType(cur_tile, MP_HOUSE)) { |
1266 _error_message = STR_030D_CAN_ONLY_BE_BUILT_IN_TOWNS; |
1266 _error_message = STR_030D_CAN_ONLY_BE_BUILT_IN_TOWNS; |
1267 return false; |
1267 return false; |
1268 } |
1268 } |
1269 if (CmdFailed(DoCommand(cur_tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR))) return false; |
1269 |
|
1270 /* Clear the tiles as OWNER_TOWN to not affect town rating, and to not clear protected buildings */ |
|
1271 CompanyID old_company = _current_company; |
|
1272 _current_company = OWNER_TOWN; |
|
1273 bool not_clearable = CmdFailed(DoCommand(cur_tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR)); |
|
1274 _current_company = old_company; |
|
1275 |
|
1276 if (not_clearable) return false; |
1270 } else if ((ind_behav & INDUSTRYBEH_ONLY_NEARTOWN) == 0 || !IsTileType(cur_tile, MP_HOUSE)) { |
1277 } else if ((ind_behav & INDUSTRYBEH_ONLY_NEARTOWN) == 0 || !IsTileType(cur_tile, MP_HOUSE)) { |
1271 if (CmdFailed(DoCommand(cur_tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR))) return false; |
1278 /* Clear the tiles as OWNER_TOWN to not affect town rating, and to not clear protected buildings */ |
|
1279 CompanyID old_company = _current_company; |
|
1280 _current_company = OWNER_TOWN; |
|
1281 bool not_clearable = CmdFailed(DoCommand(cur_tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR)); |
|
1282 _current_company = old_company; |
|
1283 |
|
1284 if (not_clearable) return false; |
1272 } |
1285 } |
1273 } |
1286 } |
1274 } while ((++it)->ti.x != -0x80); |
1287 } while ((++it)->ti.x != -0x80); |
1275 |
1288 |
1276 if (custom_shape_check != NULL) *custom_shape_check = custom_shape; |
1289 if (custom_shape_check != NULL) *custom_shape_check = custom_shape; |
1538 |
1551 |
1539 if (!_generating_world) i->last_month_production[0] = i->last_month_production[1] = 0; |
1552 if (!_generating_world) i->last_month_production[0] = i->last_month_production[1] = 0; |
1540 |
1553 |
1541 i->prod_level = PRODLEVEL_DEFAULT; |
1554 i->prod_level = PRODLEVEL_DEFAULT; |
1542 |
1555 |
|
1556 /* Clear the tiles as OWNER_TOWN, to not affect town rating, and to not clear protected buildings */ |
|
1557 CompanyID old_company = _current_company; |
|
1558 _current_company = OWNER_TOWN; |
1543 do { |
1559 do { |
1544 TileIndex cur_tile = tile + ToTileIndexDiff(it->ti); |
1560 TileIndex cur_tile = tile + ToTileIndexDiff(it->ti); |
1545 |
1561 |
1546 if (it->gfx != GFX_WATERTILE_SPECIALCHECK) { |
1562 if (it->gfx != GFX_WATERTILE_SPECIALCHECK) { |
1547 byte size; |
1563 byte size; |
1566 IndustryGfx cur_gfx = GetTranslatedIndustryTileID(it->gfx); |
1582 IndustryGfx cur_gfx = GetTranslatedIndustryTileID(it->gfx); |
1567 const IndustryTileSpec *its = GetIndustryTileSpec(cur_gfx); |
1583 const IndustryTileSpec *its = GetIndustryTileSpec(cur_gfx); |
1568 if (its->animation_info != 0xFFFF) AddAnimatedTile(cur_tile); |
1584 if (its->animation_info != 0xFFFF) AddAnimatedTile(cur_tile); |
1569 } |
1585 } |
1570 } while ((++it)->ti.x != -0x80); |
1586 } while ((++it)->ti.x != -0x80); |
|
1587 _current_company = old_company; |
1571 |
1588 |
1572 i->width++; |
1589 i->width++; |
1573 i->height++; |
1590 i->height++; |
1574 |
1591 |
1575 if (GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_PLANT_ON_BUILT) { |
1592 if (GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_PLANT_ON_BUILT) { |