forked from Baystation12/Baystation12
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate_switchable_maps.sh
73 lines (52 loc) · 1.58 KB
/
generate_switchable_maps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
function compile_map {
mapname=$1
#delete the old environment file if it exists
if [ -f $mapname.dme ]
then
rm $mapname.dme
fi
#copy a new one as template
cp baystation12.dme $mapname.dme
#prep it... these sed calls are ripped from scripts\dm.sh
#add the MAP_OVERRIDE define to stop dreammaker complaining
sed -i '1s!^!#define 'MAP_OVERRIDE'\n!' $mapname.dme
#not sure what this does exactly, HACK HACK
#sed -i 's!// BEGIN_INCLUDE!// BEGIN_INCLUDE\n#include "'$arg'"!' $dmepath.dme
#actual map file include
sed -i 's!#include "maps\\_map_include.dm"!#include "maps\\'$mapname'\\'$mapname'.dm"!' $mapname.dme
#compile the dmb
"$DM" "$mapname.dme"
#write it out so that dreamseeker can access the list
echo $mapname >> switchable_maps
rm $mapname.dme
}
source "$( dirname "${BASH_SOURCE[0]}" )\scripts\sourcedm.sh"
if [[ $DM == "" ]]; then
echo "Couldn't find the DreamMaker executable, aborting."
exit 3
fi
#wipe the existing list of precompiled maps
if [ -f switchable_maps ]
then
rm switchable_maps
fi
grep "MAP_PATH=" .travis.yml | while read -r line ; do
#make sure this line isnt commented out
hashpos=`expr index "$line" \#`
#this is a nasty hack
zero=0
if [ $hashpos == $zero ]
then
#this is a nasty hack
linepos=`expr index "$line" H`
linepos=`expr $linepos + 1`
#we've extracted the mapname
mapname=${line:linepos}
# now compile it
compile_map $mapname
fi
done
# just until first_contact is added to travis
compile_map first_contact
sleep 100