Skip to content

Commit

Permalink
(agrf) make demo title optional
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Nov 24, 2024
1 parent e764574 commit 5253788
Show file tree
Hide file tree
Showing 22 changed files with 26 additions and 28 deletions.
2 changes: 1 addition & 1 deletion agrf/lib/building/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

@dataclass
class Demo:
title: str
tiles: list
title: str = ""
remap: object = None
climate: str = "temperate"
subclimate: str = "default"
Expand Down
4 changes: 2 additions & 2 deletions station/stations/dovemere_1934.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ def quickload(name, symmetry):
b"\xe8\x8a\x9c0",
None,
[
Demo("The building", [[named_tiles.regular]]),
Demo([[named_tiles.regular]], "The building"),
Demo(
"With snow",
[[named_tiles.regular]],
"With snow",
remap=get_1cc_remap(CompanyColour.PINK),
climate="arctic",
subclimate="snow",
Expand Down
6 changes: 2 additions & 4 deletions station/stations/dovemere_2018_lib/demos/big.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
from agrf.graphics.palette import CompanyColour

big_demo = Demo(
"7×10 station layout (roughly 1 tile = 30m)",
semitraversable.demo_1(7, 10),
remap=get_1cc_remap(CompanyColour.WHITE),
semitraversable.demo_1(7, 10), "7×10 station layout (1 tile ≈ 30m)", remap=get_1cc_remap(CompanyColour.WHITE)
)
big_half_demo = Demo(
"7×5 half-station layout (roughly 1 tile = 25m)", big_demo.tiles[:5], remap=get_1cc_remap(CompanyColour.WHITE)
big_demo.tiles[:5], "7×5 half-station layout (1 tile ≈ 30m)", remap=get_1cc_remap(CompanyColour.WHITE)
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/full_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)

full_auto_demo = Demo(
"Fully traversable automatic stations",
row_2 + v_sep + row_3 + v_sep + row_4 + v_sep + row_5,
"Fully traversable automatic stations",
remap=get_1cc_remap(CompanyColour.BLUE),
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/full_np_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
row_5 = h_merge([traversable.demo_2(i, 5) for i in range(1, 5)], [[cns.T], [cns], [cns_d], [cns.T], [cns]])

full_np_auto_demo = Demo(
"Fully traversable automatic stations (no platform at ends)",
row_1 + v_sep + row_2 + v_sep + row_4 + v_sep + row_5,
"Fully traversable automatic stations (no platform at ends)",
remap=get_1cc_remap(CompanyColour.BLUE),
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/normal.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


normal_demo = Demo(
"5×7 station layout (roughly 1 tile = 40m)",
semitraversable.demo_1(5, 7) + roadstops + west_square,
"5×7 station layout (1 tile ≈ 40m)",
remap=get_1cc_remap(CompanyColour.WHITE),
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/real_yard.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ def make_line(x, a, b, c, d):
far_lines = [[el.T for el in line] for line in near_lines[::-1]]

real_yard_demo = Demo(
"14×22 track yard, including pass-through tracks", far_lines + near_lines, remap=get_1cc_remap(CompanyColour.WHITE)
far_lines + near_lines, "14×22 track yard, including pass-through tracks", remap=get_1cc_remap(CompanyColour.WHITE)
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/semi_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)

semi_auto_demo = Demo(
"Semitraversable automatic stations",
row_3 + v_sep + row_4 + v_sep + row_5 + v_sep + row_6,
"Semitraversable automatic stations",
remap=get_1cc_remap(CompanyColour.BLUE),
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/semi_np_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)

semi_np_auto_demo = Demo(
"Semitraversable automatic stations (no platform)",
row_4 + v_sep + row_5 + v_sep + row_6 + v_sep + row_7,
"Semitraversable automatic stations (no platform)",
remap=get_1cc_remap(CompanyColour.BLUE),
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/side_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
assert n == len(station_building_2)

side_auto_demo = Demo(
"Nontraversable automatic stations",
[
[x.T for x in station_building],
[cns.T] * n,
Expand All @@ -26,5 +25,6 @@
[cns] * n,
station_building_2,
],
"Nontraversable automatic stations",
remap=get_1cc_remap(CompanyColour.BLUE),
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/side_np_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
assert n == len(station_building_2)

side_np_auto_demo = Demo(
"Nontraversable automatic stations (no platform)",
[
[x.T for x in station_building],
[cns.T] * n,
Expand All @@ -26,5 +25,6 @@
[cns] * n,
station_building_2,
],
"Nontraversable automatic stations (no platform)",
remap=get_1cc_remap(CompanyColour.BLUE),
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
assert n == len(station_building_2)

side_third_auto_demo = Demo(
"Traversable automatic stations",
[
[x.T for x in station_building],
[cns.T] * n,
Expand All @@ -26,5 +25,6 @@
[cns] * n,
station_building_2,
],
"Traversable automatic stations",
remap=get_1cc_remap(CompanyColour.BLUE),
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
assert n == len(station_building_2)

side_third_np_auto_demo = Demo(
"Traversable automatic stations",
[
[x.T for x in station_building],
[cns.T] * n,
Expand All @@ -26,5 +25,6 @@
[cns] * n,
station_building_2,
],
"Traversable automatic stations",
remap=get_1cc_remap(CompanyColour.BLUE),
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/special_aq.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
]

special_demo_aq = Demo(
"Irregular 7×7 station layout",
[rail_row, top_building, bottom_building, rail_row, top_building, bottom_building, rail_row],
"Irregular 7×7 station layout",
remap=get_1cc_remap(CompanyColour.LIGHT_BLUE),
climate="arctic",
subclimate="snow",
Expand Down
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/special_cn.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
]

special_demo_cn = Demo(
"Irregular 7×7 station layout",
top_half + [[i and i.T.R for i in row[::-1]] for row in top_half[2::-1]],
"Irregular 7×7 station layout",
remap=get_1cc_remap(CompanyColour.MAUVE),
climate="temperate",
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/special_cp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
globalize_all(platform_class="concrete", shelter_class="shelter_2")

special_demo_cp = Demo(
"Irregular 7×7 station layout",
[
[h_end_corridor, tee.T, h_normal_corridor, turn.T.R, default, default, default],
[cns, v_central_n, cns, v_central_n, cns_d, cns_d, cns_d],
Expand All @@ -25,6 +24,7 @@
[concourse_none, concourse_none, concourse_none, concourse_none, v_funnel, front_normal, corner.R],
[default, default, default, default, v_end_gate, default, default],
],
"Irregular 7×7 station layout",
remap=get_1cc_remap(CompanyColour.CREAM),
climate="toyland",
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/special_g.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
]

special_demo_g = Demo(
"Irregular 7×7 station layout",
[[x.T for x in station], rail_far, rail_near, rail_both, rail_far, rail_near, station],
"Irregular 7×7 station layout",
remap=get_1cc_remap(CompanyColour.YELLOW),
climate="arctic",
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/special_p.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
]

special_demo_p = Demo(
"Irregular 7×7 station layout",
top_half + [[i and i.T for i in row] for row in top_half[2::-1]],
"Irregular 7×7 station layout",
remap=get_1cc_remap(CompanyColour.PALE_GREEN),
climate="tropical",
)
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/special_sa.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
nt = concourse

special_demo_sa = Demo(
"Irregular 7×7 station layout",
[
[
v_end_platform.M,
Expand All @@ -26,6 +25,7 @@
[corner_gate.R.M, double_corner_2, corner.R, cns, cns, cns, v_central_n],
[front_gate_extender_corner, corner_gate.R, nt.T, nt.T, nt.T, nt.T, v_end_platform],
],
"Irregular 7×7 station layout",
remap=get_1cc_remap(CompanyColour.PURPLE),
climate="tropical",
subclimate="desert",
Expand Down
2 changes: 1 addition & 1 deletion station/stations/dovemere_2018_lib/demos/west_plaza.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@


west_plaza = Demo(
"West plaza", station + roadstops + west_square, remap=get_1cc_remap(CompanyColour.WHITE), merge_bbox=True
station + roadstops + west_square, "West plaza", remap=get_1cc_remap(CompanyColour.WHITE), merge_bbox=True
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def make_demo(switch, w, h, preswitch=None):
demo = Demo("", switch.demo(w, h, preswitch))
demo = Demo(switch.demo(w, h, preswitch))
for i, var in enumerate([demo, demo.M]):
sprite = grf.AlternativeSprites(
*[
Expand Down
6 changes: 3 additions & 3 deletions station/stations/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ def get_concourse_sprite(self, platform_class, side):
b"\xe8\x8a\x9cP",
None,
[
Demo("Platform", [[cns_concrete], [cns_concrete_d], [cns_concrete.T]]),
Demo("Platform with concrete grounds", [[cns_concrete_side], [cns_concrete_d], [cns_concrete_side.T]]),
Demo([[cns_concrete], [cns_concrete_d], [cns_concrete.T]], "Platform"),
Demo([[cns_concrete_side], [cns_concrete_d], [cns_concrete_side.T]], "Platform with concrete grounds"),
Demo(
"Platform with shelter", [[cns_concrete_shelter_1], [cns_concrete_shelter_1_d], [cns_concrete_shelter_1.T]]
[[cns_concrete_shelter_1], [cns_concrete_shelter_1_d], [cns_concrete_shelter_1.T]], "Platform with shelter"
),
],
)

0 comments on commit 5253788

Please sign in to comment.