From 3476d69806a41b7e08e9843b8c7bcb1b7012c128 Mon Sep 17 00:00:00 2001 From: "Jason S. Ninneman" Date: Mon, 26 Jun 2017 15:29:14 -0700 Subject: [PATCH] Fix empty initializer braces. --- adventure.yaml | 6 +++--- newdungeon.py | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/adventure.yaml b/adventure.yaml index 42af7ae..14c02fc 100644 --- a/adventure.yaml +++ b/adventure.yaml @@ -380,9 +380,9 @@ actspk: { motions: !!omap - MOT_0: - words: [] + words: !!null - MOT_1: - words: [] + words: !!null - MOT_2: words: ['road', 'hill'] - MOT_3: @@ -516,7 +516,7 @@ motions: !!omap - MOT_67: words: ['cave'] - MOT_68: - words: [] + words: !!null - MOT_69: words: ['cross'] - MOT_70: diff --git a/newdungeon.py b/newdungeon.py index c7aabee..fea2637 100755 --- a/newdungeon.py +++ b/newdungeon.py @@ -405,14 +405,17 @@ def get_actspk(actspk): def get_motions(motions): template = """ {{ - .words = (const char* []) {{{}}}, + .words = {}, }}, """ mot_str = "" for motion in motions: contents = motion[1] + if contents["words"] == None: + mot_str += template.format("NULL") + continue c_words = [make_c_string(s) for s in contents["words"]] - words_str = ", ".join(c_words) + words_str = "(const char* []) {" + ", ".join(c_words) + "}" mot_str += template.format(words_str) return mot_str