Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "nml"]
path = nml
url = https://github.com/openttd/nml
path = nml
url = https://github.com/petern/nml
branch = newgrf-badges
2 changes: 2 additions & 0 deletions item_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
name: string(STR_STAT_${name_label});
tile_flags: [""" + ",\n".join("bitmask(STAT_TILE_NOWIRE)" for i in range(8)) +
""" ];
badges: [ "station/wins/left_yard",
"station/wins/right_yard" ];
} graphics {
prepare_layout: sw_item_${name}_prepare();
custom_spritesets: [s_fences_and_underlay];
Expand Down
2 changes: 1 addition & 1 deletion nml
Submodule nml updated 45 files
+14 −1 .github/workflows/regression.yml
+48 −84 .github/workflows/release.yml
+4 −4 .github/workflows/testing.yml
+36 −0 docs/changelog.txt
+41 −2 nml/actions/action0.py
+112 −20 nml/actions/action0properties.py
+84 −89 nml/actions/action1.py
+1 −1 nml/actions/action2.py
+2 −2 nml/actions/action2layout.py
+2 −2 nml/actions/action2real.py
+3 −0 nml/actions/action2var.py
+39 −8 nml/actions/action2var_variables.py
+22 −1 nml/actions/action3_callbacks.py
+1 −0 nml/actions/action5.py
+5 −1 nml/actions/real_sprite.py
+55 −0 nml/ast/badgetable.py
+1 −0 nml/ast/general.py
+1 −1 nml/expression/base_expression.py
+4 −1 nml/expression/functioncall.py
+2 −2 nml/expression/string_literal.py
+6 −0 nml/global_constants.py
+13 −1 nml/grfstrings.py
+13 −5 nml/main.py
+17 −0 nml/parser.py
+1 −0 nml/tokens.py
+2 −0 pyproject.toml
+0 −3 regression/030_house.nml
+72 −0 regression/042_badges.nml
+1 −1 regression/expected/013_train_callback.nfo
+1 −1 regression/expected/017_articulated_tram.nfo
+ regression/expected/030_house.grf
+60 −61 regression/expected/030_house.nfo
+1 −1 regression/expected/040_station.nfo
+1 −1 regression/expected/041_articulated_tram_32bpp.nfo
+ regression/expected/042_badges.grf
+94 −0 regression/expected/042_badges.nfo
+6 −6 regression/expected/example_industry.nfo
+ regression/expected/example_railtype.grf
+16 −16 regression/expected/example_railtype.nfo
+8 −8 regression/expected/example_road_vehicle.nfo
+ regression/expected/example_roadtype_and_tramtype.grf
+20 −20 regression/expected/example_roadtype_and_tramtype.nfo
+ regression/expected/example_train.grf
+16 −16 regression/expected/example_train.nfo
+6 −0 regression/lang/english.lng
36 changes: 31 additions & 5 deletions src/yard.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,45 @@ switch(FEAT_STATIONS, SELF, _sw_yard_type, track_type){

const none_yard = FILLED(2);

switch(FEAT_STATIONS, SELF, _sw_check_yard_p0n1, [
STORE_TEMP(badgetype("station/wins/right_yard"), 0x100),
STORE_TEMP(bitmask(4), 0x101),
var[0x79, 0, 0x1, 0xF0]]){return;}

switch(FEAT_STATIONS, SELF, _sw_check_yard_n1p0, [
STORE_TEMP(badgetype("station/wins/right_yard"), 0x100),
STORE_TEMP(bitmask(4), 0x101),
var[0x79, 0, 0x1, 0x0F]]){return;}

switch(FEAT_STATIONS, SELF, _sw_check_yard_n1n1, [
STORE_TEMP(badgetype("station/wins/right_yard"), 0x100),
STORE_TEMP(bitmask(4), 0x101),
var[0x79, 0, 0x1, 0xFF]]){return;}

switch(FEAT_STATIONS, SELF, _sw_check_yard_p1p0, [
STORE_TEMP(badgetype("station/wins/right_yard"), 0x100),
STORE_TEMP(bitmask(4), 0x101),
var[0x79, 0, 0x1, 0x01]]){return;}

switch(FEAT_STATIONS, SELF, _sw_check_yard_p1n1, [
STORE_TEMP(badgetype("station/wins/right_yard"), 0x100),
STORE_TEMP(bitmask(4), 0x101),
var[0x79, 0, 0x1, 0xF1]]){return;}


//TODO: change to test badges instead of station presence
// 0: front split, back split
// 1: front merge, back split
// 2: front split, back merge
// 3: none
switch(FEAT_STATIONS, SELF, _sw_yard_info_left,
!nearby_tile_is_station(0, -1) || !sw_tile_same_height_left() ? none_yard :
!_sw_check_yard_p0n1() || !sw_tile_same_height_left() ? none_yard :
(
(
!(
(
nearby_tile_is_station(-1, 0) && // replace with badge test
nearby_tile_is_station(-1, -1) && // replace with badge test
_sw_check_yard_n1p0() && // replace with badge test
_sw_check_yard_n1n1() && // replace with badge test
hasbit(rail_continuation, 1)
) ||
(
Expand All @@ -104,8 +130,8 @@ switch(FEAT_STATIONS, SELF, _sw_yard_info_left,
(
!(
(
nearby_tile_is_station( 1, 0) && // replace with badge test
nearby_tile_is_station( 1, -1) && // replace with badge test
_sw_check_yard_p1p0() && // replace with badge test
_sw_check_yard_p1n1() && // replace with badge test
hasbit(rail_continuation, 0)
) ||
(
Expand Down
5 changes: 5 additions & 0 deletions wins.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
#include "src/header.pnml"
#include "src/utility.pnml"

badgetable {
"station/wins/left_yard",
"station/wins/right_yard",
}

#include "src/spritesets.pnml"
#include "src/fences.pnml"
#include "src/yard.pnml"
Expand Down