News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

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

Started by z9999, June 18, 2009, 11:40:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

z9999

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

gerw

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

Edit: Both of the following patches should fix this issue:
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;
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
}