Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 38
Home

[Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 38

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Thu, 17 Jan 2002 14:45:23 +0000 (GMT)

 --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
[future tech cleanup]

I suspect this patch will also lead to few bugs (I can point my finger
though, it's just a feeling).  But it is definitely a move forward.
 
One comment (please scroll):

[...]

 
+/**************************************************************************
> + Return the name of the given tech. You don't have to free the return
> + pointer.
>
+**************************************************************************/
> +const char *get_tech_name(struct player *pplayer, Tech_Type_id tech)
> +{
> +  static char buffer[200];
> +
> +  if (!is_future_tech(tech)) {
> +    my_snprintf(buffer, sizeof(buffer), "%s", advances[tech].name);
> +  } else {
> +    my_snprintf(buffer, sizeof(buffer), _("Future Tech. %d"),
> +             pplayer->future_tech + 1);
> +  }
> +  return buffer;
>  }

[....]

Can you use your new and lovely get_tech_name instead of old and ugly
if-elseif-else construction below??

> Index: server/plrhand.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
> retrieving revision 1.206
> diff -u -r1.206 plrhand.c
> --- server/plrhand.c  2002/01/15 21:15:06     1.206
> +++ server/plrhand.c  2002/01/16 22:24:33
> @@ -294,22 +294,21 @@
>                   advances[plr->ai.tech_goal].name);
>      } else {
>        choose_random_tech(plr);
> -      if (plr->research.researching!=A_NONE && tech_found != A_NONE)
> -     notify_player(plr,
> -                  _("Game: Learned %s.  Scientists choose to research %s."),
> -                  advances[tech_found].name,
> -                  advances[plr->research.researching].name);
> -      else if (tech_found != A_NONE)
> -     notify_player(plr,
> -                   _("Game: Learned %s.  Scientists choose to research "
> -                     "Future Tech. 1."),
> +      if (!is_future_tech(plr->research.researching)
> +       && !is_future_tech(tech_found)) {
> +     notify_player(plr,_("Game: Learned %s.  Scientists "
> +                         "choose to research %s."),
> +                   advances[tech_found].name,
> +                   advances[plr->research.researching].name);
> +      } else if (!is_future_tech(tech_found)) {
> +     notify_player(plr, _("Game: Learned %s.  Scientists "
> +                          "choose to research Future Tech. 1."),
>                     advances[tech_found].name);
> -      else {
> +      } else {
> +     notify_player(plr, _("Game: Learned Future Tech. %d.  "
> +                          "Researching Future Tech. %d."),
> +                   plr->future_tech, (plr->future_tech) + 1);
>       plr->future_tech++;
> -     notify_player(plr,
> -                   _("Game: Learned Future Tech. %d.  "
> -                     "Researching Future Tech. %d."),
> -                   plr->future_tech,(plr->future_tech)+1);
>        }
>      }
>      if (saving_bulbs) {

G.

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


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