]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/tools/xonotic-map-compiler-optionsfile
5c3c05a9a7e42c3ee2e52858eff190f0f257b4b0
[xonotic/xonotic.git] / misc / tools / xonotic-map-compiler-optionsfile
1 #!/bin/sh
2
3 M=${1%.map}
4 shift
5 m=${M:30}
6
7 sz=`grep '^size ' "$M.mapinfo" 2>/dev/null || true`
8 if [ -n "$sz" ]; then
9         minimap_override="-minimap + -minmax ${sz#size }"
10 else
11         minimap_override=
12 fi
13
14 mkdir -p ~/.xonotic-map-compiler-autobuild/ # to store map compile times in
15 tstart=`date +%s`
16
17 if [ -f ~/.xonotic-map-compiler-autobuild/${m##*/} ] ; then # ${m##*/} : cut $m at "/", get latest field
18         lasttime=`cat ~/.xonotic-map-compiler-autobuild/${m##*/} 2>/dev/null` # oppress warnings if file doesn't exist
19         echo "Done in approximately $(($lasttime/60)) minutes."
20 fi
21
22 misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` $minimap_override "$@" || mapfail=true
23
24 tend=`date +%s`
25 let tdelta=$tend-$tstart # compute time
26 if  [[ ! ${mapfail} ]] ; then
27         echo $tdelta > ~/.xonotic-map-compiler-autobuild/${m##*/} # save time in ~/.xonotic-map-compiler-autobuild/mapname
28 fi