Skip to content

Instantly share code, notes, and snippets.

Enno Rehling ennorehling

Block or report user

Report or block ennorehling

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View trolls.lua
function test_trolls_ride_carts()
local r0 = region.create(0, 0, "plain")
local r1 = region.create(1, 0, "plain")
local r2 = region.create(2, 0, "plain")
local r3 = region.create(3, 0, "plain")
local r4 = region.create(4, 0, "plain")
local f = faction.create("troll")
-- 1. 20 trolls can pull 5 loaded carts:
local u1 = unit.create(f, r0, 20)
u1:add_item("cart", 5)
View 2605.lua
function test_bug_2605()
local r0 = region.create(0, 0, "plain")
local r1 = region.create(1, 0, "plain")
local r2 = region.create(2, 0, "plain")
local r3 = region.create(3, 0, "plain")
local f = faction.create("human")
-- 1. two walkers, each with two horses and a cart:
local u1 = unit.create(f, r0, 2)
u1:add_item("horse", 2)
u1:add_item("cart", 1)
View riders.lua
function test_rider_leads_horses()
local r0 = region.create(0, 0, "plain")
local r1 = region.create(1, 0, "plain")
local r2 = region.create(2, 0, "plain")
local r3 = region.create(3, 0, "plain")
local f = faction.create("human")
-- lead 1 extra horse per level while riding:
local u1 = unit.create(f, r0, 1)
u1:set_skill("riding", 1)
u1:add_item("horse", 2)
@ennorehling
ennorehling / crsample.json
Created Jun 30, 2019
Sample CR to JSON conversion
View crsample.json
{
"charset": "UTF-8",
"locale": "de",
"noskillpoints": 1,
"date": 1509041527,
"Spiel": "Drachensgrab",
"Konfiguration": "Standard",
"Koordinaten": "Hex",
"max_units": 50,
"Basis": 36,
@ennorehling
ennorehling / test.json
Last active Feb 18, 2019
CR to JSON result
View test.json
{
"Basis": 36,
"home": "0 1 2",
"charset": "UTF-8",
"noskillpoints": 1,
"PARTEI": [
{
"id": 1045107,
"locale": "de",
"age": 8
@ennorehling
ennorehling / test.cr
Created Feb 17, 2019
CR to JSON demonstration
View test.cr
VERSION 66
36;Basis
0 1 2;home
"UTF-8";charset
1;noskillpoints
PARTEI 1045107
"de";locale
8;age
PARTEI 683844
"de";locale
@ennorehling
ennorehling / convert.sh
Created Dec 17, 2018
Source encoding fixer
View convert.sh
#!/bin/sh
while [ ! -z $1 ] ; do
tmpfile=$(mktemp eressea.XXX)
iconv -f latin1 -t utf-8 < $1 | \
perl -pe 's/ß/ss/; s/ä/ae/; s/ü/ue/; s/ö/oe/;' \
> $tmpfile && \mv $tmpfile $1
shift 1
done
@ennorehling
ennorehling / bug2470.lua
Created Jul 30, 2018
Fix peasants in new player area
View bug2470.lua
require 'config'
filename = get_turn() .. '.dat'
eressea.read_game(filename)
maxps = {
['plain'] = 10000,
['mountain'] = 1000,
['glacier'] = 100,
['highland'] = 4000,
@ennorehling
ennorehling / kodeklubben.py
Last active May 25, 2018
kodeklubben er kult
View kodeklubben.py
from turtle import *
def plot(str, w):
i = 0
while (i+2 < len(str)):
p = str[i]
a = (ord(str[i+1]) - ord('0'))
d = (ord(str[i+2]) - ord('0'))
i = i + 3
if p == 'c':
@ennorehling
ennorehling / cppcheck.txt
Created Feb 25, 2018
2018-02-25 cppcheck results for Eressea 3.15
View cppcheck.txt
[src/creport.c:1090]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'.
[src/creport.c:1519]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'.
[src/gmtool.c:83]: (information) Skipping configuration 'STDIO_CP' since the value of 'STDIO_CP' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
[src/kernel/order.c:137]: (style) The scope of the variable 'obuf' can be reduced.
[src/kernel/save.c:1191] -> [src/kernel/save.c:1192]: (style) Variable 'sz' is reassigned a value before the old one has been used.
[src/kernel/save.c:278]: (style) The scope of the variable 'f' can be reduced.
[src/kernel/save.c:904]: (style) The scope of the variable 'line' can be reduced.
[src/kernel/save.c:1397]: (style) The scope of the variable 'bp' can be reduced.
[src/kernel/save.c:1398]: (style) The scope of the variable 'shp' can be reduced.
[src/kernel/terrain.c:74]: (style) The scope of the variable 'n' can be re
You can’t perform that action at this time.