From: Eric S. Raymond Date: Fri, 21 Jul 2017 18:03:39 +0000 (-0400) Subject: Simplify seed and waste cpmands using %d in the YAML string. X-Git-Tag: 1.3~15 X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=commitdiff_plain;h=80b2b9b356efad12257f26f541693377bf8056fb Simplify seed and waste cpmands using %d in the YAML string. --- diff --git a/actions.c b/actions.c index 0a67cf4..7faf331 100644 --- a/actions.c +++ b/actions.c @@ -1247,8 +1247,8 @@ static int wake(verb_t verb, obj_t obj) static int seed(verb_t verb, const char *arg) /* Set seed */ { - long seed = atol(arg); - speak(actions[verb].message, arg); + int seed = atoi(arg); + speak(actions[verb].message, seed); set_seed(seed); --game.turns; return GO_TOP; @@ -1258,9 +1258,7 @@ static int waste(verb_t verb, turn_t turns) /* Burn turns */ { game.limit -= turns; - char newlim[1024]; - sprintf(newlim, "%ld", (long)game.limit); - speak(actions[verb].message, newlim); + speak(actions[verb].message, (int)game.limit); return GO_TOP; } diff --git a/adventure.yaml b/adventure.yaml index 8c940f8..6401882 100644 --- a/adventure.yaml +++ b/adventure.yaml @@ -3881,10 +3881,10 @@ actions: !!omap message: *nothing_happens words: ['z''zzz'] - SEED: - message: 'Seed set to %s' + message: 'Seed set to %d' words: ['seed'] - WASTE: - message: 'Game limit is now %s' + message: 'Game limit is now %d' words: ['waste'] - ACT_UNKNOWN: message: *huh_man