<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15416 >

> [EMAIL PROTECTED] - Mo 13. Nov 2006, 14:57:23]:
> 
> Thanks for the email, what'd I do or I leave it until the next patch
> or version?
> Many thanks for speedy response.
> 
> Nick
> 

As it turns out this bug has already been reported a few times in the
past. If you compiled Freeciv from source, you can open the file
advmilitary.c in an editor and delete the part which reads "&&
unit_build_shield_cost(punittype) <= pcity->shield_stock + 40" in line
707 (see the bug report below for reference) and then compile again.
This might not be the real  solution, but at least it avoids the crash.
There will hopefully be a real fix for the 2.1 release.

> [EMAIL PROTECTED] - So 17. Sep 2006, 07:57:19]:
> 
> In development snapshot of Freeciv from September 10th, in function  
> process_defender_want() there is a code which leads to crashes when  
> playing with some altered rules (I think the main reason for the crash
is  
> "Multiplier percentage for production costs">=300%);.
> 
> ai/advmilitary.c, line 718:
>        if ((desire > best ||
>          (desire == best && unit_build_shield_cost(punittype) <=
>           unit_build_shield_cost(best_unit_type))))
>         && unit_build_shield_cost(punittype) <= pcity->shield_stock + 40)
>        {
>       best = desire;
>       best_unit_type = punittype;
>        }
> 
> There is a possibility that none iteration would enter this section,
thus  
> remaining best_unit_type variable equal NULL, which in turn lead to crash.
> Commenting the fragment:
>   && unit_build_shield_cost(punittype) <= pcity->shield_stock + 40
> fixes the problem for me, but I thought developers should work out
proper  
> solution. Perhaps number 40 should be multiplied by "Multiplier
percentage  
> for production costs"? But this is only my guess...
> 
> 
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x0812cda9 in get_unit_class (punittype=0x0) at unittype.c:737
> 737       return punittype->class;
> (gdb) backtrace
> #0  0x0812cda9 in get_unit_class (punittype=0x0) at unittype.c:737
> #1  0x0812bf50 in get_unit_move_type (punittype=0x0) at unittype.c:200
> #2  0x0812ebcf in process_defender_want (pplayer=0x82bd7c8,  
> pcity=0x85f8d88,
>      danger=212, choice=0x85f96c0) at advmilitary.c:754
> #3  0x081300e1 in military_advisor_choose_build (pplayer=0x82bd7c8,
>      pcity=0x85f8d88, choice=0x85f96c0) at advmilitary.c:1328
> #4  0x0813a257 in ai_manage_cities (pplayer=0x82bd7c8) at aicity.c:1620
> #5  0x08141278 in ai_do_last_activities (pplayer=0x82bd7c8) at
aihand.c:449
> #6  0x0805231b in end_phase () at srv_main.c:706
> #7  0x08054303 in main_loop () at srv_main.c:1702
> #8  0x08054aeb in srv_loop () at srv_main.c:1975
> #9  0x080544c8 in srv_main () at srv_main.c:1783
> #10 0x0804ae95 in main (argc=3, argv=0xbfc2bde4) at civserver.c:256
> 
> 
> 



_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to