mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Environment-based configuration wasn't sensibly usable in games with
spaces in the name. Fixed. (One day I really must get round to turning this into a proper config mechanism.) [originally from svn r6163]
This commit is contained in:
16
midend.c
16
midend.c
@ -722,11 +722,13 @@ float *midend_colours(midend_data *me, int *ncolours)
|
|||||||
for (i = 0; i < *ncolours; i++) {
|
for (i = 0; i < *ncolours; i++) {
|
||||||
char buf[80], *e;
|
char buf[80], *e;
|
||||||
unsigned int r, g, b;
|
unsigned int r, g, b;
|
||||||
int j;
|
int j, k;
|
||||||
|
|
||||||
sprintf(buf, "%s_COLOUR_%d", me->ourgame->name, i);
|
sprintf(buf, "%s_COLOUR_%d", me->ourgame->name, i);
|
||||||
for (j = 0; buf[j]; j++)
|
for (j = k = 0; buf[j]; j++)
|
||||||
buf[j] = toupper((unsigned char)buf[j]);
|
if (!isspace((unsigned char)buf[j]))
|
||||||
|
buf[k++] = toupper((unsigned char)buf[j]);
|
||||||
|
buf[k] = '\0';
|
||||||
if ((e = getenv(buf)) != NULL &&
|
if ((e = getenv(buf)) != NULL &&
|
||||||
sscanf(e, "%2x%2x%2x", &r, &g, &b) == 3) {
|
sscanf(e, "%2x%2x%2x", &r, &g, &b) == 3) {
|
||||||
ret[i*3 + 0] = r / 255.0;
|
ret[i*3 + 0] = r / 255.0;
|
||||||
@ -772,11 +774,13 @@ int midend_num_presets(midend_data *me)
|
|||||||
* encoded parameter strings.
|
* encoded parameter strings.
|
||||||
*/
|
*/
|
||||||
char buf[80], *e, *p;
|
char buf[80], *e, *p;
|
||||||
int j;
|
int j, k;
|
||||||
|
|
||||||
sprintf(buf, "%s_PRESETS", me->ourgame->name);
|
sprintf(buf, "%s_PRESETS", me->ourgame->name);
|
||||||
for (j = 0; buf[j]; j++)
|
for (j = k = 0; buf[j]; j++)
|
||||||
buf[j] = toupper((unsigned char)buf[j]);
|
if (!isspace((unsigned char)buf[j]))
|
||||||
|
buf[k++] = toupper((unsigned char)buf[j]);
|
||||||
|
buf[k] = '\0';
|
||||||
|
|
||||||
if ((e = getenv(buf)) != NULL) {
|
if ((e = getenv(buf)) != NULL) {
|
||||||
p = e = dupstr(e);
|
p = e = dupstr(e);
|
||||||
|
Reference in New Issue
Block a user