Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] (PR#4351) Client crashes when diplomat/spy investigates ci
Home

[Freeciv-Dev] (PR#4351) Client crashes when diplomat/spy investigates ci

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: cameron@xxxxxxxxxx
Subject: [Freeciv-Dev] (PR#4351) Client crashes when diplomat/spy investigates city
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 11 Jul 2003 07:37:04 -0700
Reply-to: rt@xxxxxxxxxxxxxx

[jdorje - Wed Jul  9 15:32:34 2003]:

> [cameron - Mon Jun  2 23:48:25 2003]:
> 
> > Hi,
> > 
> > When I try to investigate an enemy city using a spy, the client crashes.
> > To duplicate, login as "cjmorlan", then move the spy near Zgorzelec into
> > the city. Click "investigate city".
> > 
> > civclient: unittype.c:86: get_unit_type: Assertion `id >= 0 && id < 200
> > && id < game.num_unit_types' failed.
> 
> Obviously something is bogus about the unit.  When I run the client
> under valgrind, I get a whole host of warnings and errors.  It looks
> like the unit information is correctly allocated but is never properly
> initialized.

unpackage_unit is grossly incomplete!  Some fields in the packet are
simply ignored.

These were broken by this commit:

revision 1.305
date: 2003/05/05 12:41:39;  author: per;  state: Exp;  lines: +6 -16
Move virtual unit creation function from ai/aitools.c to common/game.c,
and use it in both client and server for creation unit skeletons. This
avoids duplication of code and allows client AI to use it to create
virtual units.

But I have no idea why, since there's no PR# and no further explanation.

The same patch also removed some other initializers:

-  /* not in packet, only in unit struct */
-  punit->focus_status = FOCUS_AVAIL;
-  punit->bribe_cost = 0;       /* done by handle_incite_cost() */
-  punit->foul = FALSE;         /* never used in client/ */
-  punit->ord_map = 0;          /* never used in client/ */
-  punit->ord_city = 0;         /* never used in client/ */
-  punit->moved = FALSE;                /* never used in client/ */
-  punit->transported_by = 0;   /* never used in client/ */

which are probably okay to leave out (but again I don't see why...).

jason

Attachment: unpackage_unit.diff
Description: unpackage_unit.diff


[Prev in Thread] Current Thread [Next in Thread]