Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:goupilmtos:2024:games
lincity
windmills.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File windmills.patch of Package lincity
From: Kari Pahula <kaol@debian.net> To: 374901@bugs.debian.org Subject: Patch for #374901 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. Index: lincity-1.13.1/modules/substation.c =================================================================== --- lincity-1.13.1.orig/modules/substation.c 2004-07-03 10:37:35.000000000 +0300 +++ lincity-1.13.1/modules/substation.c 2012-02-04 20:20:13.978884367 +0200 @@ -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); Index: lincity-1.13.1/modules/windmill.c =================================================================== --- lincity-1.13.1.orig/modules/windmill.c 2004-06-23 17:49:52.000000000 +0300 +++ lincity-1.13.1/modules/windmill.c 2012-02-04 20:21:04.854883480 +0200 @@ -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"));
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor