The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: z9999 on June 18, 2009, 11:40:28 am

Title: [bug r2534] Freeze when click on same tile twice with "remove powerlines" tool
Post by: z9999 on June 18, 2009, 11:40:28 am
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
Title: Re: [bug r2534] Freeze when click on same tile twice with "remove powerlines" t
Post by: gerw on June 18, 2009, 11:46:01 am
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
 }