News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

Bug - r7264 Crash with remover tool on powerline bridge

Started by Fifty, July 04, 2014, 01:27:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Fifty

The latest powerline bug crashing my servers:

If you build a powerline bridge, and then use the remover tool on any tile on top of the the powerline bridge that is not one of the two ends, simutrans will crash.
Why do we park on the driveway and drive on the parkway?

Ters

Can you confirm that you have to use the remove tool twice? I can only reproduce it on r7248 when I do that. r6274 sounds way old, though. Typo?

Fifty

Typo: r7264...

And yes, upon closer inspection you do seem to have to use the remover tool twice, the first time it deducts four credits like removing a standard powerline, and then the second time it crashes.
Why do we park on the driveway and drive on the parkway?

Ters

Preventing the crash is in itself simple enough, but I think the actual error is what happens on the first click. Some special handling of powerlines, intended for powerlines on flat ground, seems to kick in when it shouldn't.

Ters

I think this might do the trick. This causes the remover tool to not find anything to remove when clicking on a powerline bridge span, which should be consistent with other bridges. It might be unfortunate that the return value is true. If so, a bigger change is needed.

kierongreen

Fixed in 7267 - I've adopted a different fix from Ters though. While that patch did stop the crash I thought it was safer to solve the problem in brueckenbauer where the problem actually occurs:

Index: bauer/brueckenbauer.cc
===================================================================
--- bauer/brueckenbauer.cc (revision 7264)
+++ bauer/brueckenbauer.cc (working copy)
@@ -436,7 +436,7 @@
return true;
}
// now check for end of rampless bridges
- ribi_t::ribi ribi = gr->get_weg_ribi_unmasked( gr->get_weg_nr(0)->get_waytype() );
+ ribi_t::ribi ribi = gr->get_weg_ribi_unmasked( gr->get_leitung() ? powerline_wt : gr->get_weg_nr(0)->get_waytype() );
for(  int i=0;  i<4;  i++  ) {
if(  ribi_t::nsow[i] & ribi  ) {
grund_t *to = welt->lookup( gr->get_pos()+koord(ribi_t::nsow[i]) );