Simplify seed and waste cpmands using %d in the YAML string.

This commit is contained in:
Eric S. Raymond 2017-07-21 14:03:39 -04:00
parent 5337e00725
commit 80b2b9b356
2 changed files with 5 additions and 7 deletions

View file

@ -1247,8 +1247,8 @@ static int wake(verb_t verb, obj_t obj)
static int seed(verb_t verb, const char *arg) static int seed(verb_t verb, const char *arg)
/* Set seed */ /* Set seed */
{ {
long seed = atol(arg); int seed = atoi(arg);
speak(actions[verb].message, arg); speak(actions[verb].message, seed);
set_seed(seed); set_seed(seed);
--game.turns; --game.turns;
return GO_TOP; return GO_TOP;
@ -1258,9 +1258,7 @@ static int waste(verb_t verb, turn_t turns)
/* Burn turns */ /* Burn turns */
{ {
game.limit -= turns; game.limit -= turns;
char newlim[1024]; speak(actions[verb].message, (int)game.limit);
sprintf(newlim, "%ld", (long)game.limit);
speak(actions[verb].message, newlim);
return GO_TOP; return GO_TOP;
} }

View file

@ -3881,10 +3881,10 @@ actions: !!omap
message: *nothing_happens message: *nothing_happens
words: ['z''zzz'] words: ['z''zzz']
- SEED: - SEED:
message: 'Seed set to %s' message: 'Seed set to %d'
words: ['seed'] words: ['seed']
- WASTE: - WASTE:
message: 'Game limit is now %s' message: 'Game limit is now %d'
words: ['waste'] words: ['waste']
- ACT_UNKNOWN: - ACT_UNKNOWN:
message: *huh_man message: *huh_man