From 80b2b9b356efad12257f26f541693377bf8056fb Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 21 Jul 2017 14:03:39 -0400 Subject: [PATCH] Simplify seed and waste cpmands using %d in the YAML string. --- actions.c | 8 +++----- adventure.yaml | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) 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 -- 2.31.1