{Mass,Profile}Manager: move into new namespace.
This commit is contained in:
parent
9d1d0af70a
commit
04d2ab9dc7
6 changed files with 48 additions and 48 deletions
|
@ -38,8 +38,8 @@
|
|||
|
||||
#include <efsw/efsw.hpp>
|
||||
|
||||
#include "../ProfileManager/ProfileManager.h"
|
||||
#include "../MassManager/MassManager.h"
|
||||
#include "../Managers/Mass.h"
|
||||
#include "../Managers/Profile.h"
|
||||
#include "../ToastQueue/ToastQueue.h"
|
||||
#include "../UpdateChecker/UpdateChecker.h"
|
||||
|
||||
|
@ -236,11 +236,11 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe
|
|||
|
||||
SDL_TimerID _gameCheckTimerId = 0;
|
||||
|
||||
Containers::Pointer<ProfileManager> _profileManager;
|
||||
GameObjects::Profile* _currentProfile = nullptr;
|
||||
Containers::Pointer<Managers::Profile> _profileManager;
|
||||
GameObjects::Profile* _currentProfile = nullptr;
|
||||
|
||||
Containers::Pointer<MassManager> _massManager;
|
||||
GameObjects::Mass* _currentMass = nullptr;
|
||||
Containers::Pointer<Managers::Mass> _massManager;
|
||||
GameObjects::Mass* _currentMass = nullptr;
|
||||
|
||||
GameObjects::Weapon* _currentWeapon = nullptr;
|
||||
|
||||
|
|
|
@ -183,10 +183,10 @@ add_executable(MassBuilderSaveTool
|
|||
GameObjects/Weapon.h
|
||||
GameObjects/Weapon.cpp
|
||||
GameObjects/WeaponPart.h
|
||||
ProfileManager/ProfileManager.h
|
||||
ProfileManager/ProfileManager.cpp
|
||||
MassManager/MassManager.h
|
||||
MassManager/MassManager.cpp
|
||||
Managers/Mass.h
|
||||
Managers/Mass.cpp
|
||||
Managers/Profile.h
|
||||
Managers/Profile.cpp
|
||||
Maps/ArmourSlots.hpp
|
||||
Maps/BulletLauncherAttachmentStyles.hpp
|
||||
Maps/BulletLauncherSockets.hpp
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
#include "../Logger/Logger.h"
|
||||
|
||||
#include "MassManager.h"
|
||||
#include "Mass.h"
|
||||
|
||||
using namespace Containers::Literals;
|
||||
|
||||
namespace mbst {
|
||||
namespace mbst { namespace Managers {
|
||||
|
||||
MassManager::MassManager(Containers::StringView save_path, Containers::StringView account, bool demo,
|
||||
Mass::Mass(Containers::StringView save_path, Containers::StringView account, bool demo,
|
||||
Containers::StringView staging_dir):
|
||||
_saveDirectory{save_path}, _account{account}, _demo{demo}, _stagingAreaDirectory{staging_dir}
|
||||
{
|
||||
|
@ -42,17 +42,17 @@ MassManager::MassManager(Containers::StringView save_path, Containers::StringVie
|
|||
}
|
||||
|
||||
Containers::StringView
|
||||
MassManager::lastError() {
|
||||
Mass::lastError() {
|
||||
return _lastError;
|
||||
}
|
||||
|
||||
GameObjects::Mass&
|
||||
MassManager::hangar(std::int32_t hangar) {
|
||||
Mass::hangar(std::int32_t hangar) {
|
||||
return _hangars[hangar];
|
||||
}
|
||||
|
||||
void
|
||||
MassManager::refreshHangar(std::int32_t hangar) {
|
||||
Mass::refreshHangar(std::int32_t hangar) {
|
||||
if(hangar < 0 || hangar >= 32) {
|
||||
_lastError = "Hangar index out of range.";
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -66,7 +66,7 @@ MassManager::refreshHangar(std::int32_t hangar) {
|
|||
}
|
||||
|
||||
bool
|
||||
MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) {
|
||||
Mass::importMass(Containers::StringView staged_fn, std::int32_t hangar) {
|
||||
if(hangar < 0 || hangar >= 32) {
|
||||
_lastError = "Hangar index out of range.";
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -109,7 +109,7 @@ MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) {
|
|||
}
|
||||
|
||||
bool
|
||||
MassManager::exportMass(std::int32_t hangar) {
|
||||
Mass::exportMass(std::int32_t hangar) {
|
||||
if(hangar < 0 || hangar >= 32) {
|
||||
_lastError = "Hangar index out of range."_s;
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -136,7 +136,7 @@ MassManager::exportMass(std::int32_t hangar) {
|
|||
}
|
||||
|
||||
bool
|
||||
MassManager::moveMass(std::int32_t source, std::int32_t destination) {
|
||||
Mass::moveMass(std::int32_t source, std::int32_t destination) {
|
||||
if(source < 0 || source >= 32) {
|
||||
_lastError = "Source hangar index out of range."_s;
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -174,7 +174,7 @@ MassManager::moveMass(std::int32_t source, std::int32_t destination) {
|
|||
}
|
||||
|
||||
bool
|
||||
MassManager::deleteMass(std::int32_t hangar) {
|
||||
Mass::deleteMass(std::int32_t hangar) {
|
||||
if(hangar < 0 || hangar >= 32) {
|
||||
_lastError = "Hangar index out of range."_s;
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -191,12 +191,12 @@ MassManager::deleteMass(std::int32_t hangar) {
|
|||
}
|
||||
|
||||
const std::map<Containers::String, Containers::String>&
|
||||
MassManager::stagedMasses() {
|
||||
Mass::stagedMasses() {
|
||||
return _stagedMasses;
|
||||
}
|
||||
|
||||
void
|
||||
MassManager::refreshStagedMasses() {
|
||||
Mass::refreshStagedMasses() {
|
||||
_stagedMasses.clear();
|
||||
|
||||
using Utility::Path::ListFlag;
|
||||
|
@ -229,7 +229,7 @@ MassManager::refreshStagedMasses() {
|
|||
}
|
||||
|
||||
void
|
||||
MassManager::refreshStagedMass(Containers::StringView filename) {
|
||||
Mass::refreshStagedMass(Containers::StringView filename) {
|
||||
LOG_INFO_FORMAT("Refreshing staged unit with filename {}.", filename);
|
||||
|
||||
bool file_exists = Utility::Path::exists(Utility::Path::join(_stagingAreaDirectory, filename));
|
||||
|
@ -250,7 +250,7 @@ MassManager::refreshStagedMass(Containers::StringView filename) {
|
|||
}
|
||||
|
||||
bool
|
||||
MassManager::deleteStagedMass(Containers::StringView filename) {
|
||||
Mass::deleteStagedMass(Containers::StringView filename) {
|
||||
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;
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -266,4 +266,4 @@ MassManager::deleteStagedMass(Containers::StringView filename) {
|
|||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}}
|
|
@ -26,11 +26,11 @@
|
|||
|
||||
using namespace Corrade;
|
||||
|
||||
namespace mbst {
|
||||
namespace mbst { namespace Managers {
|
||||
|
||||
class MassManager {
|
||||
class Mass {
|
||||
public:
|
||||
MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir);
|
||||
Mass(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir);
|
||||
|
||||
auto lastError() -> Containers::StringView;
|
||||
|
||||
|
@ -63,4 +63,4 @@ class MassManager {
|
|||
std::map<Containers::String, Containers::String> _stagedMasses;
|
||||
};
|
||||
|
||||
}
|
||||
}}
|
|
@ -29,13 +29,13 @@
|
|||
|
||||
#include "../Logger/Logger.h"
|
||||
|
||||
#include "ProfileManager.h"
|
||||
#include "Profile.h"
|
||||
|
||||
using namespace Containers::Literals;
|
||||
|
||||
namespace mbst {
|
||||
namespace mbst { namespace Managers {
|
||||
|
||||
ProfileManager::ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir):
|
||||
Profile::Profile(Containers::StringView save_dir, Containers::StringView backup_dir):
|
||||
_saveDirectory{save_dir},
|
||||
_backupsDirectory{backup_dir}
|
||||
{
|
||||
|
@ -43,22 +43,22 @@ ProfileManager::ProfileManager(Containers::StringView save_dir, Containers::Stri
|
|||
}
|
||||
|
||||
bool
|
||||
ProfileManager::ready() const {
|
||||
Profile::ready() const {
|
||||
return _ready;
|
||||
}
|
||||
|
||||
Containers::StringView
|
||||
ProfileManager::lastError() {
|
||||
Profile::lastError() {
|
||||
return _lastError;
|
||||
}
|
||||
|
||||
Containers::ArrayView<GameObjects::Profile>
|
||||
ProfileManager::profiles() {
|
||||
Profile::profiles() {
|
||||
return _profiles;
|
||||
}
|
||||
|
||||
bool
|
||||
ProfileManager::refreshProfiles() {
|
||||
Profile::refreshProfiles() {
|
||||
LOG_INFO("Refreshing profiles.");
|
||||
|
||||
_profiles = Containers::Array<GameObjects::Profile>{};
|
||||
|
@ -100,12 +100,12 @@ ProfileManager::refreshProfiles() {
|
|||
}
|
||||
|
||||
GameObjects::Profile*
|
||||
ProfileManager::getProfile(std::size_t index) {
|
||||
Profile::getProfile(std::size_t index) {
|
||||
return index <= _profiles.size() ? &(_profiles[index]) : nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
ProfileManager::deleteProfile(std::size_t index, bool delete_builds) {
|
||||
Profile::deleteProfile(std::size_t index, bool delete_builds) {
|
||||
if(!Utility::Path::remove(Utility::Path::join(_saveDirectory, _profiles[index].filename()))) {
|
||||
_lastError = Utility::format("Couldn't delete {} (filename: {}).",
|
||||
_profiles[index].companyName(),
|
||||
|
@ -136,7 +136,7 @@ ProfileManager::deleteProfile(std::size_t index, bool delete_builds) {
|
|||
}
|
||||
|
||||
bool
|
||||
ProfileManager::backupProfile(std::size_t index, bool backup_builds) {
|
||||
Profile::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::tm* time = std::localtime(×tamp);
|
||||
auto& profile = _profiles[index];
|
||||
|
@ -213,12 +213,12 @@ ProfileManager::backupProfile(std::size_t index, bool backup_builds) {
|
|||
}
|
||||
|
||||
Containers::ArrayView<Backup>
|
||||
ProfileManager::backups() {
|
||||
Profile::backups() {
|
||||
return _backups;
|
||||
}
|
||||
|
||||
void
|
||||
ProfileManager::refreshBackups() {
|
||||
Profile::refreshBackups() {
|
||||
_backups = Containers::Array<Backup>{};
|
||||
|
||||
using Utility::Path::ListFlag;
|
||||
|
@ -303,7 +303,7 @@ ProfileManager::refreshBackups() {
|
|||
}
|
||||
|
||||
bool
|
||||
ProfileManager::deleteBackup(std::size_t index) {
|
||||
Profile::deleteBackup(std::size_t index) {
|
||||
if(!Utility::Path::remove(Utility::Path::join(_backupsDirectory, _backups[index].filename))) {
|
||||
_lastError = "Couldn't delete " + _backups[index].filename;
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -321,7 +321,7 @@ ProfileManager::deleteBackup(std::size_t index) {
|
|||
}
|
||||
|
||||
bool
|
||||
ProfileManager::restoreBackup(std::size_t index) {
|
||||
Profile::restoreBackup(std::size_t index) {
|
||||
const Backup& backup = _backups[index];
|
||||
|
||||
auto error_format = "Extraction of file {} failed: {}"_s;
|
||||
|
@ -380,4 +380,4 @@ ProfileManager::restoreBackup(std::size_t index) {
|
|||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}}
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
using namespace Corrade;
|
||||
|
||||
namespace mbst {
|
||||
namespace mbst { namespace Managers {
|
||||
|
||||
struct Backup {
|
||||
Containers::String filename;
|
||||
|
@ -44,9 +44,9 @@ struct Backup {
|
|||
Containers::Array<Containers::String> includedFiles;
|
||||
};
|
||||
|
||||
class ProfileManager {
|
||||
class Profile {
|
||||
public:
|
||||
explicit ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir);
|
||||
explicit Profile(Containers::StringView save_dir, Containers::StringView backup_dir);
|
||||
|
||||
auto ready() const -> bool;
|
||||
auto lastError() -> Containers::StringView;
|
||||
|
@ -75,4 +75,4 @@ class ProfileManager {
|
|||
Containers::Array<Backup> _backups;
|
||||
};
|
||||
|
||||
}
|
||||
}}
|
Loading…
Reference in a new issue