Skip to content

Commit 87b7420

Browse files
committed
FIX: accidentally messed up replacement of larger multitile buildings by single tile buildings
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11706 8aca7d54-2c30-db11-9de9-000461428c89
1 parent a88d874 commit 87b7420

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/simutrans/world/simcity.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3048,7 +3048,8 @@ gebaeude_t* stadt_t::build_city_house(koord3d base_pos, const building_desc_t* h
30483048
for (int y = 0; y < h->get_y(rotation); y++) {
30493049
koord kpos = base_pos.get_2d() + koord(x, y);
30503050
grund_t* gr = welt->lookup_kartenboden(kpos);
3051-
if (gebaeude_t* oldgb = gr->find<gebaeude_t>()) {
3051+
if (gr->get_typ()==grund_t::fundament) {
3052+
gebaeude_t* oldgb = gr->find<gebaeude_t>();
30523053
switch (oldgb->get_tile()->get_desc()->get_type()) {
30533054
case building_desc_t::city_res: won -= oldgb->get_tile()->get_desc()->get_level() * 10; break;
30543055
case building_desc_t::city_com: arb -= oldgb->get_tile()->get_desc()->get_level() * 20; break;
@@ -3297,7 +3298,7 @@ void stadt_t::build_city_building(koord k)
32973298

32983299
void stadt_t::renovate_city_building(gebaeude_t *gb)
32993300
{
3300-
if( !gb->is_city_building() ) {
3301+
if( !gb->is_city_building() && gb->get_first_tile() != gb) {
33013302
return; // only renovate res, com, ind
33023303
}
33033304
const building_desc_t::btype alt_typ = gb->get_tile()->get_desc()->get_type();
@@ -3444,8 +3445,11 @@ void stadt_t::renovate_city_building(gebaeude_t *gb)
34443445
build_city_house(base_pos, h, rotation);
34453446

34463447
// if new building is smaller than old one => convert remaining tiles
3447-
for (int x = h->get_x(rotation); x < minsize.x; x++) {
3448-
for (int y = h->get_y(rotation); y < minsize.y; y++) {
3448+
for (int x = 0; x < minsize.x; x++) {
3449+
for (int y =0; y < minsize.y; y++) {
3450+
if (x < h->get_x(rotation) && y < h->get_y(rotation)) {
3451+
continue;
3452+
}
34493453
koord kpos = k + koord(x, y);
34503454
grund_t* gr = welt->lookup_kartenboden(kpos);
34513455
gebaeude_t* oldgb = gr->find<gebaeude_t>();
@@ -3478,6 +3482,8 @@ void stadt_t::renovate_city_building(gebaeude_t *gb)
34783482
}
34793483
}
34803484
}
3485+
3486+
recalc_city_size();
34813487
}
34823488
}
34833489

0 commit comments

Comments
 (0)