[Freeciv-Dev] (PR#20847) Bug in advmilitary.c
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#20847) Bug in advmilitary.c |
From: |
"M-Z" <m___z@xxxxx> |
Date: |
Sun, 17 Sep 2006 00:57:19 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=20847 >
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#20847) Bug in advmilitary.c,
M-Z <=
|
|