Skip to content

Commit 667549a

Browse files
committed
FIX: (poppo) change and delete cities first using the pointer to the city from the townhall/house at this position
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11869 8aca7d54-2c30-db11-9de9-000461428c89
1 parent 0bd63e2 commit 667549a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/simutrans/tool/simtool.cc

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ DBG_MESSAGE("tool_remover()", "removing tunnel from %d,%d,%d",gr->get_pos().x,
703703

704704
// remove town? (when removing townhall)
705705
if(gb->is_townhall()) {
706-
stadt_t *stadt = welt->find_nearest_city(k);
706+
stadt_t *stadt = gb->get_stadt();
707707
if(!welt->remove_city( stadt )) {
708708
msg = "Das Feld gehoert\neinem anderen Spieler\n";
709709
return false;
@@ -1963,8 +1963,17 @@ bool tool_change_city_size_t::init( player_t * )
19631963

19641964
const char *tool_change_city_size_t::work( player_t *, koord3d pos )
19651965
{
1966-
stadt_t *city = welt->find_nearest_city(pos.get_2d());
1967-
if(city!=NULL) {
1966+
stadt_t* city = NULL;
1967+
if (grund_t *gr=welt->lookup_kartenboden(pos.get_2d())) {
1968+
if (gebaeude_t* gb = gr->find<gebaeude_t>()) {
1969+
city = gb->get_stadt();
1970+
}
1971+
1972+
}
1973+
if (!city) {
1974+
city = welt->find_nearest_city(pos.get_2d());
1975+
}
1976+
if(!city) {
19681977
const int delta = std::atoi(default_param);
19691978
city->change_size( delta );
19701979

0 commit comments

Comments
 (0)