tag 374901 + patch severity 374901 important thanks I bumped the bug's severity since running into this isn't all that rare (and to justify fixing this to RMs).
I ran the game in gdb and reproduced this. The flow of events, AFAICT, is thus: 1. The windmill has the grid ID stored in int_6 in the map.info array 2. Bulldozing it sets int_6 to zero, while the info window continues displaying the status for that map square (that's why the game warns "MPS unimplemented for that module", since there's no info for grass). 3. Building a windmill over the same square determines the grid it belongs to only after the phase of the game loop that refreshes the text in the info window. int_6 is still zero at this point, leading to a seg fault on this line: format_power (s, sizeof(s), grid[MP_INFO(x,y).int_6]->max_power); A cleaner solution might be to reorder the order of events at step 3, but I went to a less invasive approach with my patch. I just disabled showing the grid status info if the grid ID is not set. It gets displayed correctly on the next game tick. I patched the substation code too since the same bug applies to that, too.
diff -ru lincity-1.13.1/modules/substation.c ../lincity-1.13.1/modules/substation.c --- lincity-1.13.1/modules/substation.c 2004-07-03 10:37:35.000000000 +0300 +++ ../lincity-1.13.1/modules/substation.c 2008-07-28 10:42:19.000000000 +0300 @@ -101,8 +101,11 @@ format_power (s, sizeof(s), MP_INFO(x,y).int_5); mps_store_title(i++,_("Local Demand")); mps_store_title(i++,s); - i++; + if (MP_INFO(x,y).int_6 == 0) + return; + + i++; mps_store_title(i++,_("Grid Status")); format_power (s, sizeof(s), grid[MP_INFO(x,y).int_6]->max_power); diff -ru lincity-1.13.1/modules/windmill.c ../lincity-1.13.1/modules/windmill.c --- lincity-1.13.1/modules/windmill.c 2004-06-23 17:49:52.000000000 +0300 +++ ../lincity-1.13.1/modules/windmill.c 2008-07-28 10:42:58.000000000 +0300 @@ -97,6 +97,10 @@ mps_store_sfp(i++,_("Tech"), MP_INFO(x,y).int_2 * 100.0 / MAX_TECH_LEVEL); + + if (MP_INFO(x,y).int_6 == 0) + return; + i++; mps_store_title(i++,_("Grid Status"));
signature.asc
Description: Digital signature