[Freeciv-Dev] (PR#6992) Barbarian bug
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#6992) Barbarian bug |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Sun, 30 Nov 2003 03:35:36 -0800 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=6992 >
---------- Forwarded message ----------
# using $FREECIV_PATH
/home/freeciv/.freeciv/code/installed/web/beta/freeciv-1.14.0-beta2+ourown-post-1.14.0+cmd_reply+teamslite13+teamslite13fixes+newdead+responsetime+3648+slowai/share/freeciv
#2 0x40076364 in abort () from /lib/libc.so.6
#3 0x080636b1 in create_barbarian_player (land=0) at barbarian.c:104
#4 0x0806429e in try_summon_barbarians () at barbarian.c:373
#5 0x08064505 in summon_barbarians () at barbarian.c:424
#6 0x08050939 in main_loop () at srv_main.c:1809
The barb code really needs a cleaning up. For now, I have made a braindead
patch for S1_14 which should recover completely when this bug arises.
Attached. I suggest it is committed before 1.14.1 is released.
- Per
Index: server/barbarian.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/barbarian.c,v
retrieving revision 1.55
diff -u -r1.55 barbarian.c
--- server/barbarian.c 27 Sep 2002 12:32:45 -0000 1.55
+++ server/barbarian.c 30 Nov 2003 11:32:37 -0000
@@ -100,8 +100,8 @@
} players_iterate_end;
if( newplayer >= MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS ) {
- freelog( LOG_FATAL, "Too many players?");
- abort();
+ freelog(LOG_ERROR, "Too many players for barbarian.c (%d)", newplayer);
+ return NULL;
}
barbarians = &game.players[newplayer];
@@ -195,6 +195,9 @@
unit_cnt = 3 + myrand(4);
barbarians = create_barbarian_player(TRUE);
+ if (!barbarians) {
+ return FALSE;
+ }
me = barbarians->player_no;
for( i=0; i<unit_cnt; i++) {
@@ -358,6 +361,9 @@
if( map_get_terrain(xu,yu) != T_OCEAN ) { /* land barbarians */
barbarians = create_barbarian_player(TRUE);
+ if (!barbarians) {
+ return;
+ }
if( city_list_size(&victim->cities) > UPRISE_CIV_MOST )
uprise = 3;
for( i=0; i < myrand(3) + uprise*(game.barbarianrate); i++) {
@@ -371,6 +377,9 @@
else { /* sea raiders - their units will be veteran */
barbarians = create_barbarian_player(FALSE);
+ if (!barbarians) {
+ return;
+ }
boat = find_a_unit_type(L_BARBARIAN_BOAT,-1);
(void) create_unit(barbarians, xu, yu, boat, TRUE, 0, -1);
cap = get_transporter_capacity(unit_list_get(&map_get_tile(xu, yu)->units,
0));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#6992) Barbarian bug,
Per I. Mathisen <=
|
|