Skip to content

Instantly share code, notes, and snippets.

@TrueBrain
TrueBrain / MyTownMod.py
Last active April 14, 2019 18:44
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:
@TrueBrain
TrueBrain / team-workflow.txt
Created February 2, 2020 22:44
Team workflow
Workflows
- Listen to "issue created"
- Validate content of issue
- Pick up on which team it is someone requested access to
- Post a reply:
- Thank the user, tell him to wait
- List the current teams the user is already on
- Ask for approval by any core developers
- Mention the team he is asking permission to again (to avoid user editing his post sneaky)
@TrueBrain
TrueBrain / bat-shit-crazy-bananas-idea.txt
Last active February 25, 2020 14:40
Bat shit crazy BaNaNaS idea
github.com/OpenTTD/BaNaNaS
Repository full with meta data
First level folders are the type (AI, Base Graphics, ..)
In these folders are folders with the IDs (in hex) of the uploads.
In there are "branches"; currently unused, but in there is for now a single .ini file.
These ini files are like described in https://github.com/OpenTTD/musa/blob/master/example.ini
They describe the current (latest) upload
Possibly a few references extra to find the file back on the CDN, but those are minor details
For example: MD5 + ID of upload should be in there too
MD5s will be encrypted, to avoid people finding the old MD5s of an ID. ottd_content and frontend are the only ones that needs to be able to decrypt it.
@TrueBrain
TrueBrain / unique-id-is-a-mess-proof-me-wrong.txt
Last active March 5, 2020 19:56
Unique ID mess in OpenTTD
UniqueIDs are named differently per content-type, so let's start with that:
NewGRF -> GRFID (char[4])
Scripts -> short_name (string of 4 letters)
Base Sets -> shortname (string of 4 letters)
Scenario -> .scn.id (a decimal value)
Heightmap -> .png.id (a decimal value)
They all have a slightly different way of storing their data, but they all end up as an uint32.
@TrueBrain
TrueBrain / authors.yaml
Last active March 14, 2020 18:41
OpenGFX Versions file
# This is in its own file, as they cannot be changed per version.
# These authors can access any versions for this folder.
authors:
# Possibly we can clean up the "openttd" entry, after linking to GitHub.
- display-name: "planetmaker"
github: "1234-1234-1234-1234"
openttd: "planetmaker"
# This next user never had an OpenTTD account.
- display-name: "andythenorth"
github: "4321-4321-4321-4321"
@TrueBrain
TrueBrain / binaries-overview.txt
Last active April 11, 2020 13:23
Overview of binaries.openttd.org and related domains
(some parts allow HTTP, instead of redirecting HTTP to HTTPS, because the OpenTTD client cannot use HTTPS)
HTTP+HTTPS binaries.openttd via ALB
/bananas -> forwarded ECS openttd/content-server
/installer -> redirect 301 installer.cdn.openttd.org
HTTPS binaries.openttd via ALB
/bananas -> 404 (files changed to md5-name)
/binaries -> redirect 301 cdn.openttd.org
/extra -> redirect 301 cdn.openttd.org
def func_00821b():
if False: yield
lda8((Pointer((cpu.dh << 8), 0xff, 0x13)) if (cpu.flag_e and cpu.dl == 0) else (Pointer(0, 0xffff, cpu.d + 0x13)))
sta8(Pointer(0, 0xffffff, (cpu.dbr << 16) + ((0x2100) & 0xffff)))
lda8((Pointer((cpu.dh << 8), 0xff, 0x9b)) if (cpu.flag_e and cpu.dl == 0) else (Pointer(0, 0xffff, cpu.d + 0x9b)))
sta8(Pointer(0, 0xffffff, (cpu.dbr << 16) + ((0x420c) & 0xffff)))
rep(0b00110000)
plb8()
pld16()
ply16()
@TrueBrain
TrueBrain / index.js
Last active September 18, 2020 21:18
grfsearch.openttd.org
'use strict';
const querystring = require('querystring');
exports.handler = (event, context, callback) => {
var request = event.Records[0].cf.request;
const params = querystring.parse(request.querystring);
var redirect_uri = '/index.php';
@TrueBrain
TrueBrain / features.md
Last active November 26, 2020 20:26
IRC Bot

Supported features

GitHub

  • GitHub event -> announcements (via .dorpsgek.yml)

User

  • User registration via Pull Request
  • Hostname to "auto" identify (especially in combination with NickServ and *.user.oftc.net a simple way for anyone to identify)
  • Channel permissions via Pull Request
@TrueBrain
TrueBrain / nullptr_addition.patch
Last active December 4, 2020 21:10
News crash fix
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index a3f73d729..055979951 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -255,7 +255,7 @@ NewsDisplay NewsTypeData::GetDisplay() const
uint index;
const SettingDesc *sd = GetSettingFromName(this->name, &index);
assert(sd != nullptr);
- void *ptr = GetVariableAddress(nullptr, &sd->save);
+ void *ptr = GetVariableAddress(&_settings_game, &sd->save);