Skip to main content
Topic: [bug r2534] Freeze when click on same tile twice with "remove powerlines" tool (Read 2731 times) previous topic - next topic

[bug r2534] Freeze when click on same tile twice with "remove powerlines" tool

When I click on the same powerline tile twice with "remove powerlines" tool, simutrans will freeze.

1. Build powerline
2. Select "remove powerlines" tool
3. Click on powerline twice on the same tile

Result:
Freeze

 

Re: [bug r2534] Freeze when click on same tile twice with "remove powerlines" t

Reply #1
Thank you for reporting. I will have a look at it today.

Edit: Both of the following patches should fix this issue:
Code: [Select]
Index: simwerkz.cc
===================================================================
--- simwerkz.cc (revision 2534)
+++ simwerkz.cc (working copy)
@@ -1708,7 +1708,7 @@
                        }
                        else {
                                leitung_t *lt = gr->get_leitung();
-                               if(  (rem&lt->get_ribi())==0  ) {
+                               if(  lt  &&  (rem&lt->get_ribi()) == 0  ) {
                                        // remove only single connections
                                        lt->entferne(sp);
                                        delete lt;
Code: [Select]
Index: dataobj/route.cc
===================================================================
--- dataobj/route.cc    (revision 2534)
+++ dataobj/route.cc    (working copy)
@@ -78,9 +78,6 @@
        while(  route.get_count()>1  &&  route[route.get_count()-1] == route[route.get_count()-2]  ) {
                route.remove_at(route.get_count()-1);
        }
-       if(  route.empty()  ||  k != route.back()  ) {
-               route.append(k);
-       }
        route.append(k);        // the last is always double
 }