colobot / colobot-data

Data files source for open-source Colobot: Gold Edition project developed by Epsitec and TerranovaTeam
http://colobot.info/
GNU General Public License v3.0
53 stars 46 forks source link

Modernize EndingFile #101

Closed hexagonrecursion closed 3 weeks ago

hexagonrecursion commented 3 weeks ago

https://github.com/colobot/colobot/commit/250047579f3e23071507e461cf616c366125693b deprecated the EndingFile win=1 lost=0 syntax. It should now be EndingFile win="other/win001.txt" lost="other/lost000.txt".

shopt -s globstar
perl -i -pe'/^EndingFile/ && /win=([0-9]+)/ && ($win=$1) && /(lost=([0-9]+))/ && ($_ = sprintf(qq(EndingFile win="levels/other/win%03d.txt" lost="levels/other/lost%03d.txt"\n), $win, $1))' **/*.txt
sed -i -E '/^EndingFile win=-1 lost=-1$/d' **/*.txt
sed -i -E 's%^EndingFile win=-1 lost=0$%EndingFile lost="levels/other/lost000.txt"%' **/*.txt
sed -i 's%levels/other/%other/%' **/*.txt  # it turns out that colobot automatically prepends levels/ to the path