Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2003:
[Freeciv-Dev] Re: (PR#6216) Assertion `punit->transported_by != -1' fail
Home

[Freeciv-Dev] Re: (PR#6216) Assertion `punit->transported_by != -1' fail

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdwheeler42@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#6216) Assertion `punit->transported_by != -1' failed
From: "Jason Short" <jshort@xxxxxxxxxxxxxx>
Date: Mon, 22 Sep 2003 19:13:19 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Mon, 22 Sep 2003, John Wheeler wrote:

>
> [jdorje - Mon Sep 22 05:01:41 2003]:
>
> > Here is a quick-fix patch.  Unfortunately this just makes the current
> > ugliness uglier.  Fixing the ugliness is harder and bug-prone: we have
> > to update player unit lists, city supported unit lists, fog, contact,
> > sentry wakeup, city tile status maps, and additional syncing with the
> > client.
>
> I assumed that taking care of all that stuff was why unit transfers were
> done as creating a new unit, instead of just changing the owner field.

Clearly so.  But doing it this way has some substantial disadvantages, I'd
say.  For instance it would be nice to put sanity checks into
put_unit_on_transporter and take_unit_off_transporter, but that doesn't
work if there are two copies of the unit.

> > I wonder what other values aren't initialized in this transfer?
>
> According to LXR, create_unit_full() is just called in 3 other places:
> server/citytools.c, line 1101 in remove_city(); server/diplomats.c, line
> 442 in diplomat_bribe(); and server/unittools.c, line 1471 in
> create_unit(), which is just a wrapper for create_unit_full() that hides
> some details that aren't needed the other places a unit is created.
>
> Because of this, I'm thinking create_unit_full() should take as
> parameters all the fields defined for a unit.  This might even take care
> of some undiscovered bugs!

Some fields don't lend themselves well to this idea.  Other than that it
is sensible.

> It's been a while since I've programmed in straight C, so I've forgotten
> whether you can have default arguments, e.g.
>
> void twisted(int spirals, bool right=FALSE);

You can't.

jason



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