Compare commits

..

No commits in common. "5705f408a57f0ec612135f8d631b5a569b16555a" and "b287c827d23646b7a483727d09a76e079fd37fa0" have entirely different histories.

8 changed files with 12 additions and 57 deletions

View file

@ -18,7 +18,6 @@
#include <Corrade/Containers/Array.h> #include <Corrade/Containers/Array.h>
#include <Corrade/Containers/Pair.h> #include <Corrade/Containers/Pair.h>
#include <Corrade/Containers/ScopeGuard.h>
#include <Corrade/Utility/Path.h> #include <Corrade/Utility/Path.h>
#include "../UESaveFile/Types/ArrayProperty.h" #include "../UESaveFile/Types/ArrayProperty.h"
@ -80,12 +79,7 @@ auto Mass::getNameFromFile(Containers::StringView path) -> Containers::Optional<
} }
void Mass::refreshValues() { void Mass::refreshValues() {
Utility::Debug{} << "=Refreshing values for" << _filename << Utility::Debug::nospace << "=";
Containers::ScopeGuard guard{[]{ Utility::Error{} << "Refresh failed."; }};
if(!Utility::Path::exists(Utility::Path::join(_folder, _filename))) { if(!Utility::Path::exists(Utility::Path::join(_folder, _filename))) {
Utility::Warning{} << _filename << "does not exist in" << _folder;
_state = State::Empty; _state = State::Empty;
return; return;
} }
@ -93,14 +87,12 @@ void Mass::refreshValues() {
if(!_mass) { if(!_mass) {
_mass.emplace(Utility::Path::join(_folder, _filename)); _mass.emplace(Utility::Path::join(_folder, _filename));
if(!_mass->valid()) { if(!_mass->valid()) {
Utility::Error{} << _mass->lastError();
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
} }
else { else {
if(!_mass->reloadData()) { if(!_mass->reloadData()) {
Utility::Error{} << _mass->lastError();
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -108,7 +100,6 @@ void Mass::refreshValues() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Couldn't find unit data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -116,7 +107,6 @@ void Mass::refreshValues() {
auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB"_s); auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB"_s);
if(!name_prop) { if(!name_prop) {
Utility::Error{} << "Couldn't find a M.A.S.S. name in" << _filename;
_name = Containers::NullOpt; _name = Containers::NullOpt;
_state = State::Invalid; _state = State::Invalid;
return; return;
@ -201,16 +191,12 @@ void Mass::refreshValues() {
auto account_prop = _mass->at<StringProperty>("Account"_s); auto account_prop = _mass->at<StringProperty>("Account"_s);
if(!account_prop) { if(!account_prop) {
Utility::Error{} << "Couldn't find an account ID in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
_account = account_prop->value; _account = account_prop->value;
guard.release();
guard = Containers::ScopeGuard{[]{Utility::Debug{} << "Refresh successful.";}};
_state = State::Valid; _state = State::Valid;
} }
@ -331,7 +317,6 @@ void Mass::getTuningCategory(Containers::StringView big_node_prop_name, Int& big
{ {
auto node_id = _mass->at<IntProperty>(big_node_prop_name); auto node_id = _mass->at<IntProperty>(big_node_prop_name);
if(!node_id) { if(!node_id) {
Utility::Error{} << "Couldn't find" << big_node_prop_name << "in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -339,13 +324,11 @@ void Mass::getTuningCategory(Containers::StringView big_node_prop_name, Int& big
auto node_ids = _mass->at<ArrayProperty>(small_nodes_prop_name); auto node_ids = _mass->at<ArrayProperty>(small_nodes_prop_name);
if(!node_ids) { if(!node_ids) {
Utility::Error{} << "Couldn't find" << small_nodes_prop_name << "in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(node_ids->items.size() != small_nodes_ids.size()) { if(node_ids->items.size() != small_nodes_ids.size()) {
Utility::Error{} << "Node ID arrays are not of the same size. Expected" << small_nodes_ids.size() << Utility::Debug::nospace << ", got" << node_ids->items.size() << "instead.";
_state = State::Invalid; _state = State::Invalid;
return; return;
} }

View file

@ -34,20 +34,17 @@ auto Mass::armourParts() -> Containers::ArrayView<ArmourPart> {
void Mass::getArmourParts() { void Mass::getArmourParts() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Couldn't find unit data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto armour_array = unit_data->at<ArrayProperty>("Armor_10_12E266C44116DDAF57E99ABB575A4B3C"_s); auto armour_array = unit_data->at<ArrayProperty>("Armor_10_12E266C44116DDAF57E99ABB575A4B3C"_s);
if(!armour_array) { if(!armour_array) {
Utility::Error{} << "Couldn't find the armour parts array in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(armour_array->items.size() != _armour.parts.size()) { if(armour_array->items.size() != _armour.parts.size()) {
Utility::Error{} << "Armour arrays are not of the same size. Expected" << _armour.parts.size() << Utility::Debug::nospace << ", got" << armour_array->items.size() << "instead.";
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -69,13 +66,11 @@ void Mass::getArmourParts() {
auto part_styles = part_prop->at<ArrayProperty>("Styles_47_3E31870441DFD7DB8BEE5C85C26B365B"_s); auto part_styles = part_prop->at<ArrayProperty>("Styles_47_3E31870441DFD7DB8BEE5C85C26B365B"_s);
if(!part_styles) { if(!part_styles) {
Utility::Error{} << "Part styles not found for part number" << i << "in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(part_styles->items.size() != part.styles.size()) { if(part_styles->items.size() != part.styles.size()) {
Utility::Error{} << "Part style arrays are not of the same size. Expected" << part.styles.size() << Utility::Debug::nospace << ", got" << part_styles->items.size() << "instead.";
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -86,7 +81,6 @@ void Mass::getArmourParts() {
auto decals_array = part_prop->at<ArrayProperty>("Decals_42_F358794A4F18497970F56BA9627D3603"_s); auto decals_array = part_prop->at<ArrayProperty>("Decals_42_F358794A4F18497970F56BA9627D3603"_s);
if(!decals_array) { if(!decals_array) {
Utility::Error{} << "Part decals not found for part number" << i << "in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -97,7 +91,6 @@ void Mass::getArmourParts() {
auto accs_array = part_prop->at<ArrayProperty>("Accessories_52_D902DD4241FA0050C2529596255153F3"_s); auto accs_array = part_prop->at<ArrayProperty>("Accessories_52_D902DD4241FA0050C2529596255153F3"_s);
if(!accs_array) { if(!accs_array) {
Utility::Error{} << "Part accessories not found for part number" << i << "in" << _filename;
part.accessories = Containers::Array<Accessory>{}; part.accessories = Containers::Array<Accessory>{};
continue; continue;
} }
@ -181,7 +174,6 @@ auto Mass::bulletLauncherAttachments() -> Containers::ArrayView<BulletLauncherAt
void Mass::getBulletLauncherAttachments() { void Mass::getBulletLauncherAttachments() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Couldn't find unit data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -196,7 +188,6 @@ void Mass::getBulletLauncherAttachments() {
if(attach_style_prop && !attach_array) { if(attach_style_prop && !attach_array) {
_armour.blAttachmentStyle = BulletLauncherAttachmentStyle::NotFound; _armour.blAttachmentStyle = BulletLauncherAttachmentStyle::NotFound;
Utility::Error{} << "Couldn't find bullet launcher attachments in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -344,20 +335,17 @@ auto Mass::armourCustomStyles() -> Containers::ArrayView<CustomStyle> {
void Mass::getArmourCustomStyles() { void Mass::getArmourCustomStyles() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Couldn't find unit data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto armour_styles = unit_data->at<ArrayProperty>("ArmorStyle_42_E2F6AC3647788CB366BD469B3B7E899E"_s); auto armour_styles = unit_data->at<ArrayProperty>("ArmorStyle_42_E2F6AC3647788CB366BD469B3B7E899E"_s);
if(!armour_styles) { if(!armour_styles) {
Utility::Error{} << "Couldn't find custom armour styles in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(armour_styles->items.size() != _armour.customStyles.size()) { if(armour_styles->items.size() != _armour.customStyles.size()) {
Utility::Error{} << "Custom armour style arrays are not of the same size. Expected" << _armour.customStyles.size() << Utility::Debug::nospace << ", got" << armour_styles->items.size() << "instead.";
_state = State::Invalid; _state = State::Invalid;
return; return;
} }

View file

@ -31,7 +31,6 @@ using namespace Containers::Literals;
void Mass::getDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array) { void Mass::getDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array) {
for(UnsignedInt i = 0; i < decal_array->items.size(); i++) { for(UnsignedInt i = 0; i < decal_array->items.size(); i++) {
auto decal_prop = decal_array->at<GenericStructProperty>(i); auto decal_prop = decal_array->at<GenericStructProperty>(i);
CORRADE_INTERNAL_ASSERT(decal_prop);
auto& decal = decals[i]; auto& decal = decals[i];
decal.id = decal_prop->at<IntProperty>("ID_3_694C0B35404D8A3168AEC89026BC8CF9"_s)->value; decal.id = decal_prop->at<IntProperty>("ID_3_694C0B35404D8A3168AEC89026BC8CF9"_s)->value;
@ -55,7 +54,6 @@ void Mass::getDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_a
void Mass::writeDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array) { void Mass::writeDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array) {
for(UnsignedInt i = 0; i < decal_array->items.size(); i++) { for(UnsignedInt i = 0; i < decal_array->items.size(); i++) {
auto decal_prop = decal_array->at<GenericStructProperty>(i); auto decal_prop = decal_array->at<GenericStructProperty>(i);
CORRADE_INTERNAL_ASSERT(decal_prop);
auto& decal = decals[i]; auto& decal = decals[i];
decal_prop->at<IntProperty>("ID_3_694C0B35404D8A3168AEC89026BC8CF9"_s)->value = decal.id; decal_prop->at<IntProperty>("ID_3_694C0B35404D8A3168AEC89026BC8CF9"_s)->value = decal.id;
@ -89,7 +87,6 @@ void Mass::writeDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal
void Mass::getAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty* accessory_array) { void Mass::getAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty* accessory_array) {
for(UnsignedInt i = 0; i < accessory_array->items.size(); i++) { for(UnsignedInt i = 0; i < accessory_array->items.size(); i++) {
auto acc_prop = accessory_array->at<GenericStructProperty>(i); auto acc_prop = accessory_array->at<GenericStructProperty>(i);
CORRADE_INTERNAL_ASSERT(acc_prop);
auto& accessory = accessories[i]; auto& accessory = accessories[i];
accessory.attachIndex = acc_prop->at<IntProperty>("AttachIndex_2_4AFCF6024E4BA7426C6B9F80B8179D20"_s)->value; accessory.attachIndex = acc_prop->at<IntProperty>("AttachIndex_2_4AFCF6024E4BA7426C6B9F80B8179D20"_s)->value;
@ -114,7 +111,6 @@ void Mass::getAccessories(Containers::ArrayView<Accessory> accessories, ArrayPro
void Mass::writeAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty* accs_array) { void Mass::writeAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty* accs_array) {
for(UnsignedInt i = 0; i < accs_array->items.size(); i++) { for(UnsignedInt i = 0; i < accs_array->items.size(); i++) {
auto acc_prop = accs_array->at<GenericStructProperty>(i); auto acc_prop = accs_array->at<GenericStructProperty>(i);
CORRADE_INTERNAL_ASSERT(acc_prop);
auto& accessory = accessories[i]; auto& accessory = accessories[i];
acc_prop->at<IntProperty>("AttachIndex_2_4AFCF6024E4BA7426C6B9F80B8179D20"_s)->value = accessory.attachIndex; acc_prop->at<IntProperty>("AttachIndex_2_4AFCF6024E4BA7426C6B9F80B8179D20"_s)->value = accessory.attachIndex;

View file

@ -31,14 +31,12 @@ auto Mass::jointSliders() -> Joints& {
void Mass::getJointSliders() { void Mass::getJointSliders() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s); auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s);
if(!frame_prop) { if(!frame_prop) {
Utility::Error{} << "Can't find frame data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -181,27 +179,23 @@ auto Mass::frameStyles() -> Containers::ArrayView<Int> {
void Mass::getFrameStyles() { void Mass::getFrameStyles() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s); auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s);
if(!frame_prop) { if(!frame_prop) {
Utility::Error{} << "Can't find frame data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto frame_styles = frame_prop->at<ArrayProperty>("Styles_32_00A3B3284B37F1E7819458844A20EB48"_s); auto frame_styles = frame_prop->at<ArrayProperty>("Styles_32_00A3B3284B37F1E7819458844A20EB48"_s);
if(!frame_styles) { if(!frame_styles) {
Utility::Error{} << "Can't find frame styles in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(frame_styles->items.size() != _frame.styles.size()) { if(frame_styles->items.size() != _frame.styles.size()) {
Utility::Error{} << "Frame style arrays are not of the same size. Expected" << _frame.styles.size() << Utility::Debug::nospace << ", got" << frame_styles->items.size() << "instead.";
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -252,21 +246,18 @@ auto Mass::eyeFlareColour() -> Color4& {
void Mass::getEyeFlareColour() { void Mass::getEyeFlareColour() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s); auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653"_s);
if(!frame_prop) { if(!frame_prop) {
Utility::Error{} << "Can't find frame data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto eye_flare_prop = frame_prop->at<ColourStructProperty>("EyeFlareColor_36_AF79999C40FCA0E88A2F9A84488A38CA"_s); auto eye_flare_prop = frame_prop->at<ColourStructProperty>("EyeFlareColor_36_AF79999C40FCA0E88A2F9A84488A38CA"_s);
if(!eye_flare_prop) { if(!eye_flare_prop) {
Utility::Error{} << "Can't find eye flare data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -316,20 +307,17 @@ auto Mass::frameCustomStyles() -> Containers::ArrayView<CustomStyle> {
void Mass::getFrameCustomStyles() { void Mass::getFrameCustomStyles() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto frame_styles = unit_data->at<ArrayProperty>("FrameStyle_44_04A44C9440363CCEC5443D98BFAF22AA"_s); auto frame_styles = unit_data->at<ArrayProperty>("FrameStyle_44_04A44C9440363CCEC5443D98BFAF22AA"_s);
if(!frame_styles) { if(!frame_styles) {
Utility::Error{} << "Can't find frame styles in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(frame_styles->items.size() != _frame.customStyles.size()) { if(frame_styles->items.size() != _frame.customStyles.size()) {
Utility::Error{} << "Frame custom style arrays are not of the same size. Expected" << _frame.customStyles.size() << Utility::Debug::nospace << ", got" << frame_styles->items.size() << "instead.";
_state = State::Invalid; _state = State::Invalid;
return; return;
} }

View file

@ -32,7 +32,6 @@ auto Mass::globalStyles() -> Containers::ArrayView<CustomStyle> {
void Mass::getGlobalStyles() { void Mass::getGlobalStyles() {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -88,8 +87,8 @@ void Mass::getCustomStyles(Containers::ArrayView<CustomStyle> styles, ArrayPrope
style.patternId = style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311"_s)->value; style.patternId = style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311"_s)->value;
style.opacity = style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131"_s)->value; style.opacity = style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131"_s)->value;
style.offset = Vector2{ style.offset = Vector2{
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48"_s)->value, style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48"_s)->value,
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F"_s)->value style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F"_s)->value
}; };
style.rotation = style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D"_s)->value; style.rotation = style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D"_s)->value;
style.scale = style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671"_s)->value; style.scale = style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671"_s)->value;

View file

@ -101,20 +101,17 @@ auto Mass::writeEnergyLaunchers() -> bool {
void Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weapon> weapon_array) { void Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weapon> weapon_array) {
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s); auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) { if(!unit_data) {
Utility::Error{} << "Can't find unit data in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
auto prop = unit_data->at<ArrayProperty>(prop_name); auto prop = unit_data->at<ArrayProperty>(prop_name);
if(!prop) { if(!prop) {
Utility::Error{} << "Can't find" << prop_name << "in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(prop->items.size() != weapon_array.size()) { if(prop->items.size() != weapon_array.size()) {
Utility::Error{} << "Weapon arrays are not of the same size. Expected" << weapon_array.size() << Utility::Debug::nospace << ", got" << prop->items.size() << "instead.";
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
@ -168,13 +165,11 @@ void Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView
auto custom_styles = weapon_prop->at<ArrayProperty>("Styles_10_8C3C82444B986AD7A99595AD4985912D"_s); auto custom_styles = weapon_prop->at<ArrayProperty>("Styles_10_8C3C82444B986AD7A99595AD4985912D"_s);
if(!custom_styles) { if(!custom_styles) {
Utility::Error{} << "Can't find weapon custom styles in" << _filename;
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
if(custom_styles->items.size() != weapon.customStyles.size()) { if(custom_styles->items.size() != weapon.customStyles.size()) {
Utility::Error{} << "Weapon custom style arrays are not of the same size. Expected" << weapon.customStyles.size() << Utility::Debug::nospace << ", got" << custom_styles->items.size() << "instead.";
_state = State::Invalid; _state = State::Invalid;
return; return;
} }

View file

@ -29,10 +29,16 @@ MassManager::MassManager(Containers::StringView save_path, Containers::StringVie
_demo{demo}, _demo{demo},
_stagingAreaDirectory{staging_dir} _stagingAreaDirectory{staging_dir}
{ {
Containers::arrayReserve(_hangars, 32);
Containers::String mass_filename = ""; Containers::String mass_filename = "";
for(UnsignedInt i = 0; i < _hangars.size(); i++) { for(int i = 0; i < 32; i++) {
mass_filename = Utility::Path::join(_saveDirectory, Utility::format("{}Unit{:.2d}{}.sav", demo ? "Demo"_s : ""_s, i, _account)); mass_filename = Utility::Path::join(_saveDirectory, Utility::format("{}Unit{:.2d}{}.sav", demo ? "Demo"_s : ""_s, i, _account));
new(&_hangars[i]) Mass{mass_filename}; Containers::arrayAppend(_hangars, Mass{mass_filename});
}
if(!Utility::Path::exists(_stagingAreaDirectory)) {
Utility::Path::make(_stagingAreaDirectory);
} }
refreshStagedMasses(); refreshStagedMasses();

View file

@ -18,7 +18,7 @@
#include <map> #include <map>
#include <Corrade/Containers/StaticArray.h> #include <Corrade/Containers/GrowableArray.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
@ -53,7 +53,7 @@ class MassManager {
Containers::String _lastError; Containers::String _lastError;
Containers::StaticArray<32, Mass> _hangars{NoInit}; Containers::Array<Mass> _hangars;
Containers::StringView _stagingAreaDirectory; Containers::StringView _stagingAreaDirectory;