1use std::sync::LazyLock;
2
3use crate::helpers::TigerHashMap;
4use crate::scopes::{ArgumentValue, Scopes};
5
6#[inline]
7pub fn scope_to_scope(name: &str) -> Option<(Scopes, Scopes)> {
8 SCOPE_TO_SCOPE_MAP.get(name).copied()
9}
10
11static SCOPE_TO_SCOPE_MAP: LazyLock<TigerHashMap<&'static str, (Scopes, Scopes)>> =
12 LazyLock::new(|| {
13 let mut hash = TigerHashMap::default();
14 for (from, s, to) in SCOPE_TO_SCOPE.iter().copied() {
15 hash.insert(s, (from, to));
16 }
17 hash
18 });
19
20const SCOPE_TO_SCOPE: &[(Scopes, &str, Scopes)] = &[
24 (Scopes::Treaty.union(Scopes::TreatyOptions), "amended_treaty", Scopes::Treaty),
25 (Scopes::Country, "army_size", Scopes::Value),
26 (Scopes::Country, "army_size_including_conscripts", Scopes::Value),
27 (Scopes::Country, "army_size_including_raised_conscripts", Scopes::Value),
28 (Scopes::Amendment, "attached_law", Scopes::Law),
29 (Scopes::Battle, "attacker_side", Scopes::BattleSide),
30 (Scopes::War, "attacker_warleader", Scopes::Country),
31 (Scopes::Country.union(Scopes::State), "average_expected_sol", Scopes::Value),
32 (Scopes::Character.union(Scopes::InterestGroup), "average_progressiveness", Scopes::Value),
33 (Scopes::Country.union(Scopes::State), "average_sol", Scopes::Value),
34 (Scopes::Goods, "base_price", Scopes::Value),
35 (Scopes::BattleSide, "battle", Scopes::Battle),
36 (Scopes::Treaty.union(Scopes::TreatyOptions), "binding_period", Scopes::Value),
37 (Scopes::NewCombatUnit, "building", Scopes::Building),
38 (Scopes::Country, "building_levels", Scopes::Value),
39 (Scopes::Country, "cached_ai_coastal_population", Scopes::Value),
40 (Scopes::Country, "cached_ai_incorporated_coastal_population", Scopes::Value),
41 (Scopes::Country, "cached_ai_incorporated_population", Scopes::Value),
42 (Scopes::Country, "cached_ai_overseas_subject_population", Scopes::Value),
43 (Scopes::Country, "cached_ai_subject_population", Scopes::Value),
44 (Scopes::Country, "cached_ai_total_population", Scopes::Value),
45 (Scopes::Country, "cached_ai_unincorporated_coastal_population", Scopes::Value),
46 (Scopes::Country, "cached_ai_unincorporated_population", Scopes::Value),
47 (Scopes::Country, "capital", Scopes::State),
48 (Scopes::PoliticalMovement, "civil_war", Scopes::CivilWar),
49 (Scopes::Country, "civil_war_origin_country", Scopes::Country),
50 (Scopes::Country, "colonial_growth_per_colony", Scopes::Value),
51 (Scopes::Province, "combat_width", Scopes::Value),
52 (Scopes::Character, "command_limit_num_units", Scopes::Value),
53 (Scopes::MilitaryFormation, "commander", Scopes::Character),
54 (Scopes::Character, "commander_military_formation", Scopes::MilitaryFormation),
55 (Scopes::Province.union(Scopes::State), "controller", Scopes::Country),
56 (Scopes::MilitaryFormation.union(Scopes::Ship), "country", Scopes::Country),
57 (Scopes::Country, "country_definition", Scopes::CountryDefinition),
58 (Scopes::Country, "credit", Scopes::Value),
59 (
60 Scopes::Character
61 .union(Scopes::NewCombatUnit)
62 .union(Scopes::PoliticalMovement)
63 .union(Scopes::Pop),
64 "culture",
65 Scopes::Culture,
66 ),
67 (Scopes::MilitaryFormation, "current_hq", Scopes::Hq),
68 (Scopes::Law, "currently_active_law_in_group", Scopes::Law),
69 (Scopes::Country, "currently_enacting_law", Scopes::Law),
70 (Scopes::Battle, "defender_side", Scopes::BattleSide),
71 (Scopes::War, "defender_warleader", Scopes::Country),
72 (Scopes::NewCombatUnit, "defense", Scopes::Value),
73 (Scopes::NewCombatUnit, "demoralized", Scopes::Value),
74 (Scopes::MilitaryFormation, "detection", Scopes::Value),
75 (Scopes::Country, "diplomatic_pact_expense_ratio", Scopes::Value),
76 (Scopes::War, "diplomatic_play", Scopes::DiplomaticPlay),
77 (Scopes::Treaty, "enforced_on_country", Scopes::Country),
78 (Scopes::Treaty, "enforcer_country", Scopes::Country),
79 (Scopes::Company, "executive", Scopes::Character),
80 (
81 Scopes::DiplomaticPact
82 .union(Scopes::TreatyArticle)
83 .union(Scopes::TreatyOptions)
84 .union(Scopes::TreatyArticleOptions)
85 .union(Scopes::Treaty),
86 "first_country",
87 Scopes::Country,
88 ),
89 (Scopes::Country, "flagship", Scopes::Ship),
90 (
91 Scopes::Battle
92 .union(Scopes::Character)
93 .union(Scopes::Province)
94 .union(Scopes::Invasion)
95 .union(Scopes::MilitaryFormation),
96 "front",
97 Scopes::Front,
98 ),
99 (Scopes::Front, "front_length", Scopes::Value),
100 (
101 Scopes::Country.union(Scopes::State).union(Scopes::Market).union(Scopes::StrategicRegion),
102 "gdp",
103 Scopes::Value,
104 ),
105 (Scopes::None, "global_gdp", Scopes::Value),
106 (Scopes::JournalEntry, "goal_value", Scopes::Value),
107 (Scopes::MarketGoods.union(Scopes::StateGoods), "goods", Scopes::Goods),
108 (Scopes::Country.union(Scopes::PoliticalMovement), "government_size", Scopes::Value),
109 (Scopes::Building.union(Scopes::BuildingType), "group", Scopes::BuildingGroup),
110 (Scopes::Country, "heir", Scopes::Character),
111 (Scopes::Character.union(Scopes::Pop), "home_country", Scopes::Country),
112 (Scopes::MilitaryFormation, "home_hq", Scopes::Hq),
113 (Scopes::PowerBloc, "identity", Scopes::PowerBlocIdentity),
114 (Scopes::Character, "ideology", Scopes::Ideology),
115 (Scopes::Country, "imposed_law", Scopes::Law),
116 (Scopes::Country.union(Scopes::Law), "imposer_of_law", Scopes::Country),
117 (Scopes::Country, "income", Scopes::Value),
118 (Scopes::Country, "income_transfer_expenses", Scopes::Value),
119 (Scopes::Country, "income_transfer_relative_expenses", Scopes::Value),
120 (Scopes::Country, "infamy", Scopes::Value),
121 (Scopes::DiplomaticPlay, "initiator", Scopes::Country),
122 (
123 Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions),
124 "input_building_type",
125 Scopes::BuildingType,
126 ),
127 (Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions), "input_company", Scopes::Company),
128 (Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions), "input_country", Scopes::Country),
129 (Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions), "input_goods", Scopes::Goods),
130 (Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions), "input_law", Scopes::LawType),
131 (Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions), "input_quantity", Scopes::Value),
132 (Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions), "input_ship", Scopes::Ship),
133 (Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions), "input_state", Scopes::State),
134 (
135 Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions),
136 "input_strategic_region",
137 Scopes::StrategicRegion,
138 ),
139 (Scopes::Character, "interest_group", Scopes::InterestGroup),
140 (Scopes::Character, "interest_group_type", Scopes::InterestGroupType),
141 (Scopes::Front, "invasion", Scopes::Invasion),
142 (Scopes::Invasion, "invasion_attacker", Scopes::Country),
143 (Scopes::Invasion, "invasion_defender", Scopes::Country),
144 (Scopes::Institution, "investment", Scopes::Value),
145 (Scopes::Institution, "investment_max", Scopes::Value),
146 (Scopes::Country, "investment_pool_income", Scopes::Value),
147 (Scopes::None, "is_setup", Scopes::Value),
148 (Scopes::None, "je_tutorial", Scopes::JournalEntry),
149 (Scopes::Province.union(Scopes::State), "land_controller_hq", Scopes::Hq),
150 (Scopes::Province.union(Scopes::State), "land_hq", Scopes::Hq),
151 (Scopes::MarketGoods, "largest_exporting_market", Scopes::Market),
152 (Scopes::MarketGoods, "largest_importing_market", Scopes::Market),
153 (Scopes::Law, "law_type", Scopes::LawType),
154 (Scopes::InterestGroup, "leader", Scopes::Character),
155 (Scopes::Country, "legitimacy", Scopes::Value),
156 (Scopes::Building, "level", Scopes::Value),
157 (Scopes::Building, "level_after_queued_constructions", Scopes::Value),
158 (Scopes::NewCombatUnit, "manpower", Scopes::Value),
159 (
160 Scopes::Country
161 .union(Scopes::Building)
162 .union(Scopes::Market)
163 .union(Scopes::MarketGoods)
164 .union(Scopes::Province)
165 .union(Scopes::State)
166 .union(Scopes::StateGoods)
167 .union(Scopes::StateRegion),
168 "market",
169 Scopes::Market,
170 ),
171 (Scopes::Country, "market_capital", Scopes::State),
172 (Scopes::MarketGoods, "market_export_cap", Scopes::Value),
173 (Scopes::MarketGoods, "market_import_cap", Scopes::Value),
174 (Scopes::State, "mass_migration_culture", Scopes::Culture),
175 (Scopes::Country.union(Scopes::State), "migration_pull", Scopes::Value),
176 (Scopes::Country, "military_expenses", Scopes::Value),
177 (Scopes::Country, "military_expenses_share", Scopes::Value),
178 (Scopes::NewCombatUnit, "mobilization", Scopes::Value),
179 (Scopes::Party, "momentum", Scopes::Value),
180 (Scopes::NewCombatUnit, "morale", Scopes::Value),
181 (Scopes::PoliticalMovement, "most_desired_law", Scopes::LawType),
182 (Scopes::Culture, "national_awakening_state_region", Scopes::StateRegion),
183 (Scopes::Country, "naval_combat_power", Scopes::Value),
184 (Scopes::Province, "naval_controller_hq", Scopes::Hq),
185 (Scopes::Country, "naval_hostility_average_damage_dealt", Scopes::Value),
186 (Scopes::Province, "naval_hq", Scopes::Hq),
187 (Scopes::Country, "naval_vulnerability", Scopes::Value),
188 (Scopes::Country, "navy_size", Scopes::Value),
189 (Scopes::None, "no", Scopes::Bool),
190 (Scopes::None, "NO", Scopes::Bool),
191 (Scopes::Country, "num_active_interests", Scopes::Value),
192 (Scopes::Country, "num_active_natural_interests", Scopes::Value),
193 (Scopes::Country, "num_active_plays", Scopes::Value),
194 (
195 Scopes::Country.union(Scopes::Character).union(Scopes::MilitaryFormation),
196 "num_active_ships",
197 Scopes::Value,
198 ),
199 (
200 Scopes::Country.union(Scopes::Character).union(Scopes::MilitaryFormation),
201 "num_active_ships_in_battle",
202 Scopes::Value,
203 ),
204 (
205 Scopes::Country.union(Scopes::Character).union(Scopes::MilitaryFormation),
206 "num_active_ships_not_in_battle",
207 Scopes::Value,
208 ),
209 (Scopes::Country, "num_admirals", Scopes::Value),
210 (Scopes::Country, "num_alliances", Scopes::Value),
211 (Scopes::Character, "num_battalions", Scopes::Value),
212 (Scopes::Country, "num_characters", Scopes::Value),
213 (Scopes::Country, "num_colony_projects", Scopes::Value),
214 (Scopes::MilitaryFormation, "num_commanderless_units", Scopes::Value),
215 (Scopes::Country, "num_commanders", Scopes::Value),
216 (Scopes::Country, "num_defensive_pacts", Scopes::Value),
217 (Scopes::Hq, "num_garrison_units", Scopes::Value),
218 (Scopes::Country, "num_generals", Scopes::Value),
219 (Scopes::Country, "num_income_transfer_pacts", Scopes::Value),
220 (Scopes::Country, "num_income_transfer_treaty_articles", Scopes::Value),
221 (Scopes::Country, "num_income_transfers", Scopes::Value),
222 (Scopes::Country, "num_incorporated_states", Scopes::Value),
223 (Scopes::Country, "num_interests", Scopes::Value),
224 (Scopes::PowerBloc, "num_mandates", Scopes::Value),
225 (Scopes::Character, "num_mobilized_battalions", Scopes::Value),
226 (Scopes::Country, "num_natural_interests", Scopes::Value),
227 (
228 Scopes::Country.union(Scopes::Character).union(Scopes::MilitaryFormation),
229 "num_non_destroyed_ships",
230 Scopes::Value,
231 ),
232 (
233 Scopes::Country.union(Scopes::Character).union(Scopes::MilitaryFormation),
234 "num_non_destroyed_ships_in_battle",
235 Scopes::Value,
236 ),
237 (
238 Scopes::Country.union(Scopes::Character).union(Scopes::MilitaryFormation),
239 "num_non_destroyed_ships_not_in_battle",
240 Scopes::Value,
241 ),
242 (Scopes::Country, "num_obligations_earned", Scopes::Value),
243 (Scopes::Country, "num_pending_events", Scopes::Value),
244 (Scopes::Country, "num_politicians", Scopes::Value),
245 (Scopes::Country, "num_positive_relations", Scopes::Value),
246 (Scopes::Front.union(Scopes::State).union(Scopes::StateRegion), "num_provinces", Scopes::Value),
247 (Scopes::Country, "num_queued_constructions", Scopes::Value),
248 (Scopes::Country, "num_queued_government_constructions", Scopes::Value),
249 (Scopes::Country, "num_queued_private_constructions", Scopes::Value),
250 (Scopes::Country, "num_rivals", Scopes::Value),
251 (Scopes::Country, "num_ruling_igs", Scopes::Value),
252 (
253 Scopes::Country.union(Scopes::Character).union(Scopes::MilitaryFormation),
254 "num_ships",
255 Scopes::Value,
256 ),
257 (
258 Scopes::Country.union(Scopes::Character).union(Scopes::MilitaryFormation),
259 "num_ships_in_battle",
260 Scopes::Value,
261 ),
262 (
263 Scopes::Country.union(Scopes::Character).union(Scopes::MilitaryFormation),
264 "num_ships_not_in_battle",
265 Scopes::Value,
266 ),
267 (Scopes::Country, "num_states", Scopes::Value),
268 (Scopes::Country, "num_unincorporated_states", Scopes::Value),
269 (Scopes::Character.union(Scopes::MilitaryFormation), "num_units", Scopes::Value),
270 (Scopes::Character.union(Scopes::MilitaryFormation), "num_units_in_battle", Scopes::Value),
271 (Scopes::Character.union(Scopes::MilitaryFormation), "num_units_not_in_battle", Scopes::Value),
272 (Scopes::Character, "num_units_share", Scopes::Value),
273 (Scopes::State, "num_world_market_hub_trade_center_levels", Scopes::Value),
274 (Scopes::NewCombatUnit, "offense", Scopes::Value),
275 (Scopes::Character, "opposing_commander", Scopes::Character),
276 (Scopes::BattleSide, "opposite_battle_side", Scopes::BattleSide),
277 (Scopes::Country, "overlord", Scopes::Country),
278 (
279 Scopes::Country
280 .union(Scopes::Building)
281 .union(Scopes::Character)
282 .union(Scopes::NewCombatUnit)
283 .union(Scopes::Company)
284 .union(Scopes::Decree)
285 .union(Scopes::Institution)
286 .union(Scopes::InterestMarker)
287 .union(Scopes::InterestGroup)
288 .union(Scopes::JournalEntry)
289 .union(Scopes::Law)
290 .union(Scopes::Market)
291 .union(Scopes::MarketGoods)
292 .union(Scopes::MilitaryFormation)
293 .union(Scopes::PoliticalMovement)
294 .union(Scopes::Pop)
295 .union(Scopes::Province)
296 .union(Scopes::Ship)
297 .union(Scopes::State),
298 "owner",
299 Scopes::Country,
300 ),
301 (Scopes::Country, "owning_company", Scopes::Company),
302 (Scopes::Amendment, "parent_law_type", Scopes::LawType),
303 (Scopes::Market, "participants", Scopes::Value),
304 (Scopes::InterestGroup, "party", Scopes::Party),
305 (Scopes::None, "player", Scopes::Country), (Scopes::DiplomaticRelations, "player_owed_obligation_days_left", Scopes::Value),
307 (Scopes::Character.union(Scopes::CivilWar), "political_movement", Scopes::PoliticalMovement),
308 (Scopes::Pop, "pop_weight_modifier_scale", Scopes::Value),
309 (Scopes::Character, "popularity", Scopes::Value),
310 (Scopes::State, "population_below_expected_sol", Scopes::Value),
311 (Scopes::Country, "power_bloc", Scopes::PowerBloc),
312 (Scopes::PowerBloc, "power_bloc_leader", Scopes::Country),
313 (
314 Scopes::NewCombatUnit.union(Scopes::MilitaryFormation).union(Scopes::Ship),
315 "power_projection",
316 Scopes::Value,
317 ),
318 (Scopes::PowerBloc, "power_struggle_contender", Scopes::Country),
319 (Scopes::Country, "principal", Scopes::Value),
320 (Scopes::Company, "prosperity", Scopes::Value),
321 (Scopes::BattleSide, "province", Scopes::Province),
322 (
323 Scopes::Building
324 .union(Scopes::DiplomaticPlay)
325 .union(Scopes::Hq)
326 .union(Scopes::InterestMarker)
327 .union(Scopes::Province)
328 .union(Scopes::State)
329 .union(Scopes::StateRegion),
330 "region",
331 Scopes::StrategicRegion,
332 ),
333 (
334 Scopes::Country
335 .union(Scopes::Character)
336 .union(Scopes::CountryDefinition)
337 .union(Scopes::PoliticalMovement)
338 .union(Scopes::Pop),
339 "religion",
340 Scopes::Religion,
341 ),
342 (Scopes::TreatyOptions.union(Scopes::Treaty), "remaining_binding_period", Scopes::Value),
343 (Scopes::BuildingType, "required_construction", Scopes::Value),
344 (Scopes::Country, "ruler", Scopes::Character),
345 (Scopes::DiplomaticRelations, "scope_relations", Scopes::Value),
346 (Scopes::DiplomaticRelations, "scope_tension", Scopes::Value),
347 (Scopes::MilitaryFormation, "screening", Scopes::Value),
348 (
349 Scopes::DiplomaticPact
350 .union(Scopes::TreatyArticle)
351 .union(Scopes::TreatyOptions)
352 .union(Scopes::TreatyArticleOptions)
353 .union(Scopes::Treaty),
354 "second_country",
355 Scopes::Country,
356 ),
357 (Scopes::Ship, "ship_fleet", Scopes::MilitaryFormation),
358 (Scopes::Ship, "ship_group", Scopes::ShipGroup),
359 (Scopes::TreatyArticle, "shipping_lane", Scopes::ShippingLanes),
360 (Scopes::BuildingType, "slaves_role", Scopes::PopType),
361 (Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions), "source_country", Scopes::Country),
362 (Scopes::Amendment, "sponsor", Scopes::InterestGroup),
363 (
364 Scopes::Building.union(Scopes::Market).union(Scopes::Pop).union(Scopes::Province),
365 "state",
366 Scopes::State,
367 ),
368 (Scopes::State, "state_region", Scopes::StateRegion),
369 (
370 Scopes::DiplomaticPlay
371 .union(Scopes::DiplomaticCatalyst)
372 .union(Scopes::PoliticalLobby)
373 .union(Scopes::JournalEntry),
374 "target",
375 Scopes::all(),
376 ), (Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions), "target_country", Scopes::Country),
378 (Scopes::Country, "technology_being_researched", Scopes::Technology),
379 (Scopes::Country, "techs_researched", Scopes::Value),
380 (Scopes::BattleSide.union(Scopes::State), "theater", Scopes::Theater),
381 (Scopes::Country, "top_overlord", Scopes::Country),
382 (Scopes::Country, "total_export_value", Scopes::Value),
383 (Scopes::Country, "total_import_value", Scopes::Value),
384 (Scopes::Country, "total_marine_capacity", Scopes::Value),
385 (Scopes::DiplomaticRelations, "total_pirated_trade_value", Scopes::Value),
386 (Scopes::Country, "total_trade_value", Scopes::Value),
387 (Scopes::Market, "trade_center", Scopes::State),
388 (Scopes::Building, "training_rate", Scopes::Value),
389 (Scopes::TreatyArticle, "treaty", Scopes::Treaty),
390 (Scopes::MarketGoods, "treaty_exports", Scopes::Value),
391 (Scopes::MarketGoods, "treaty_imports", Scopes::Value),
392 (
394 Scopes::Building
395 .union(Scopes::Company)
396 .union(Scopes::DiplomaticPlay)
397 .union(Scopes::DiplomaticCatalyst)
398 .union(Scopes::PoliticalLobby)
399 .union(Scopes::Institution)
400 .union(Scopes::InterestGroup)
401 .union(Scopes::Law)
402 .union(Scopes::PoliticalMovement)
403 .union(Scopes::Ship)
404 .union(Scopes::Strait)
405 .union(Scopes::HarvestCondition)
406 .union(Scopes::Amendment),
407 "type",
408 Scopes::BuildingType
409 .union(Scopes::CompanyType)
410 .union(Scopes::DiplomaticPlayType)
411 .union(Scopes::DiplomaticCatalystType)
412 .union(Scopes::PoliticalLobbyType)
413 .union(Scopes::InstitutionType)
414 .union(Scopes::InterestGroupType)
415 .union(Scopes::LawType)
416 .union(Scopes::PoliticalMovementType)
417 .union(Scopes::ShipType)
418 .union(Scopes::StraitType)
419 .union(Scopes::HarvestConditionType)
420 .union(Scopes::AmendmentType),
421 ),
422 (Scopes::MilitaryFormation, "visibility", Scopes::Value),
423 (Scopes::MilitaryFormation, "vulnerability", Scopes::Value),
424 (Scopes::DiplomaticPlay, "war", Scopes::War),
425 (Scopes::Company, "weekly_prosperity_change", Scopes::Value),
426 (Scopes::Pop, "workplace", Scopes::Building),
427 (Scopes::State, "world_market_hub", Scopes::State),
428 (Scopes::None, "yes", Scopes::Bool),
429 (Scopes::None, "YES", Scopes::Bool),
430];
431
432#[inline]
433pub fn scope_prefix(name: &str) -> Option<(Scopes, Scopes, ArgumentValue)> {
434 SCOPE_PREFIX_MAP.get(name).copied()
435}
436
437static SCOPE_PREFIX_MAP: LazyLock<TigerHashMap<&'static str, (Scopes, Scopes, ArgumentValue)>> =
438 LazyLock::new(|| {
439 let mut hash = TigerHashMap::default();
440 for (from, s, to, argument) in SCOPE_PREFIX.iter().copied() {
441 hash.insert(s, (from, to, argument));
442 }
443 hash
444 });
445
446const SCOPE_PREFIX: &[(Scopes, &str, Scopes, ArgumentValue)] = {
451 use crate::item::Item;
452 use ArgumentValue::*;
453 &[
454 (Scopes::Country, "active_law", Scopes::Law, Item(Item::LawGroup)),
455 (Scopes::Country, "ai_army_comparison", Scopes::Value, Scope(Scopes::Country)),
456 (Scopes::StrategicRegion, "ai_colonization_value", Scopes::Value, Scope(Scopes::Country)),
457 (Scopes::Country, "ai_gdp_comparison", Scopes::Value, Scope(Scopes::Country)),
458 (Scopes::Country, "ai_ideological_opinion", Scopes::Value, Scope(Scopes::Country)),
459 (Scopes::Country, "ai_navy_comparison", Scopes::Value, Scope(Scopes::Country)),
460 (Scopes::State, "ai_state_value", Scopes::Value, Scope(Scopes::Country)),
461 (Scopes::Country, "ai_subject_value", Scopes::Value, Scope(Scopes::Country)),
462 (Scopes::Country, "ai_transit_rights_value", Scopes::Value, Scope(Scopes::Country)),
463 (Scopes::MarketGoods, "ai_treaty_export_value", Scopes::Value, Scope(Scopes::Country)),
464 (Scopes::Country, "ai_treaty_fairness", Scopes::Value, Scope(Scopes::Country)),
465 (Scopes::MarketGoods, "ai_treaty_import_value", Scopes::Value, Scope(Scopes::Country)),
466 (Scopes::State, "ai_treaty_port_value", Scopes::Value, Scope(Scopes::Country)),
467 (Scopes::MarketGoods, "ai_treaty_trade_value", Scopes::Value, Scope(Scopes::Country)),
468 (Scopes::Country, "ai_treaty_value", Scopes::Value, Scope(Scopes::Country)),
469 (Scopes::None, "amendment_type", Scopes::AmendmentType, Item(Item::Amendment)),
470 (Scopes::None, "array_define", Scopes::Value, UncheckedValue),
471 (Scopes::Front, "average_defense", Scopes::Value, Scope(Scopes::Country)),
472 (Scopes::Front, "average_offense", Scopes::Value, Scope(Scopes::Country)),
473 (Scopes::State, "b", Scopes::Building, Item(Item::BuildingType)),
474 (Scopes::None, "bg", Scopes::BuildingGroup, Item(Item::BuildingGroup)),
475 (Scopes::None, "bt", Scopes::BuildingType, Item(Item::BuildingType)),
476 (Scopes::None, "c", Scopes::Country, Item(Item::Country)),
477 (
478 Scopes::None,
479 "catalyst_type",
480 Scopes::DiplomaticCatalystType,
481 Item(Item::DiplomaticCatalyst),
482 ),
483 (Scopes::None, "cd", Scopes::CountryDefinition, Item(Item::Country)),
484 (Scopes::Country, "company", Scopes::Company, Item(Item::CompanyType)),
485 (Scopes::None, "company_type", Scopes::CompanyType, Item(Item::CompanyType)),
486 (Scopes::None, "cu", Scopes::Culture, Item(Item::Culture)),
487 (Scopes::State, "decree_cost", Scopes::Value, Item(Item::Decree)),
488 (Scopes::None, "define", Scopes::Value, Item(Item::Define)),
489 (Scopes::None, "flag", Scopes::Flag, UncheckedValue),
490 (Scopes::None, "g", Scopes::Goods, Item(Item::Goods)),
491 (Scopes::Country, "get_ruler_for", Scopes::Character, Item(Item::TransferOfPower)),
492 (Scopes::None, "global_productivity", Scopes::Value, Scope(Scopes::Value)),
494 (Scopes::None, "global_var", Scopes::all(), UncheckedValue),
495 (
496 Scopes::None,
497 "harvest_condition_type",
498 Scopes::HarvestConditionType,
499 Item(Item::HarvestConditionType),
500 ),
501 (Scopes::None, "i", Scopes::Ideology, Item(Item::Ideology)),
502 (Scopes::None, "identity", Scopes::PowerBlocIdentity, Item(Item::PowerBlocIdentity)),
503 (Scopes::None, "ideology", Scopes::Ideology, Item(Item::Ideology)), (
505 Scopes::Country.union(Scopes::PoliticalMovement),
506 "ig",
507 Scopes::InterestGroup,
508 Item(Item::InterestGroup),
509 ),
510 (Scopes::None, "ig_trait", Scopes::InterestGroupTrait, Item(Item::InterestGroupTrait)),
511 (Scopes::None, "ig_type", Scopes::InterestGroupType, Item(Item::InterestGroup)),
512 (Scopes::None, "infamy_threshold", Scopes::Value, Item(Item::InfamyThreshold)),
513 (
514 Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions),
515 "input_market_goods",
516 Scopes::MarketGoods,
517 Scope(Scopes::Country),
518 ),
519 (Scopes::Country, "institution", Scopes::Institution, Item(Item::Institution)),
520 (Scopes::Country, "je", Scopes::JournalEntry, Item(Item::JournalEntry)),
521 (Scopes::None, "law_type", Scopes::LawType, Item(Item::LawType)),
522 (Scopes::None, "list_size", Scopes::Value, UncheckedValue),
523 (Scopes::Country, "lobby_foreign_anti_clout", Scopes::Value, Scope(Scopes::Country)),
524 (Scopes::Country, "lobby_foreign_pro_clout", Scopes::Value, Scope(Scopes::Country)),
525 (
526 Scopes::Country,
527 "lobby_in_government_foreign_anti_clout",
528 Scopes::Value,
529 Scope(Scopes::Country),
530 ),
531 (
532 Scopes::Country,
533 "lobby_in_government_foreign_pro_clout",
534 Scopes::Value,
535 Scope(Scopes::Country),
536 ),
537 (Scopes::InterestGroup, "lobby_join_weight", Scopes::Value, Scope(Scopes::PoliticalLobby)),
538 (Scopes::None, "lobby_type", Scopes::PoliticalLobbyType, Item(Item::PoliticalLobby)),
539 (Scopes::Country, "lobby_war_opposition", Scopes::Value, Scope(Scopes::Country)),
540 (Scopes::Country, "lobby_war_support", Scopes::Value, Scope(Scopes::Country)),
541 (Scopes::None, "local_var", Scopes::all(), UncheckedValue),
542 (Scopes::Market, "mg", Scopes::MarketGoods, Item(Item::Goods)),
543 (
544 Scopes::None,
545 "mobilization_option",
546 Scopes::MobilizationOption,
547 Item(Item::MobilizationOption),
548 ),
549 (
550 Scopes::Country
551 .union(Scopes::BattleSide)
552 .union(Scopes::Building)
553 .union(Scopes::Character)
554 .union(Scopes::InterestGroup)
555 .union(Scopes::Market)
556 .union(Scopes::PowerBloc)
557 .union(Scopes::State),
558 "modifier",
559 Scopes::Value.union(Scopes::Bool),
560 Modif,
561 ),
562 (
563 Scopes::None,
564 "movement_type",
565 Scopes::PoliticalMovementType,
566 Item(Item::PoliticalMovement),
567 ),
568 (Scopes::Country, "mutual_trade_value_with_country", Scopes::Value, Scope(Scopes::Country)),
569 (Scopes::Country, "naval_hostility_damage", Scopes::Value, Scope(Scopes::Country)),
570 (Scopes::State, "nf", Scopes::Decree, Item(Item::Decree)),
571 (Scopes::Province, "num_active_ships", Scopes::Value, Scope(Scopes::Country)),
572 (Scopes::Province, "num_active_ships_in_battle", Scopes::Value, Scope(Scopes::Country)),
573 (Scopes::Province, "num_active_ships_not_in_battle", Scopes::Value, Scope(Scopes::Country)),
574 (
575 Scopes::Country,
576 "num_alliances_and_defensive_pacts_with_allies",
577 Scopes::Value,
578 Scope(Scopes::Country),
579 ),
580 (
581 Scopes::Country,
582 "num_alliances_and_defensive_pacts_with_rivals",
583 Scopes::Value,
584 Scope(Scopes::Country),
585 ),
586 (Scopes::Front, "num_defending_battalions", Scopes::Value, Scope(Scopes::Country)),
587 (Scopes::Province, "num_non_destroyed_ships", Scopes::Value, Scope(Scopes::Country)),
588 (
589 Scopes::Province,
590 "num_non_destroyed_ships_in_battle",
591 Scopes::Value,
592 Scope(Scopes::Country),
593 ),
594 (
595 Scopes::Province,
596 "num_non_destroyed_ships_not_in_battle",
597 Scopes::Value,
598 Scope(Scopes::Country),
599 ),
600 (Scopes::Province, "num_ships", Scopes::Value, Scope(Scopes::Country)),
601 (Scopes::Province, "num_ships_in_battle", Scopes::Value, Scope(Scopes::Country)),
602 (Scopes::Province, "num_ships_not_in_battle", Scopes::Value, Scope(Scopes::Country)),
603 (
604 Scopes::Country.union(Scopes::MilitaryFormation),
605 "num_ships_of_group",
606 Scopes::Value,
607 Scope(Scopes::ShipGroup),
608 ),
609 (Scopes::Country, "num_pending_events", Scopes::Value, Item(Item::EventCategory)),
610 (Scopes::Country, "num_shared_rivals", Scopes::Value, Scope(Scopes::Country)),
611 (Scopes::Front, "num_total_battalions", Scopes::Value, Scope(Scopes::Country)),
612 (Scopes::Province, "num_units", Scopes::Value, Scope(Scopes::Country)),
613 (Scopes::Province, "num_units_in_battle", Scopes::Value, Scope(Scopes::Country)),
614 (Scopes::Province, "num_units_not_in_battle", Scopes::Value, Scope(Scopes::Country)),
615 (Scopes::None, "p", Scopes::Province, Item(Item::Province)),
616 (Scopes::Country, "pirated_trade_value_by", Scopes::Value, Scope(Scopes::Country)),
617 (Scopes::None, "play_type", Scopes::DiplomaticPlayType, Item(Item::DiplomaticPlay)),
618 (Scopes::None, "pop_type", Scopes::PopType, Item(Item::PopType)),
619 (Scopes::None, "principle", Scopes::PowerBlocPrinciple, Item(Item::Principle)),
620 (
621 Scopes::None,
622 "principle_group",
623 Scopes::PowerBlocPrincipleGroup,
624 Item(Item::PrincipleGroup),
625 ),
626 (Scopes::Country, "py", Scopes::Party, Item(Item::Party)),
627 (Scopes::None, "rank_value", Scopes::Value, Item(Item::CountryRank)),
628 (Scopes::StateRegion, "region_state", Scopes::State, Item(Item::Country)), (Scopes::None, "rel", Scopes::Religion, Item(Item::Religion)),
630 (Scopes::Country, "relations", Scopes::Value, Scope(Scopes::Country)),
631 (Scopes::Country, "relations_change_rate", Scopes::Value, Scope(Scopes::Country)),
632 (Scopes::None, "relations_threshold", Scopes::Value, Item(Item::RelationsThreshold)),
633 (Scopes::None, "s", Scopes::StateRegion, Item(Item::StateRegion)),
634 (Scopes::None, "scope", Scopes::all(), UncheckedValue),
635 (Scopes::State, "sg", Scopes::StateGoods, Item(Item::Goods)),
636 (Scopes::None, "ship_group", Scopes::ShipGroup, Item(Item::ShipGroup)),
637 (Scopes::None, "ship_type", Scopes::ShipType, Item(Item::ShipType)),
638 (Scopes::None, "sr", Scopes::StrategicRegion, Item(Item::StrategicRegion)),
639 (Scopes::Country, "strait_trade_importance_by", Scopes::Value, Scope(Scopes::Country)),
640 (Scopes::None, "strait_type", Scopes::StraitType, Item(Item::StraitDefinition)),
641 (Scopes::Country, "tension", Scopes::Value, Scope(Scopes::Country)),
642 (Scopes::None, "tension_threshold", Scopes::Value, UncheckedValue),
643 (Scopes::None, "unit_type", Scopes::CombatUnitType, Item(Item::CombatUnit)),
644 (Scopes::all(), "var", Scopes::all(), UncheckedValue),
645 ]
646};
647
648pub fn scope_to_scope_removed(name: &str) -> Option<(&'static str, &'static str)> {
649 for (removed_name, version, explanation) in SCOPE_TO_SCOPE_REMOVED.iter().copied() {
650 if name == removed_name {
651 return Some((version, explanation));
652 }
653 }
654 None
655}
656
657const SCOPE_TO_SCOPE_REMOVED: &[(&str, &str, &str)] = &[
658 ("num_commanded_units", "1.6", ""),
659 ("num_enemy_units", "1.6", ""),
660 ("supply", "1.6", ""),
661 ("active_diplomatic_play", "1.7", ""),
662 ("actor_market", "1.9", "replaced by world market system"),
663 ("commander", "1.9", ""),
664 ("exporter", "1.9", "replaced by world market system"),
665 ("importer", "1.9", "replaced by world market system"),
666 ("naval_invasion_attacker", "1.9", "replaced with `invasion_attacker`"),
667 ("naval_invasion_defender", "1.9", "replaced with `invasion_defender`"),
668 ("num_export_trade_routes", "1.9", "replaced by world market system"),
669 ("num_import_trade_routes", "1.9", "replaced by world market system"),
670 ("num_mutual_trade_route_levels_with_country", "1.9", "replaced by world market system"),
671 ("num_trade_routes", "1.9", "replaced by world market system"),
672 ("num_treaty_ports", "1.9", "replaced by world market system"),
673 ("target_market", "1.9", "replaced by world market system"),
674 ("expenses", "1.12", ""),
675 ("fixed_expenses", "1.12", ""),
676 ("highest_ranked_commander", "1.13", ""),
677 ("num_active_declared_interests", "1.13", ""),
678 ("num_convoys_available", "1.13", ""),
679 ("num_convoys_required", "1.13", ""),
680 ("num_declared_interests", "1.13", ""),
681];