RandomNotes.wiki
author Wuzzy
Tue, 01 Jan 2019 22:00:27 +0000
changeset 1695 6bf2e6deedb0
parent 1239 b028249e74c9
child 1726 c3de0c96ce6e
permissions -rw-r--r--
LuaAPI: Fix some bugs

#summary little tidbits that await proper structuring

= Introduction =
This page is a collection of random unsorted or unfinished stuff which is not good or structured enough to be put into one of the “real” wiki pages. Wiki editors: If something becomes actually useable, please move it to the appropriate wiki page and remove it from this page.

This page is intentionally chaotic and may change rapidliy at any time.

= How to add a settings option =
 * `QStringList HWGame::setArguments()` in `game.cpp` is the function that prepares the argument list
 * `void GameUIConfig::SaveOptions()` in `gameuiconfig.cpp` loads (or initializes) values and set the widgets to those values
 * `PageOptions::PageOptions(QWidget* parent) :  AbstractPage(parent)` is where you would add your widget

= How to convert a `.hwmap` file to a Lua string =

Run this in a shell:

<code>IN="map.hwmap";OUT="temp.lua";base64 -d $IN | tail -c +7 | head -c -4 > foo;echo -ne "\x1f\x8b\x08\0\0\0\0\0\x02\xff" > bar;cat bar foo | gunzip > baz;C=0;echo -n "local map = { " >> $OUT;od -w240 -t u1 baz | grep -Ev "^[0-9]*[[:space:]]*$" | while read f;do C=$((C+1));if ((C!=1));then echo "," >> $OUT;fi;echo -n $f | sed "s/^......./'/;s/  */\\\\/g;s/$/'/" >> $OUT;done;echo "}" >> $OUT</code>

Input file: `map.hwmap`
Output file: `temp.lua`

= Syntax test =

== Bullet points ==

 * Single lonely bullet point

 * Two bullet points
 * Two bullet points

 * Three bullets!
 * Three bullets!
 * Three bullets!

== Linktest ==

[RandomNotes#Undocumented_LuaAP_functions TESTLINK1]
[RandomNotes#Bullet_points TESTLINK2]