From 43b84664344b461bfb4128bb10111c3099029c7a Mon Sep 17 00:00:00 2001 From: tpart Date: Fri, 22 Nov 2024 15:19:42 +0100 Subject: Fix document crash --- client/menu/document/document.gd | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client/menu/document/document.gd b/client/menu/document/document.gd index 9cca0443..194b88d1 100644 --- a/client/menu/document/document.gd +++ b/client/menu/document/document.gd @@ -1,5 +1,6 @@ # Hurry Curry! - a game about cooking # Copyright 2024 nokoe +# Copyright 2024 tpart # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -21,7 +22,7 @@ func _ready(): super() $ScrollContainer/VBoxContainer.add_child(build_document(data)) -func build_document(element: Dictionary) -> Control: +func build_document(element: Dictionary, bullet: bool = false) -> Control: var node: Control match element["t"]: "document": @@ -50,7 +51,7 @@ func build_document(element: Dictionary) -> Control: node = VBoxContainer.new() node.name = "List" for e in element["es"]: - node.add_child(text_node(e, true)) + node.add_child(build_document(e, true)) "table": node = VBoxContainer.new() node.name = "Rows" @@ -70,7 +71,9 @@ func build_document(element: Dictionary) -> Control: for e in element["es"]: node.add_child(build_document(e)) "text": - node = text_node(element, false) + node = text_node(element, bullet) + _: + push_error("Error building document: Unknown type \"%s\"" % element["t"]) return node func text_node(element: Dictionary, bullet: bool) -> Control: @@ -103,9 +106,9 @@ func text_node(element: Dictionary, bullet: bool) -> Control: label.add_theme_color_override("font_color", Color(element["color"])) return node -func background(page_name: String) -> SubViewportContainer: +func background(background_name: String) -> SubViewportContainer: var item_name: String - match page_name: + match background_name: "cover": item_name = "plate:plate,plate,plate,dirt" "toc": item_name = "tomato" "tomato_soup": item_name = "plate:tomato-soup" -- cgit v1.2.3-70-g09d2