Re: [AD] Allegro, config file routines addition |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Allegro Conductors <conductors@xxxxxxxxxx>
- Subject: Re: [AD] Allegro, config file routines addition
- From: Grzegorz Adam Hankiewicz <gradha@xxxxxxxxxx>
- Date: Sat, 24 Jun 2000 18:56:30 +0200 (CET)
On Sat, 24 Jun 2000, Charles Bilyue' wrote:
> Greetings to you... was writing some config file loading routines, and I
> wanted a feature not too dissimilar to classic Windows boolean INI file
> entries.
Hi, I would like to criticise this patch a little bit:
1) Instead of using stricmp use ustricmp.
2) There's no need for a temporal variable. If (!strcmp, whatever)
then return already.
3) I generally dislike boolean variables, they have always existed with 0
being false and any other value meaning true. Just look what the
function returns. This is just a personal opinion...
4) And the thing which most worries me is that there's a multilingual
problem with such a function, you have to stick to english texts, which
is bad now that Allegro supports UTF-8 easily and customizable
multilanguage text strings via config routines or custom ones.
2 and 3 aren't really an issue, 1 should be taken care of, and in order to
get 4, I would expect the routine to look up the text strings in
language.dat, so everybody can customize them. There could be a config
variable named true_text = YES:TRUE:ON, and false_text = NO:FALSE:OFF. You
would need to write then an initialization string which puts somewhere
these values around so you can use them in a loop using ustricmp inside
your function.
But, then there's a conflict itself in supporting multilanguage boolean
texts, and that is, a game configured for english will write it's
config/ini file, but if I change it to use spanish, the config file won't
work at all, returning all variables as false given the last atoi.
That's again why I think (number 3) boolean variables are evil. Any
comments? I might be too worried with such a thing, anyway users don't
tend to switch languages on the fly...
Grzegorz Adam Hankiewicz gradha@xxxxxxxxxx - http://gradha.infierno.org
Other web pages: http://glub.ehu.es/ - http://welcome.to/gogosoftware/