@@ -106,9 +106,9 @@ fn building_icons<'a>(rc: &'a RenderContext, city: &'a City) -> IconActionVec<'a
106
106
return vec ! [ ] ;
107
107
}
108
108
let owner = rc. shown_player ;
109
- building_names ( )
109
+ Building :: all ( )
110
110
. iter ( )
111
- . filter_map ( |( b , _ ) | {
111
+ . filter_map ( |b | {
112
112
if city. can_construct ( * b, owner, rc. game ) {
113
113
Some ( * b)
114
114
} else {
@@ -117,7 +117,7 @@ fn building_icons<'a>(rc: &'a RenderContext, city: &'a City) -> IconActionVec<'a
117
117
} )
118
118
. flat_map ( |b| new_building_positions ( b, rc, city) )
119
119
. map ( |( b, pos) | {
120
- let name = building_name ( b ) ;
120
+ let name = b . name ( ) ;
121
121
let tooltip = format ! (
122
122
"Built {}{} for {}" ,
123
123
name,
@@ -216,13 +216,9 @@ pub fn city_labels(game: &Game, city: &City) -> Vec<String> {
216
216
. filter_map ( |( b, o) | {
217
217
o. as_ref ( ) . map ( |o| {
218
218
if city. player_index == * o {
219
- building_name ( * b ) . to_string ( )
219
+ b . name ( ) . to_string ( )
220
220
} else {
221
- format ! (
222
- "{} (owned by {})" ,
223
- building_name( * b) ,
224
- game. get_player( * o) . get_name( )
225
- )
221
+ format ! ( "{} (owned by {})" , b. name( ) , game. get_player( * o) . get_name( ) )
226
222
}
227
223
} )
228
224
} )
@@ -296,7 +292,7 @@ pub fn draw_city(rc: &RenderContext, city: &City) {
296
292
let tooltip = if matches ! ( state. active_dialog, ActiveDialog :: CulturalInfluence ) {
297
293
""
298
294
} else {
299
- building_name ( * b )
295
+ b . name ( )
300
296
} ;
301
297
draw_scaled_icon (
302
298
rc,
@@ -322,22 +318,3 @@ pub fn building_position(city: &City, center: Point, i: usize, building: Buildin
322
318
hex_ui:: rotate_around ( center, 25.0 , 90 * i)
323
319
}
324
320
}
325
-
326
- pub fn building_name ( b : Building ) -> & ' static str {
327
- building_names ( )
328
- . iter ( )
329
- . find_map ( |( b2, n) | if & b == b2 { Some ( n) } else { None } )
330
- . unwrap ( )
331
- }
332
-
333
- fn building_names ( ) -> [ ( Building , & ' static str ) ; 7 ] {
334
- [
335
- ( Building :: Academy , "Academy" ) ,
336
- ( Building :: Market , "Market" ) ,
337
- ( Building :: Obelisk , "Obelisk" ) ,
338
- ( Building :: Observatory , "Observatory" ) ,
339
- ( Building :: Fortress , "Fortress" ) ,
340
- ( Building :: Port , "Port" ) ,
341
- ( Building :: Temple , "Temple" ) ,
342
- ]
343
- }
0 commit comments