tiger_lib/vic3/
scopes.rs

1use crate::everything::Everything;
2use crate::scopes::Scopes;
3
4pub fn needs_prefix(arg: &str, data: &Everything, scopes: Scopes) -> Option<&'static str> {
5    use crate::item::Item;
6    if scopes == Scopes::Building && data.item_exists(Item::BuildingType, arg) {
7        return Some("b");
8    }
9    if scopes == Scopes::BuildingType && data.item_exists(Item::BuildingType, arg) {
10        return Some("bt");
11    }
12    if scopes == Scopes::BuildingGroup && data.item_exists(Item::BuildingGroup, arg) {
13        return Some("bg");
14    }
15    if scopes == Scopes::Country && data.item_exists(Item::Country, arg) {
16        return Some("c");
17    }
18    if scopes == Scopes::CountryDefinition && data.item_exists(Item::Country, arg) {
19        return Some("cd");
20    }
21    if scopes == Scopes::CompanyType && data.item_exists(Item::CompanyType, arg) {
22        return Some("company_type");
23    }
24    if scopes == Scopes::Culture && data.item_exists(Item::Culture, arg) {
25        return Some("cu");
26    }
27    if scopes == Scopes::Flag {
28        return Some("flag");
29    }
30    if scopes == Scopes::Ideology && data.item_exists(Item::Ideology, arg) {
31        return Some("i");
32    }
33    if scopes == Scopes::InterestGroup && data.item_exists(Item::InterestGroup, arg) {
34        return Some("ig");
35    }
36    if scopes == Scopes::InterestGroupTrait && data.item_exists(Item::InterestGroupTrait, arg) {
37        return Some("ig_trait");
38    }
39    if scopes == Scopes::InterestGroupType && data.item_exists(Item::InterestGroup, arg) {
40        return Some("ig_type");
41    }
42    if scopes == Scopes::Institution && data.item_exists(Item::Institution, arg) {
43        return Some("institution");
44    }
45    if scopes == Scopes::JournalEntry && data.item_exists(Item::JournalEntry, arg) {
46        return Some("je");
47    }
48    if scopes == Scopes::LawType && data.item_exists(Item::LawType, arg) {
49        return Some("law_type");
50    }
51    if scopes == Scopes::MarketGoods && data.item_exists(Item::Goods, arg) {
52        return Some("mg");
53    }
54    if scopes == Scopes::MobilizationOption && data.item_exists(Item::MobilizationOption, arg) {
55        return Some("mobilization_option");
56    }
57    if scopes == Scopes::Decree && data.item_exists(Item::Decree, arg) {
58        return Some("nf");
59    }
60    if scopes == Scopes::Province && data.item_exists(Item::Province, arg) {
61        return Some("p");
62    }
63    if scopes == Scopes::PopType && data.item_exists(Item::PopType, arg) {
64        return Some("pop_type");
65    }
66    if scopes == Scopes::Party && data.item_exists(Item::Party, arg) {
67        return Some("py");
68    }
69    if scopes == Scopes::Religion && data.item_exists(Item::Religion, arg) {
70        return Some("rel");
71    }
72    if scopes == Scopes::StateRegion && data.item_exists(Item::StateRegion, arg) {
73        return Some("s");
74    }
75    if scopes == Scopes::StrategicRegion && data.item_exists(Item::StrategicRegion, arg) {
76        return Some("sr");
77    }
78    if scopes == Scopes::CombatUnitType && data.item_exists(Item::CombatUnit, arg) {
79        return Some("unit_type");
80    }
81    None
82}