From: Holger Schemel Date: Sun, 10 Jun 2018 12:01:50 +0000 (+0200) Subject: improved function to dump identifiers for all gadgets on current screen X-Git-Tag: 4.1.1.0~139 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=93d70984a668ae9a0a6c76c42e660978f34c3993;p=rocksndiamonds.git improved function to dump identifiers for all gadgets on current screen --- diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 6a3a9ac2..244db6ea 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -2278,13 +2278,23 @@ void DumpGadgetIdentifiers() { struct GadgetInfo *gi; - printf("Gadgets on current screen (any prefix 'gfx.' can be omitted):\n"); + Print("Gadgets on current screen:\n"); for (gi = gadget_list_first_entry; gi != NULL; gi = gi->next) + { if (gi->mapped && gi->image_id != -1) - printf("- '%s'\n", getTokenFromImageID(gi->image_id)); + { + char *token = getTokenFromImageID(gi->image_id); + char *prefix = "gfx."; + + if (strPrefix(token, prefix)) + token = &token[strlen(prefix)]; + + Print("- '%s'\n", token); + } + } - printf("Done.\n"); + Print("Done.\n"); } boolean DoGadgetAction(int image_id)