Mass: remove as many hardcoded values as possible.

This commit is contained in:
Guillaume Jacquemin 2021-10-17 15:29:16 +02:00
parent e461d5a505
commit 4ca6f62d9b
2 changed files with 27 additions and 27 deletions

View file

@ -386,7 +386,7 @@ auto Mass::writeJointSliders() -> bool {
return true; return true;
} }
auto Mass::frameStyles() -> Containers::StaticArrayView<4, Int> { auto Mass::frameStyles() -> Containers::ArrayView<Int> {
return _frame.styles; return _frame.styles;
} }
@ -409,12 +409,12 @@ void Mass::getFrameStyles() {
return; return;
} }
if(frame_styles->items.size() != 4) { if(frame_styles->items.size() != _frame.styles.size()) {
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
for(UnsignedInt i = 0; i < 4; i++) { for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) {
_frame.styles[i] = frame_styles->at<IntProperty>(i)->value; _frame.styles[i] = frame_styles->at<IntProperty>(i)->value;
} }
} }
@ -506,7 +506,7 @@ auto Mass::writeEyeFlareColour() -> bool {
return _mass->saveToFile(); return _mass->saveToFile();
} }
auto Mass::frameCustomStyles() -> Containers::StaticArrayView<16, CustomStyle> { auto Mass::frameCustomStyles() -> Containers::ArrayView<CustomStyle> {
return _frame.customStyles; return _frame.customStyles;
} }
@ -523,7 +523,7 @@ void Mass::getFrameCustomStyles() {
return; return;
} }
if(frame_styles->items.size() != 16) { if(frame_styles->items.size() != _frame.customStyles.size()) {
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -551,7 +551,7 @@ auto Mass::writeFrameCustomStyle(UnsignedLong index) -> bool {
return setCustomStyle(_frame.customStyles[index], index, frame_styles); return setCustomStyle(_frame.customStyles[index], index, frame_styles);
} }
auto Mass::armourParts() -> Containers::StaticArrayView<38, ArmourPart> { auto Mass::armourParts() -> Containers::ArrayView<ArmourPart> {
return _armour.parts; return _armour.parts;
} }
@ -761,7 +761,7 @@ auto Mass::writeArmourPart(UnsignedLong index) -> bool {
return _mass->saveToFile(); return _mass->saveToFile();
} }
auto Mass::armourCustomStyles() -> Containers::StaticArrayView<16, CustomStyle> { auto Mass::armourCustomStyles() -> Containers::ArrayView<CustomStyle> {
return _armour.customStyles; return _armour.customStyles;
} }
@ -778,7 +778,7 @@ void Mass::getArmourCustomStyles() {
return; return;
} }
if(armour_styles->items.size() != 16) { if(armour_styles->items.size() != _armour.customStyles.size()) {
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -806,7 +806,7 @@ auto Mass::writeArmourCustomStyle(UnsignedLong index) -> bool {
return setCustomStyle(_armour.customStyles[index], index, armour_styles); return setCustomStyle(_armour.customStyles[index], index, armour_styles);
} }
auto Mass::meleeWeapons() -> Containers::StaticArrayView<8, Weapon> { auto Mass::meleeWeapons() -> Containers::ArrayView<Weapon> {
return _weapons.melee; return _weapons.melee;
} }
@ -814,7 +814,7 @@ void Mass::getMeleeWeapons() {
getWeaponType("WeaponCC_22_0BBEC58C4A0EA1DB9E037B9339EE26A7", _weapons.melee); getWeaponType("WeaponCC_22_0BBEC58C4A0EA1DB9E037B9339EE26A7", _weapons.melee);
} }
auto Mass::shields() -> Containers::StaticArrayView<1, Weapon> { auto Mass::shields() -> Containers::ArrayView<Weapon> {
return _weapons.shields; return _weapons.shields;
} }
@ -822,7 +822,7 @@ void Mass::getShields() {
getWeaponType("Shield_53_839BFD7945481BAEA3E43A9C5CA8E92E", _weapons.shields); getWeaponType("Shield_53_839BFD7945481BAEA3E43A9C5CA8E92E", _weapons.shields);
} }
auto Mass::bulletShooters() -> Containers::StaticArrayView<4, Weapon> { auto Mass::bulletShooters() -> Containers::ArrayView<Weapon> {
return _weapons.bulletShooters; return _weapons.bulletShooters;
} }
@ -830,7 +830,7 @@ void Mass::getBulletShooters() {
getWeaponType("WeaponBS_35_6EF6E0104FD7A138DF47F88CB57A83ED", _weapons.bulletShooters); getWeaponType("WeaponBS_35_6EF6E0104FD7A138DF47F88CB57A83ED", _weapons.bulletShooters);
} }
auto Mass::energyShooters() -> Containers::StaticArrayView<4, Weapon> { auto Mass::energyShooters() -> Containers::ArrayView<Weapon> {
return _weapons.energyShooters; return _weapons.energyShooters;
} }
@ -838,7 +838,7 @@ void Mass::getEnergyShooters() {
getWeaponType("WeaponES_37_1A295D544528623880A0B1AC2C7DEE99", _weapons.energyShooters); getWeaponType("WeaponES_37_1A295D544528623880A0B1AC2C7DEE99", _weapons.energyShooters);
} }
auto Mass::bulletLaunchers() -> Containers::StaticArrayView<4, Weapon> { auto Mass::bulletLaunchers() -> Containers::ArrayView<Weapon> {
return _weapons.bulletLaunchers; return _weapons.bulletLaunchers;
} }
@ -846,7 +846,7 @@ void Mass::getBulletLaunchers() {
getWeaponType("WeaponBL_36_5FD7C41E4613A75B44AB0E90B362846E", _weapons.bulletLaunchers); getWeaponType("WeaponBL_36_5FD7C41E4613A75B44AB0E90B362846E", _weapons.bulletLaunchers);
} }
auto Mass::energyLaunchers() -> Containers::StaticArrayView<4, Weapon> { auto Mass::energyLaunchers() -> Containers::ArrayView<Weapon> {
return _weapons.energyLaunchers; return _weapons.energyLaunchers;
} }
@ -854,7 +854,7 @@ void Mass::getEnergyLaunchers() {
getWeaponType("WeaponEL_38_9D23F3884ACA15902C9E6CA6E4995995", _weapons.energyLaunchers); getWeaponType("WeaponEL_38_9D23F3884ACA15902C9E6CA6E4995995", _weapons.energyLaunchers);
} }
auto Mass::globalStyles() -> Containers::StaticArrayView<16, CustomStyle> { auto Mass::globalStyles() -> Containers::ArrayView<CustomStyle> {
return _globalStyles; return _globalStyles;
} }
@ -871,7 +871,7 @@ void Mass::getGlobalStyles() {
return; return;
} }
if(global_styles->items.size() != 16) { if(global_styles->items.size() != _globalStyles.size()) {
_state = State::Invalid; _state = State::Invalid;
return; return;
} }

View file

@ -148,7 +148,7 @@ class Mass {
void getJointSliders(); void getJointSliders();
auto writeJointSliders() -> bool; auto writeJointSliders() -> bool;
auto frameStyles() -> Containers::StaticArrayView<4, Int>; auto frameStyles() -> Containers::ArrayView<Int>;
void getFrameStyles(); void getFrameStyles();
auto writeFrameStyles() -> bool; auto writeFrameStyles() -> bool;
@ -156,43 +156,43 @@ class Mass {
void getEyeFlareColour(); void getEyeFlareColour();
auto writeEyeFlareColour() -> bool; auto writeEyeFlareColour() -> bool;
auto frameCustomStyles() -> Containers::StaticArrayView<16, CustomStyle>; auto frameCustomStyles() -> Containers::ArrayView<CustomStyle>;
void getFrameCustomStyles(); void getFrameCustomStyles();
auto writeFrameCustomStyle(UnsignedLong index) -> bool; auto writeFrameCustomStyle(UnsignedLong index) -> bool;
auto armourParts() -> Containers::StaticArrayView<38, ArmourPart>; auto armourParts() -> Containers::ArrayView<ArmourPart>;
void getArmourParts(); void getArmourParts();
auto writeArmourPart(UnsignedLong index) -> bool; auto writeArmourPart(UnsignedLong index) -> bool;
auto armourCustomStyles() -> Containers::StaticArrayView<16, CustomStyle>; auto armourCustomStyles() -> Containers::ArrayView<CustomStyle>;
void getArmourCustomStyles(); void getArmourCustomStyles();
auto writeArmourCustomStyle(UnsignedLong index) -> bool; auto writeArmourCustomStyle(UnsignedLong index) -> bool;
auto meleeWeapons() -> Containers::StaticArrayView<8, Weapon>; auto meleeWeapons() -> Containers::ArrayView<Weapon>;
void getMeleeWeapons(); void getMeleeWeapons();
auto writeMeleeWeapons() -> bool; auto writeMeleeWeapons() -> bool;
auto shields() -> Containers::StaticArrayView<1, Weapon>; auto shields() -> Containers::ArrayView<Weapon>;
void getShields(); void getShields();
auto writeShields() -> bool; auto writeShields() -> bool;
auto bulletShooters() -> Containers::StaticArrayView<4, Weapon>; auto bulletShooters() -> Containers::ArrayView<Weapon>;
void getBulletShooters(); void getBulletShooters();
auto writeBulletShooters() -> bool; auto writeBulletShooters() -> bool;
auto energyShooters() -> Containers::StaticArrayView<4, Weapon>; auto energyShooters() -> Containers::ArrayView<Weapon>;
void getEnergyShooters(); void getEnergyShooters();
auto writeEnergyShooters() -> bool; auto writeEnergyShooters() -> bool;
auto bulletLaunchers() -> Containers::StaticArrayView<4, Weapon>; auto bulletLaunchers() -> Containers::ArrayView<Weapon>;
void getBulletLaunchers(); void getBulletLaunchers();
auto writeBulletLaunchers() -> bool; auto writeBulletLaunchers() -> bool;
auto energyLaunchers() -> Containers::StaticArrayView<4, Weapon>; auto energyLaunchers() -> Containers::ArrayView<Weapon>;
void getEnergyLaunchers(); void getEnergyLaunchers();
auto writeEnergyLaunchers() -> bool; auto writeEnergyLaunchers() -> bool;
auto globalStyles() -> Containers::StaticArrayView<16, CustomStyle>; auto globalStyles() -> Containers::ArrayView<CustomStyle>;
void getGlobalStyles(); void getGlobalStyles();
auto writeGlobalStyle(UnsignedLong index) -> bool; auto writeGlobalStyle(UnsignedLong index) -> bool;