Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: patch 2: unique and gameloss flags for units (PR#1324)
Home

[Freeciv-Dev] Re: patch 2: unique and gameloss flags for units (PR#1324)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: patch 2: unique and gameloss flags for units (PR#1324)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 18 Mar 2002 19:13:01 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Tue, Mar 12, 2002 at 05:32:06PM -0800, Per I. Mathisen wrote:
>  static const char *role_names[] = {
>    "FirstBuild", "Explorer", "Hut", "HutTech", "Partisan",
> @@ -424,6 +424,11 @@
>      return FALSE;
>    if (get_invention(p,unit_types[id].tech_requirement)!=TECH_KNOWN)
>      return FALSE;
> +  if (unit_type_flag(id, F_UNIQUE)) {
> +    unit_list_iterate_safe(p->units, punit) {
> +      if (punit->type == id) return FALSE;

Please add {}. Why do you use unit_list_iterate_safe here?

> +    } unit_list_iterate_safe_end;
> +  }
>    return TRUE;
>  }

> +  F_UNIQUE,           /* A player can only build one of this unit */
 F_UNIQUE,           /* A player can only build one unit of this type */


> +  /* check if this unit had F_GAMELOSS flag */
> +  if (unit_flag(punit, F_GAMELOSS)) {
> +    notify_conn_ex(&game.est_connections, punit->x, punit->y, E_UNIT_LOST,
> +        _("Unable to defend %s, %s has lost the game."),
> +        unit_name(punit->type), unit_owner(punit)->name);

> +    notify_player(unit_owner(punit), "Losing %s meant losing the game! Be 
> more careful"
> +        " next time!", unit_name(punit->type));

Add _()

> +    unit_owner(punit)->is_alive = FALSE;

I'm not sure about the consequence of this (which players owns the
remaining units/cities now). We could:
 - destroy/raze all cities/units
 - install a new AI and transfer cities/units

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "The very concept of PNP is a lovely dream that simply does not translate to
  reality. The confusion of manually doing stuff is nothing compared to the
  confusion of computers trying to do stuff and getting it wrong, which they
  gleefully do with great enthusiasm." 
    -- Jinx Tigr in the SDM


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