#!/bin/sh # quick hack to copy map names from crossire to deliantra maps SRC=/root/cvs/crossfire/maps DST=/root/src/deliantra/maps cd "$SRC" || exit 1 find . -name .svn -prune -o -type f -print | while read map; do [ -f "$DST"/"$map.map" ] || continue [ "$(head -1 "$map" 2>/dev/null)" = "arch map" ] || continue name=$(< "$map" head -2 | tail -1) case "$name" in "name "* ) ;; * ) continue ;; esac case "$name" in "name world"* ) continue ;; esac ( <"$DST/$map.map" head -4 | grep -v "^name " echo $name <"$DST/$map.map" tail -n+4 ) >"$DST/$map.map~" if cmp -s "$DST/$map.map~" "$DST/$map.map"; then rm "$DST/$map.map~" else echo $map $name mv "$DST/$map.map~" "$DST/$map.map" cfmap-normalize "$DST/$map.map" fi done