@@ -16,13 +16,18 @@ use crate::vic3::tables::modifs::maybe_warn_modifiable_capitalization;
1616pub struct ShipType { }
1717#[ derive( Clone , Debug ) ]
1818pub struct ShipGroup { }
19+ #[ derive( Clone , Debug ) ]
20+ pub struct ShipVeterancyLevel { }
1921
2022inventory:: submit! {
2123 ItemLoader :: Normal ( GameFlags :: Vic3 , Item :: ShipType , ShipType :: add)
2224}
2325inventory:: submit! {
2426 ItemLoader :: Normal ( GameFlags :: Vic3 , Item :: ShipGroup , ShipGroup :: add)
2527}
28+ inventory:: submit! {
29+ ItemLoader :: Normal ( GameFlags :: Vic3 , Item :: ShipVeterancyLevel , ShipVeterancyLevel :: add)
30+ }
2631
2732impl ShipType {
2833 pub fn add ( db : & mut Db , key : Token , block : Block ) {
@@ -34,6 +39,11 @@ impl ShipGroup {
3439 db. add ( Item :: ShipGroup , key, block, Box :: new ( Self { } ) ) ;
3540 }
3641}
42+ impl ShipVeterancyLevel {
43+ pub fn add ( db : & mut Db , key : Token , block : Block ) {
44+ db. add ( Item :: ShipVeterancyLevel , key, block, Box :: new ( Self { } ) ) ;
45+ }
46+ }
3747
3848impl DbKind for ShipType {
3949 fn validate ( & self , key : & Token , block : & Block , data : & Everything ) {
@@ -122,3 +132,18 @@ impl DbKind for ShipGroup {
122132 vd. field_choice ( "category" , & [ "capital_group" , "cruiser_group" , "torpedo_group" , "supply" ] ) ;
123133 }
124134}
135+
136+ impl DbKind for ShipVeterancyLevel {
137+ fn validate ( & self , key : & Token , block : & Block , data : & Everything ) {
138+ let mut vd = Validator :: new ( block, data) ;
139+
140+ data. verify_exists ( Item :: Localization , key) ;
141+
142+ vd. field_item ( "icon" , Item :: File ) ;
143+ vd. field_numeric ( "experience_threshold" ) ;
144+ vd. field_validated_block ( "modifier" , |block, data| {
145+ let vd = Validator :: new ( block, data) ;
146+ validate_modifs ( block, data, ModifKinds :: Ship , vd) ;
147+ } ) ;
148+ }
149+ }
0 commit comments