chiark / gitweb /
penultima: macroify colours
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 8 Jun 2021 12:25:47 +0000 (13:25 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 8 Jun 2021 12:52:38 +0000 (13:52 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
specs/penultima.game.toml

index fd6b3f346bb920c99b82f166e1437d7d75148cc6..0ad388ba9ce57af319e96b023cdd9a8864702154 100644 (file)
  "ship","giraffe","cannon"]
 {% endmacro fairy_pieces -%}
 
+{% macro one_colour(x, y, colour) %}
+[[pieces]]
+pos = [{{ x }}, {{ y }}]
+type = "LibList"
+lib = "wikimedia"
+prefix = "chess-{{colour}}-"
+items = ["K","Q","R","R","B","B","N","N"]
+posd = [10, 0]
+{% endmacro one_colour %}
+
 
 # -------------------- actual game spec --------------------
 
@@ -141,37 +151,10 @@ count = 8
 
 # exciting colours
 
-[[pieces]]
-pos = [210, 55]
-type = "LibList"
-lib = "wikimedia"
-prefix = "chess-blue-"
-items = ["K","Q","R","R","B","B","N","N"]
-posd = [10, 0]
-
-[[pieces]]
-pos = [210, 65]
-type = "LibList"
-lib = "wikimedia"
-prefix = "chess-yellow-"
-items = ["K","Q","R","R","B","B","N","N"]
-posd = [10, 0]
-
-[[pieces]]
-pos = [210, 75]
-type = "LibList"
-lib = "wikimedia"
-prefix = "chess-red-"
-items = ["K","Q","R","R","B","B","N","N"]
-posd = [10, 0]
-
-[[pieces]]
-pos = [210, 45]
-type = "LibList"
-lib = "wikimedia"
-prefix = "chess-purple-"
-items = ["K","Q","R","R","B","B","N","N"]
-posd = [10, 0]
+{{ m::one_colour(x=210, y=55, colour="blue"   )}}
+{{ m::one_colour(x=210, y=65, colour="yellow" )}}
+{{ m::one_colour(x=210, y=75, colour="red"    )}}
+{{ m::one_colour(x=210, y=45, colour="purple" )}}
 
 
 # fairy pieces