@@ -26,9 +26,16 @@ func (m Map) TranslateScale(x, y float64) (float64, float64) {
26
26
return x / m .Scale , y / m .Scale
27
27
}
28
28
29
+ // MapNameToMap translates a map name to a Map.
30
+ var MapNameToMap = make (map [string ]Map )
31
+
29
32
// makeMap creates a map stuct initialized with the given parameters.
30
33
func makeMap (name string , x , y , scale float64 ) Map {
31
- return Map {Name : name , PZero : r2.Point {X : x , Y : y }, Scale : scale }
34
+ m := Map {Name : name , PZero : r2.Point {X : x , Y : y }, Scale : scale }
35
+
36
+ MapNameToMap [name ] = m
37
+
38
+ return m
32
39
}
33
40
34
41
// Pre-defined map translations.
44
51
MapDeOverpass = makeMap ("de_overpass" , - 4831 , 1781 , 5.2 )
45
52
MapDeTrain = makeMap ("de_train" , - 2477 , 2392 , 4.7 )
46
53
MapDeVertigo = makeMap ("de_vertigo" , - 3168 , 1762 , 4 )
54
+ MapCsAgency = makeMap ("cs_agency" , - 2947 , 2492 , 5 )
55
+ MapCsOffice = makeMap ("cs_office" , - 1838 , 1858 , 4.1 )
47
56
)
48
-
49
- // MapNameToMap translates a map name to a Map.
50
- var MapNameToMap = map [string ]Map {
51
- "de_ancient" : MapDeAncient ,
52
- "de_cache" : MapDeCache ,
53
- "de_canals" : MapDeCanals ,
54
- "de_cbble" : MapDeCbble ,
55
- "de_dust2" : MapDeDust2 ,
56
- "de_inferno" : MapDeInferno ,
57
- "de_mirage" : MapDeMirage ,
58
- "de_nuke" : MapDeNuke ,
59
- "de_overpass" : MapDeOverpass ,
60
- "de_train" : MapDeTrain ,
61
- "de_vertigo" : MapDeVertigo ,
62
- }
0 commit comments