Skip to content

Instantly share code, notes, and snippets.

@frosch123
frosch123 / quak.md
Created April 15, 2023 14:50
WASM API Compatibilty

Scenario

  • Replicate callback 39 "cargo profit" into WASM.
  • Later extend it with more more parameters or adjusted mechanics.

Variant 0

As a start, just to give the obvious: Keep the old bit-stuffed parameters, and just pass them to WASM.

@frosch123
frosch123 / content_auto_tagging.md
Last active March 5, 2023 17:33
Content auto tagging

Content classification

NewGRF

  • category: result from classify_newgrf
  • palette: 32bpp (> 50% 32bpp sprites), 8bpp (< 50% 32bpp sprites)
  • high-resolution: yes (> 50% 2x or 4x sprites), no (< 50% 2x or 4x sprites)
  • sound effects: yes/no
  • size: small (< 20 vehicles, < 10 industries, < 10 objects, ...), large (20-100 vehicles, 10-30 cargos), huge (> 100 vehicles, > 30 cargos)
@frosch123
frosch123 / counting_semaphore_proposal
Last active March 7, 2022 22:08
std::counting_semaphore does not meet BasicLockable requirements
Title: Make std::counting_semaphore meet requirements of BasicLockable/Lockable/TimedLockable
Section: [thread.sema.cnt]
Discussion:
One of std::counting_semaphore's use-cases is to limit the number of active threads.
Shortened example from https://en.cppreference.com/w/cpp/thread/counting_semaphore/acquire :
constexpr std::ptrdiff_t max_sema_threads{3};
@frosch123
frosch123 / randomaction.md
Last active January 22, 2022 23:09
RandomAction rant

Random bits

Each item has some storage dedicated to store some randomised state. The storage is generally very limited (counted in bits). The amount of storage is listed here. So

  • every industry tile on the map has 8 bit storage (in the map array)
  • every industry on the map has 16 bits of random storage.

Reading random bits

@frosch123
frosch123 / 037_optimised_scope.nfo
Last active October 24, 2021 20:03
Public stuff
// Automatically generated by GRFCODEC. Do not modify!
// (Info version 32)
// Escapes: 2+ 2- 2< 2> 2u< 2u> 2/ 2% 2u/ 2u% 2* 2& 2| 2^ 2sto = 2s 2rst = 2r 2psto 2ror = 2rot 2cmp 2ucmp 2<< 2u>> 2>>
// Escapes: 71 70 7= 7! 7< 7> 7G 7g 7gG 7GG 7gg 7c 7C
// Escapes: D= = DR D+ = DF D- = DC Du* = DM D* = DnF Du<< = DnC D<< = DO D& D| Du/ D/ Du% D%
// Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags
0 * 4 \d19
1 * 54 14 "C" "INFO"
@frosch123
frosch123 / blacklist.sh
Created May 13, 2020 21:24
BaNaNaS maintenance tools
#!/bin/sh
# blacklist.sh branch-name (content-type/unique-id)+
NAME="$1"
shift
git fetch upstream
git checkout master -b "blacklist_$NAME"
git rebase upstream/master
https://github.com/OpenTTD/OpenTTD/commit/53e7138a2e7fe80a2925171550576ad7eb60715d
(svn r26733) -Fix [FS#6086]: inconsistency in using spaces between number and unit in some strings
Try to follow the SI recommendation to use a non-breaking space between a number and its units (and prefix)
https://github.com/OpenTTD/OpenTTD/commit/b542a0fe1e3d79d37a1ba98c11d383285f44a474
(svn r26531) -Fix-ish: improve consistency of the usage of max and maximum
https://github.com/OpenTTD/OpenTTD/commit/be03779514bda4bf26553eee0c78f908608fae23
(svn r26469) -Fix [FS#5985, FS#5986, FS#5988]: Improve english strings.
@frosch123
frosch123 / gist:1513482f36791e5be88aec3010ae14e5
Created April 28, 2020 18:30
Stuff owned by openttdcoop or not
Name current from desc/tags
2x"HEQS (Heavy Equipment Set)" "openttdcoop","andythenorth" "andythenorth"
"Road Hog" "openttdcoop" "andythenorth"
"FISH ship set" "openttdcoop" "andythenorth"
"FISH 2" "openttdcoop" "andythenorth"
"Unsinkable Sam" "openttdcoop" "andythenorth"
"Iron Horse" "openttdcoop" "andythenorth"
"Iron Horse 2" "openttdcoop" "andythenorth"
5x"FIRS Industry Replacement Set" "openttdcoop" "andythenorth", "FooBar"
"FIRS 2"
@frosch123
frosch123 / MyTownMod.py
Last active April 14, 2019 18:46 — 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:
diff --git a/nml/actions/action2var.py b/nml/actions/action2var.py
index 17df6c2..fba1cae 100644
--- a/nml/actions/action2var.py
+++ b/nml/actions/action2var.py
@@ -404,7 +404,7 @@ class Varaction2Parser(object):
max = 0xF if expr.info['perm'] else 0x10F
if isinstance(expr.register, expression.ConstantNumeric) and expr.register.value > max:
raise generic.ScriptError("Register number must be in range 0..{:d}, encountered {:d}.".format(max, expr.register.value), expr.pos)
- if expr.info['perm'] and self.feature not in (0x08, 0x0A, 0x0D):
+ if expr.info['perm'] and self.feature not in (0x0A, 0x0D, "towns"):