aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/map/map.rc
blob: eaa75c91afa4a8c98e09f6aebb94def00989626b (plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/rc

rfork en

# F FEATUREs, M map files, A other arguments
FEATURE=no

if (~ $MAPPROG '')
	MAPPROG=/bin/aux/mapd

if (~ $MAPDIR '')
	MAPDIR=/lib/map

F=(); M=(); A=();
for (i) {
	switch ($FEATURE) {
	case no
		switch ($i) {
		case -f
			FEATURE=yes 
			F=($F)
		case *
			A=($A $i)
		}
	case yes
		switch ($i) {
		case -f
		case -*
			A=($A $i)
			FEATURE=no
		case riv*2
			F=($F 201 202)
		case riv*3
			F=($F 201 202 203)
		case riv*4
			F=($F 201 202 203 204)
		case riv*
			F=($F 201)
		case iriv*2
			F=($F 206 207)
		case iriv*[34]
			F=($F 206 207 208)
		case iriv*
			F=($F 206)
		case coast*2 shore*2 lake*2
			F=($F 102)
		case coast*3 shore*3 lake*3
			F=($F 102 103)
		case coast*4 shore*4 lake*4
			F=($F 102 103 104)
		case coast* shore* lake*
		case ilake*[234] ishore*[234]
			F=($F 106 107)
		case ilake* ishore*
			F=($F 106)
		case reef*
			F=($F 108)
		case canal*2
			F=($F 210 211)
		case canal*[34]
			F=($F 210 211 212)
		case canal*
			F=($F 210)
		case glacier*
			F=($F 115)
		case state* province*
			F=($F 401)
		case countr*2
			F=($F 301 302)
		case countr*[34]
			F=($F 301 302 303)
		case countr*
			F=($F 301)
		case salt*[234]
			F=($F 109 110)
		case salt*
			F=($F 109)
		case ice*[234] shel*[234]
			F=($F 113 114)
		case ice* shel*
			F=($F 113)
		case *
			echo map: unknown feature $i >[1=2]
			exits "unknown feature"
		}
	}
}

for (j in $F) {
	if (test -r $MAPDIR/$j)
		M=($M $MAPDIR/$j)
}

if (~ $F ?*) {
	if (test -r $MAPDIR/101)
		M=(101 $M)
	M=(-m $M)
}

if (~ $MAP '')
	MAP=world

MAP=$MAP MAPDIR=$MAPDIR $MAPPROG $A $M