Skip to main content
Verticopolis engine

verticopolis_engine/catalog/
build.rs

1use super::*;
2use crate::crowd::metro_train;
3
4/// The catalog for `mode`.
5pub fn catalog(mode: GameMode) -> Catalog {
6    Catalog {
7        version: CATALOG_VERSION,
8        mode: mode.as_str(),
9        world: World {
10            lot_width: LOT_WIDTH,
11            min_floor: MIN_FLOOR,
12            max_floor: MAX_FLOOR,
13            ground_floor: 1,
14            ground_floor_structure: ground_floor_structure_kind(Kind::Floor, 1).as_str(),
15            lobby_interval: LOBBY_INTERVAL,
16            metro_train: MetroTrain {
17                first_hour: metro_train::FIRST_HOUR,
18                last_hour: metro_train::LAST_HOUR,
19                leg_minutes: metro_train::LEG_MINUTES,
20                dwell_minutes: metro_train::DWELL_MINUTES,
21                run_minutes: metro_train::RUN_MINUTES,
22            },
23        },
24        economy: Economy {
25            starting_money: STARTING_MONEY,
26            add_car_cost: ADD_CAR_COST,
27            car_resale_refund: car_resale_refund(),
28            transport_floor_cost: TRANSPORT_FLOOR_COST,
29            calendars: calendars_for(mode),
30            maintenance_per_car_monthly: MAINTENANCE_PER_CAR_MONTHLY,
31            overhead_per_unit_monthly: mode.operating_overhead_per_unit(),
32            condo_hold_tax_rate: mode.condo_hold_tax_rate(),
33            nightclub_dj_monthly: NIGHTCLUB_DJ_MONTHLY,
34            garbage_collect_hour: GARBAGE_COLLECT_HOUR,
35            exterminator: mode
36                .infestation_recovery()
37                .map(|(callout_fee, per_room_fee)| ExterminatorFees {
38                    callout_fee,
39                    per_room_fee,
40                }),
41            films: mode.films().offers,
42            film_rebooks: mode.films().rebooks,
43            film_rebook_default: mode.films().rebook_default,
44            cinema_screens: mode.cinema_screens(),
45            ticket_prices: mode.ticket_prices(),
46            ticket_price_default: mode.ticket_price_default(),
47            auto_bridge_toggleable: mode.bridging_toggleable(),
48        },
49        rules: Rules {
50            variant_households: mode.variant_households(),
51            preview_names_refusal: mode.preview_names_refusal(),
52            schedule_assist: mode.schedule_assist(),
53            builds_while_paused: mode.builds_while_paused(),
54            exports_to_1994: mode.exports_to_1994(),
55            quotes_lobby_distance: mode.quotes_lobby_distance(),
56            tall_sky_lobbies: mode.raises_sky_lobbies(),
57            decorative_passers_by: mode.shows_passers_by(),
58            shaded_look: mode.shaded_look(),
59            venue_flights: mode.winds_venue_flights(),
60            express_stops_on_15th_floors: mode.express_stops_on_15th_floors(),
61            fed_up_wait: crate::crowd::STRESS_WAIT,
62            max_lobby_height: crate::facilities::MAX_LOBBY_HEIGHT,
63        },
64        pools: keyed_pools(mode)
65            .map(|(key, p)| PoolEntry {
66                key,
67                label: p.label,
68                cap: p.cap,
69                kinds: p.kinds.iter().map(|k| k.as_str()).collect(),
70            })
71            .collect(),
72        facilities: FACILITIES
73            .iter()
74            .map(|f| facility_entry(mode, f.kind))
75            .collect(),
76    }
77}
78
79fn facility_entry(mode: GameMode, kind: Kind) -> FacilityEntry {
80    let f = kind.facility();
81    let transport = kind.is_transport();
82    FacilityEntry {
83        key: f.key,
84        name: f.name,
85        category: f.category.as_str(),
86        width: f.width,
87        floors: kind.floors(),
88        cost: f.cost,
89        pays_for_floor: pays_for_floor(kind),
90        min_star: f.min_star,
91        population: f.population,
92        max_household: kind.has_household().then_some(MAX_HOUSEHOLD),
93        attendance: f.attendance,
94        modern_only: f.modern_only,
95        transport,
96        staff_only: f.staff_only,
97        basement: f.basement,
98        no_basement: no_basement(kind),
99        available: f.available_in(mode),
100        build_minutes: if transport { 0.0 } else { kind.build_minutes() },
101        resale_refund: kind.resale_refund(),
102        build_cap: build_cap_in(mode, kind),
103        pool: pool_key(mode, kind),
104        max_span: transport.then(|| kind.max_span()),
105        fixed_span: kind.is_fixed_span(),
106        max_cars: kind.is_elevator().then(|| kind.max_cars()),
107        car_capacity: transport.then(|| kind.car_capacity()),
108        subtypes: kind.subtype_list().map(|l| l.to_vec()),
109        rent: rent_for(mode, kind),
110        daily_income: commercial_daily_income(mode, kind),
111        spend_per_customer: catalog_spend_per_customer(mode, kind),
112        upkeep_monthly: service_maintenance_monthly(kind),
113        open_hours: kind
114            .has_business_hours()
115            .then(|| (0..24).map(|hour| kind.is_open_at(hour)).collect()),
116        own_household: kind.has_household(),
117        commercial: kind.is_commercial(),
118        hotel: kind.is_hotel(),
119        lease_amenity: kind.is_lease_amenity(),
120        unmet_demand: kind.is_unmet_demand_kind(),
121        halo: halo::halo_entry(mode, kind),
122        noise: noise::noise_entries(mode, kind),
123    }
124}