@@ -26,9 +26,16 @@ func (m Map) TranslateScale(x, y float64) (float64, float64) {
2626 return x / m .Scale , y / m .Scale
2727}
2828
29+ // MapNameToMap translates a map name to a Map.
30+ var MapNameToMap = make (map [string ]Map )
31+
2932// makeMap creates a map stuct initialized with the given parameters.
3033func 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
3239}
3340
3441// Pre-defined map translations.
4451 MapDeOverpass = makeMap ("de_overpass" , - 4831 , 1781 , 5.2 )
4552 MapDeTrain = makeMap ("de_train" , - 2477 , 2392 , 4.7 )
4653 MapDeVertigo = makeMap ("de_vertigo" , - 3168 , 1762 , 4 )
54+ MapCsAgency = makeMap ("cs_agency" , - 2947 , 2492 , 5 )
55+ MapCsOffice = makeMap ("cs_office" , - 1838 , 1858 , 4.1 )
4756)
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