[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]
On Thu, Jan 17, 2002 at 02:45:23PM +0000, Gregory Berkolaiko wrote:
> --- 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.
Yes this feeling may be right.
> One comment (please scroll):
>
> > +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??
I would have done so if it would be this easy.
> > + } else {
> > + notify_player(plr, _("Game: Learned Future Tech. %d. "
> > + "Researching Future Tech. %d."),
> > + plr->future_tech, (plr->future_tech) + 1);
Problem 1: the static buffer of get_tech_name can't be reused
Problem 2: if could be written with another buffer and two calls to
get_tech_name to assemble the string. But this is also ugly.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"When C++ is your hammer, everything looks like a thumb."
-- Steven M. Haflich
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, (continued)
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Raimar Falke, 2002/01/16
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Gregory Berkolaiko, 2002/01/16
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Raimar Falke, 2002/01/16
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Gregory Berkolaiko, 2002/01/16
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Mike Kaufman, 2002/01/16
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Ross W. Wetmore, 2002/01/17
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Raimar Falke, 2002/01/18
[Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Paul Zastoupil, 2002/01/16
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Raimar Falke, 2002/01/16
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Gregory Berkolaiko, 2002/01/17
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383,
Raimar Falke <=
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Gregory Berkolaiko, 2002/01/17
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Raimar Falke, 2002/01/17
- [Freeciv-Dev] Re: Assertion failed: missing > 0, file plrhand.c, line 383, Gregory Berkolaiko, 2002/01/17
|
|