Skip to content

Instantly share code, notes, and snippets.

@andythenorth
andythenorth / roadveh_cmd.cpp
Created March 4, 2018 14:53
NRT cache invalidation on change of type
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 3b30c4fc4..2fea6ce25 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1310,6 +1310,7 @@ again:
if (GetRoadType(old_tile, v->rtid.basetype) != GetRoadType(tile, v->rtid.basetype)) {
v->First()->CargoChanged();
+ RoadVehUpdateCache(v);
}
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index ca2dd1431..beb5d5b61 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1307,12 +1307,11 @@ again:
v->tile = tile;
v->state = (byte)dir;
v->frame = start_frame;
-
if (GetRoadType(old_tile, v->rtid.basetype) != GetRoadType(tile, v->rtid.basetype)) {
@andythenorth
andythenorth / MyTownMod.py
Last active April 14, 2019 14:02 — forked from TrueBrain/MyTownMod.py
My Town Mod
class AggressiveTown(Town):
class table:
pass
class actions:
bribe = Action(String("Bribe"), AggressiveTown._onActionBribe)
grow_town = Action(String("Grow town"), AggressiveTown._onActionGrowTown)
class storage:
../../pypy3/bin/nmlc -l generated/lang --verbosity=4 --nfo=generated/iron-horse.nfo generated/iron-horse.nml
Reading lang ... 0.1 s
Reading ... 0.1 s
Init parser ... 0.0 s
Parsing ... 2.1 s
Preprocessing ... 3.2 s
Generating actions ... 0.3 s
Assigning Action2 registers ... 0.1 s
Generating strings ... 0.0 s
Collecting real sprites ... 0.1 s
../../pypy3/bin/nmlc -l generated/lang --verbosity=4 --nfo=generated/iron-horse.nfo generated/iron-horse.nml
Reading lang ... 0.1 s
Reading ... 0.1 s
Init parser ... 0.0 s
Parsing ... 3.9 s
Preprocessing ... 4.3 s
Generating actions ... 0.2 s
Assigning Action2 registers ... 0.0 s
Generating strings ... 0.0 s
Collecting real sprites ... 0.1 s
diff --git a/sprites/extra/extra-plus-rivers.pnml b/sprites/extra/extra-plus-rivers.pnml
index 709323c..915c1a4 100644
--- a/sprites/extra/extra-plus-rivers.pnml
+++ b/sprites/extra/extra-plus-rivers.pnml
@@ -155,191 +155,191 @@ spriteset(set_rivermouth_temperate, "") {
tmpl_level_ground_file( 1, 1, "sprites/png/terrain/waterfeatures/riverbank_temperate_se.gimp.png")
tmpl_level_ground_file( 1, 1, "sprites/png/terrain/waterfeatures/riverbank_temperate_sw.gimp.png")
tmpl_level_ground_file( 1, 1, "sprites/png/terrain/waterfeatures/riverbank_temperate_nw.gimp.png")
- [ 338, 904, 19, 9, 14, 11, "sprites/png/terrain/waterfeatures.png"]
- [ 370, 904, 16, 9, -7, 22, "sprites/png/terrain/waterfeatures.png"]
diff --git a/sprites/extra/extra-plus-rivers.pnml b/sprites/extra/extra-plus-rivers.pnml
index 709323c..915c1a4 100644
--- a/sprites/extra/extra-plus-rivers.pnml
+++ b/sprites/extra/extra-plus-rivers.pnml
@@ -155,191 +155,191 @@ spriteset(set_rivermouth_temperate, "") {
tmpl_level_ground_file( 1, 1, "sprites/png/terrain/waterfeatures/riverbank_temperate_se.gimp.png")
tmpl_level_ground_file( 1, 1, "sprites/png/terrain/waterfeatures/riverbank_temperate_sw.gimp.png")
tmpl_level_ground_file( 1, 1, "sprites/png/terrain/waterfeatures/riverbank_temperate_nw.gimp.png")
- [ 338, 904, 19, 9, 14, 11, "sprites/png/terrain/waterfeatures.png"]
- [ 370, 904, 16, 9, -7, 22, "sprites/png/terrain/waterfeatures.png"]
[LANG] Compiling and Linking strgen
Undefined symbols for architecture x86_64:
"Utf8Decode(unsigned int*, char const*)", referenced from:
StringReader::HandleString(char*) in strgen_base.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [strgen] Error 1
make: *** [all] Error
switch (FEAT_TRAINS, SELF, switch_alt_var_41_ids_matched, [STORE_TEMP(LOAD_TEMP(1), 0x10F), var[0x61, 0, 0x0000FFFF, 0xC6] == 470]) {
1: return 1;
return 0;
}
switch (FEAT_TRAINS, SELF, switch_alt_var_41_position_in_vehid_chain_multiple_ids_127, [STORE_TEMP(-127, 1), switch_alt_var_41_ids_matched()]) {
return 126;
}
switch (FEAT_TRAINS, SELF, switch_alt_var_41_position_in_vehid_chain_multiple_ids_126, [STORE_TEMP(-126, 1), switch_alt_var_41_ids_matched()]) {
1: switch_alt_var_41_position_in_vehid_chain_multiple_ids_127;
return 125;
<!--
Var 41 only checks consecutive chains for a single ID
This provides an alternative checking consecutive chains using up to 16 IDs
This checks var 61 many many times in graphics chains, and var 61 is not cached, so this _may_ introduce performance problems
-->
<!--
Utility switches to check if vehicle ID is in list
Up to 16 items in list - arbitrary limit, should be enough for most cases)
There's no obvious alternative to having one switch per range of IDs to check
Be aware that this might match vehicle ID 0 incorrectly, as OpenTTD will retun 0 when checking var 61 beyond consist length - edge case TBH