Compare commits
2 commits
04d2ab9dc7
...
9f0386d5b3
Author | SHA1 | Date | |
---|---|---|---|
9f0386d5b3 | |||
8a809b7752 |
6 changed files with 43 additions and 43 deletions
|
@ -38,8 +38,8 @@
|
||||||
|
|
||||||
#include <efsw/efsw.hpp>
|
#include <efsw/efsw.hpp>
|
||||||
|
|
||||||
#include "../Managers/Mass.h"
|
#include "../Managers/MassManager.h"
|
||||||
#include "../Managers/Profile.h"
|
#include "../Managers/ProfileManager.h"
|
||||||
#include "../ToastQueue/ToastQueue.h"
|
#include "../ToastQueue/ToastQueue.h"
|
||||||
#include "../UpdateChecker/UpdateChecker.h"
|
#include "../UpdateChecker/UpdateChecker.h"
|
||||||
|
|
||||||
|
@ -236,10 +236,10 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe
|
||||||
|
|
||||||
SDL_TimerID _gameCheckTimerId = 0;
|
SDL_TimerID _gameCheckTimerId = 0;
|
||||||
|
|
||||||
Containers::Pointer<Managers::Profile> _profileManager;
|
Containers::Pointer<Managers::ProfileManager> _profileManager;
|
||||||
GameObjects::Profile* _currentProfile = nullptr;
|
GameObjects::Profile* _currentProfile = nullptr;
|
||||||
|
|
||||||
Containers::Pointer<Managers::Mass> _massManager;
|
Containers::Pointer<Managers::MassManager> _massManager;
|
||||||
GameObjects::Mass* _currentMass = nullptr;
|
GameObjects::Mass* _currentMass = nullptr;
|
||||||
|
|
||||||
GameObjects::Weapon* _currentWeapon = nullptr;
|
GameObjects::Weapon* _currentWeapon = nullptr;
|
||||||
|
|
|
@ -157,6 +157,8 @@ add_executable(MassBuilderSaveTool
|
||||||
Application/Application_UpdateChecker.cpp
|
Application/Application_UpdateChecker.cpp
|
||||||
Configuration/Configuration.h
|
Configuration/Configuration.h
|
||||||
Configuration/Configuration.cpp
|
Configuration/Configuration.cpp
|
||||||
|
FontAwesome/IconsFontAwesome5.h
|
||||||
|
FontAwesome/IconsFontAwesome5Brands.h
|
||||||
GameData/Accessories.h
|
GameData/Accessories.h
|
||||||
GameData/ArmourSets.h
|
GameData/ArmourSets.h
|
||||||
GameData/LastMissionId.h
|
GameData/LastMissionId.h
|
||||||
|
@ -177,16 +179,16 @@ add_executable(MassBuilderSaveTool
|
||||||
GameObjects/Mass_Weapons.cpp
|
GameObjects/Mass_Weapons.cpp
|
||||||
GameObjects/Mass_Styles.cpp
|
GameObjects/Mass_Styles.cpp
|
||||||
GameObjects/Mass_DecalsAccessories.cpp
|
GameObjects/Mass_DecalsAccessories.cpp
|
||||||
GameObjects/PropertyNames.h
|
|
||||||
GameObjects/Profile.h
|
GameObjects/Profile.h
|
||||||
GameObjects/Profile.cpp
|
GameObjects/Profile.cpp
|
||||||
|
GameObjects/PropertyNames.h
|
||||||
GameObjects/Weapon.h
|
GameObjects/Weapon.h
|
||||||
GameObjects/Weapon.cpp
|
GameObjects/Weapon.cpp
|
||||||
GameObjects/WeaponPart.h
|
GameObjects/WeaponPart.h
|
||||||
Managers/Mass.h
|
Managers/MassManager.h
|
||||||
Managers/Mass.cpp
|
Managers/MassManager.cpp
|
||||||
Managers/Profile.h
|
Managers/ProfileManager.h
|
||||||
Managers/Profile.cpp
|
Managers/ProfileManager.cpp
|
||||||
Maps/ArmourSlots.hpp
|
Maps/ArmourSlots.hpp
|
||||||
Maps/BulletLauncherAttachmentStyles.hpp
|
Maps/BulletLauncherAttachmentStyles.hpp
|
||||||
Maps/BulletLauncherSockets.hpp
|
Maps/BulletLauncherSockets.hpp
|
||||||
|
@ -201,8 +203,6 @@ add_executable(MassBuilderSaveTool
|
||||||
Utilities/Crc32.cpp
|
Utilities/Crc32.cpp
|
||||||
Version/Version.h
|
Version/Version.h
|
||||||
Version/Version.cpp
|
Version/Version.cpp
|
||||||
FontAwesome/IconsFontAwesome5.h
|
|
||||||
FontAwesome/IconsFontAwesome5Brands.h
|
|
||||||
${Logger_SOURCES}
|
${Logger_SOURCES}
|
||||||
${BinaryIo_SOURCES}
|
${BinaryIo_SOURCES}
|
||||||
${Gvas_SOURCES}
|
${Gvas_SOURCES}
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
|
|
||||||
#include "../Logger/Logger.h"
|
#include "../Logger/Logger.h"
|
||||||
|
|
||||||
#include "Mass.h"
|
#include "MassManager.h"
|
||||||
|
|
||||||
using namespace Containers::Literals;
|
using namespace Containers::Literals;
|
||||||
|
|
||||||
namespace mbst { namespace Managers {
|
namespace mbst { namespace Managers {
|
||||||
|
|
||||||
Mass::Mass(Containers::StringView save_path, Containers::StringView account, bool demo,
|
MassManager::MassManager(Containers::StringView save_path, Containers::StringView account, bool demo,
|
||||||
Containers::StringView staging_dir):
|
Containers::StringView staging_dir):
|
||||||
_saveDirectory{save_path}, _account{account}, _demo{demo}, _stagingAreaDirectory{staging_dir}
|
_saveDirectory{save_path}, _account{account}, _demo{demo}, _stagingAreaDirectory{staging_dir}
|
||||||
{
|
{
|
||||||
|
@ -42,17 +42,17 @@ Mass::Mass(Containers::StringView save_path, Containers::StringView account, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
Containers::StringView
|
Containers::StringView
|
||||||
Mass::lastError() {
|
MassManager::lastError() {
|
||||||
return _lastError;
|
return _lastError;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObjects::Mass&
|
GameObjects::Mass&
|
||||||
Mass::hangar(std::int32_t hangar) {
|
MassManager::hangar(std::int32_t hangar) {
|
||||||
return _hangars[hangar];
|
return _hangars[hangar];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Mass::refreshHangar(std::int32_t hangar) {
|
MassManager::refreshHangar(std::int32_t hangar) {
|
||||||
if(hangar < 0 || hangar >= 32) {
|
if(hangar < 0 || hangar >= 32) {
|
||||||
_lastError = "Hangar index out of range.";
|
_lastError = "Hangar index out of range.";
|
||||||
LOG_ERROR(_lastError);
|
LOG_ERROR(_lastError);
|
||||||
|
@ -66,7 +66,7 @@ Mass::refreshHangar(std::int32_t hangar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Mass::importMass(Containers::StringView staged_fn, std::int32_t hangar) {
|
MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) {
|
||||||
if(hangar < 0 || hangar >= 32) {
|
if(hangar < 0 || hangar >= 32) {
|
||||||
_lastError = "Hangar index out of range.";
|
_lastError = "Hangar index out of range.";
|
||||||
LOG_ERROR(_lastError);
|
LOG_ERROR(_lastError);
|
||||||
|
@ -109,7 +109,7 @@ Mass::importMass(Containers::StringView staged_fn, std::int32_t hangar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Mass::exportMass(std::int32_t hangar) {
|
MassManager::exportMass(std::int32_t hangar) {
|
||||||
if(hangar < 0 || hangar >= 32) {
|
if(hangar < 0 || hangar >= 32) {
|
||||||
_lastError = "Hangar index out of range."_s;
|
_lastError = "Hangar index out of range."_s;
|
||||||
LOG_ERROR(_lastError);
|
LOG_ERROR(_lastError);
|
||||||
|
@ -136,7 +136,7 @@ Mass::exportMass(std::int32_t hangar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Mass::moveMass(std::int32_t source, std::int32_t destination) {
|
MassManager::moveMass(std::int32_t source, std::int32_t destination) {
|
||||||
if(source < 0 || source >= 32) {
|
if(source < 0 || source >= 32) {
|
||||||
_lastError = "Source hangar index out of range."_s;
|
_lastError = "Source hangar index out of range."_s;
|
||||||
LOG_ERROR(_lastError);
|
LOG_ERROR(_lastError);
|
||||||
|
@ -174,7 +174,7 @@ Mass::moveMass(std::int32_t source, std::int32_t destination) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Mass::deleteMass(std::int32_t hangar) {
|
MassManager::deleteMass(std::int32_t hangar) {
|
||||||
if(hangar < 0 || hangar >= 32) {
|
if(hangar < 0 || hangar >= 32) {
|
||||||
_lastError = "Hangar index out of range."_s;
|
_lastError = "Hangar index out of range."_s;
|
||||||
LOG_ERROR(_lastError);
|
LOG_ERROR(_lastError);
|
||||||
|
@ -191,12 +191,12 @@ Mass::deleteMass(std::int32_t hangar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<Containers::String, Containers::String>&
|
const std::map<Containers::String, Containers::String>&
|
||||||
Mass::stagedMasses() {
|
MassManager::stagedMasses() {
|
||||||
return _stagedMasses;
|
return _stagedMasses;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Mass::refreshStagedMasses() {
|
MassManager::refreshStagedMasses() {
|
||||||
_stagedMasses.clear();
|
_stagedMasses.clear();
|
||||||
|
|
||||||
using Utility::Path::ListFlag;
|
using Utility::Path::ListFlag;
|
||||||
|
@ -229,7 +229,7 @@ Mass::refreshStagedMasses() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Mass::refreshStagedMass(Containers::StringView filename) {
|
MassManager::refreshStagedMass(Containers::StringView filename) {
|
||||||
LOG_INFO_FORMAT("Refreshing staged unit with filename {}.", filename);
|
LOG_INFO_FORMAT("Refreshing staged unit with filename {}.", filename);
|
||||||
|
|
||||||
bool file_exists = Utility::Path::exists(Utility::Path::join(_stagingAreaDirectory, filename));
|
bool file_exists = Utility::Path::exists(Utility::Path::join(_stagingAreaDirectory, filename));
|
||||||
|
@ -250,7 +250,7 @@ Mass::refreshStagedMass(Containers::StringView filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Mass::deleteStagedMass(Containers::StringView filename) {
|
MassManager::deleteStagedMass(Containers::StringView filename) {
|
||||||
if(_stagedMasses.find(filename) == _stagedMasses.cend()) {
|
if(_stagedMasses.find(filename) == _stagedMasses.cend()) {
|
||||||
_lastError = "The file "_s + filename + " couldn't be found in the list of staged M.A.S.S.es."_s;
|
_lastError = "The file "_s + filename + " couldn't be found in the list of staged M.A.S.S.es."_s;
|
||||||
LOG_ERROR(_lastError);
|
LOG_ERROR(_lastError);
|
|
@ -28,9 +28,9 @@ using namespace Corrade;
|
||||||
|
|
||||||
namespace mbst { namespace Managers {
|
namespace mbst { namespace Managers {
|
||||||
|
|
||||||
class Mass {
|
class MassManager {
|
||||||
public:
|
public:
|
||||||
Mass(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir);
|
MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir);
|
||||||
|
|
||||||
auto lastError() -> Containers::StringView;
|
auto lastError() -> Containers::StringView;
|
||||||
|
|
|
@ -29,13 +29,13 @@
|
||||||
|
|
||||||
#include "../Logger/Logger.h"
|
#include "../Logger/Logger.h"
|
||||||
|
|
||||||
#include "Profile.h"
|
#include "ProfileManager.h"
|
||||||
|
|
||||||
using namespace Containers::Literals;
|
using namespace Containers::Literals;
|
||||||
|
|
||||||
namespace mbst { namespace Managers {
|
namespace mbst { namespace Managers {
|
||||||
|
|
||||||
Profile::Profile(Containers::StringView save_dir, Containers::StringView backup_dir):
|
ProfileManager::ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir):
|
||||||
_saveDirectory{save_dir},
|
_saveDirectory{save_dir},
|
||||||
_backupsDirectory{backup_dir}
|
_backupsDirectory{backup_dir}
|
||||||
{
|
{
|
||||||
|
@ -43,22 +43,22 @@ Profile::Profile(Containers::StringView save_dir, Containers::StringView backup_
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Profile::ready() const {
|
ProfileManager::ready() const {
|
||||||
return _ready;
|
return _ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
Containers::StringView
|
Containers::StringView
|
||||||
Profile::lastError() {
|
ProfileManager::lastError() {
|
||||||
return _lastError;
|
return _lastError;
|
||||||
}
|
}
|
||||||
|
|
||||||
Containers::ArrayView<GameObjects::Profile>
|
Containers::ArrayView<GameObjects::Profile>
|
||||||
Profile::profiles() {
|
ProfileManager::profiles() {
|
||||||
return _profiles;
|
return _profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Profile::refreshProfiles() {
|
ProfileManager::refreshProfiles() {
|
||||||
LOG_INFO("Refreshing profiles.");
|
LOG_INFO("Refreshing profiles.");
|
||||||
|
|
||||||
_profiles = Containers::Array<GameObjects::Profile>{};
|
_profiles = Containers::Array<GameObjects::Profile>{};
|
||||||
|
@ -100,12 +100,12 @@ Profile::refreshProfiles() {
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObjects::Profile*
|
GameObjects::Profile*
|
||||||
Profile::getProfile(std::size_t index) {
|
ProfileManager::getProfile(std::size_t index) {
|
||||||
return index <= _profiles.size() ? &(_profiles[index]) : nullptr;
|
return index <= _profiles.size() ? &(_profiles[index]) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Profile::deleteProfile(std::size_t index, bool delete_builds) {
|
ProfileManager::deleteProfile(std::size_t index, bool delete_builds) {
|
||||||
if(!Utility::Path::remove(Utility::Path::join(_saveDirectory, _profiles[index].filename()))) {
|
if(!Utility::Path::remove(Utility::Path::join(_saveDirectory, _profiles[index].filename()))) {
|
||||||
_lastError = Utility::format("Couldn't delete {} (filename: {}).",
|
_lastError = Utility::format("Couldn't delete {} (filename: {}).",
|
||||||
_profiles[index].companyName(),
|
_profiles[index].companyName(),
|
||||||
|
@ -136,7 +136,7 @@ Profile::deleteProfile(std::size_t index, bool delete_builds) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Profile::backupProfile(std::size_t index, bool backup_builds) {
|
ProfileManager::backupProfile(std::size_t index, bool backup_builds) {
|
||||||
std::time_t timestamp = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
std::time_t timestamp = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||||
std::tm* time = std::localtime(×tamp);
|
std::tm* time = std::localtime(×tamp);
|
||||||
auto& profile = _profiles[index];
|
auto& profile = _profiles[index];
|
||||||
|
@ -213,12 +213,12 @@ Profile::backupProfile(std::size_t index, bool backup_builds) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Containers::ArrayView<Backup>
|
Containers::ArrayView<Backup>
|
||||||
Profile::backups() {
|
ProfileManager::backups() {
|
||||||
return _backups;
|
return _backups;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Profile::refreshBackups() {
|
ProfileManager::refreshBackups() {
|
||||||
_backups = Containers::Array<Backup>{};
|
_backups = Containers::Array<Backup>{};
|
||||||
|
|
||||||
using Utility::Path::ListFlag;
|
using Utility::Path::ListFlag;
|
||||||
|
@ -303,7 +303,7 @@ Profile::refreshBackups() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Profile::deleteBackup(std::size_t index) {
|
ProfileManager::deleteBackup(std::size_t index) {
|
||||||
if(!Utility::Path::remove(Utility::Path::join(_backupsDirectory, _backups[index].filename))) {
|
if(!Utility::Path::remove(Utility::Path::join(_backupsDirectory, _backups[index].filename))) {
|
||||||
_lastError = "Couldn't delete " + _backups[index].filename;
|
_lastError = "Couldn't delete " + _backups[index].filename;
|
||||||
LOG_ERROR(_lastError);
|
LOG_ERROR(_lastError);
|
||||||
|
@ -321,7 +321,7 @@ Profile::deleteBackup(std::size_t index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Profile::restoreBackup(std::size_t index) {
|
ProfileManager::restoreBackup(std::size_t index) {
|
||||||
const Backup& backup = _backups[index];
|
const Backup& backup = _backups[index];
|
||||||
|
|
||||||
auto error_format = "Extraction of file {} failed: {}"_s;
|
auto error_format = "Extraction of file {} failed: {}"_s;
|
|
@ -44,9 +44,9 @@ struct Backup {
|
||||||
Containers::Array<Containers::String> includedFiles;
|
Containers::Array<Containers::String> includedFiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Profile {
|
class ProfileManager {
|
||||||
public:
|
public:
|
||||||
explicit Profile(Containers::StringView save_dir, Containers::StringView backup_dir);
|
explicit ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir);
|
||||||
|
|
||||||
auto ready() const -> bool;
|
auto ready() const -> bool;
|
||||||
auto lastError() -> Containers::StringView;
|
auto lastError() -> Containers::StringView;
|
Loading…
Reference in a new issue