Build viewer/editor #13
2 changed files with 90 additions and 1 deletions
|
@ -177,9 +177,15 @@ void Mass::refreshValues() {
|
||||||
if(!_demo)
|
if(!_demo)
|
||||||
{
|
{
|
||||||
getGlobalStyles();
|
getGlobalStyles();
|
||||||
|
if(_state == State::Invalid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: tuning
|
getTuning();
|
||||||
|
if(_state == State::Invalid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto account_prop = _mass->at<StringProperty>("Account");
|
auto account_prop = _mass->at<StringProperty>("Account");
|
||||||
if(!account_prop) {
|
if(!account_prop) {
|
||||||
|
@ -883,6 +889,47 @@ auto Mass::writeGlobalStyle(UnsignedLong index) -> bool {
|
||||||
return setCustomStyle(_globalStyles[index], index, global_styles);
|
return setCustomStyle(_globalStyles[index], index, global_styles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mass::getTuning() {
|
||||||
|
getTuningCategory("Engine", _tuning.engineId, "Gears", _tuning.gearIds);
|
||||||
|
if(_state == State::Invalid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTuningCategory("OS", _tuning.osId, "Modules", _tuning.moduleIds);
|
||||||
|
if(_state == State::Invalid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTuningCategory("Architect", _tuning.archId, "Techs", _tuning.techIds);
|
||||||
|
if(_state == State::Invalid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Mass::engine() -> Int& {
|
||||||
|
return _tuning.engineId;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Mass::gears() -> Containers::ArrayView<Int> {
|
||||||
|
return _tuning.gearIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Mass::os() -> Int& {
|
||||||
|
return _tuning.osId;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Mass::modules() -> Containers::ArrayView<Int> {
|
||||||
|
return _tuning.moduleIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Mass::architecture() -> Int& {
|
||||||
|
return _tuning.archId;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Mass::techs() -> Containers::ArrayView<Int> {
|
||||||
|
return _tuning.techIds;
|
||||||
|
}
|
||||||
|
|
||||||
auto Mass::updateSteamId(const std::string& steam_id) -> bool {
|
auto Mass::updateSteamId(const std::string& steam_id) -> bool {
|
||||||
_steamId = steam_id;
|
_steamId = steam_id;
|
||||||
|
|
||||||
|
@ -1196,3 +1243,31 @@ auto Mass::writeWeaponType(const char* prop_name, Containers::ArrayView<Weapon>
|
||||||
|
|
||||||
return _mass->saveToFile();
|
return _mass->saveToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mass::getTuningCategory(const char* big_node_prop_name, Int& big_node_id,
|
||||||
|
const char* small_nodes_prop_name, Containers::ArrayView<Int> small_nodes_ids)
|
||||||
|
{
|
||||||
|
auto node_id = _mass->at<IntProperty>(big_node_prop_name);
|
||||||
|
if(!node_id) {
|
||||||
|
_state = State::Invalid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
big_node_id = node_id->value;
|
||||||
|
|
||||||
|
auto node_ids = _mass->at<ArrayProperty>(small_nodes_prop_name);
|
||||||
|
if(!node_ids) {
|
||||||
|
_state = State::Invalid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(node_ids->items.size() != small_nodes_ids.size()) {
|
||||||
|
_state = State::Invalid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(UnsignedInt i = 0; i < small_nodes_ids.size(); i++) {
|
||||||
|
auto small_node_id = node_ids->at<IntProperty>(i);
|
||||||
|
CORRADE_INTERNAL_ASSERT(small_node_id);
|
||||||
|
small_nodes_ids[i] = small_node_id->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -196,6 +196,17 @@ class Mass {
|
||||||
void getGlobalStyles();
|
void getGlobalStyles();
|
||||||
auto writeGlobalStyle(UnsignedLong index) -> bool;
|
auto writeGlobalStyle(UnsignedLong index) -> bool;
|
||||||
|
|
||||||
|
void getTuning();
|
||||||
|
|
||||||
|
auto engine() -> Int&;
|
||||||
|
auto gears() -> Containers::ArrayView<Int>;
|
||||||
|
|
||||||
|
auto os() -> Int&;
|
||||||
|
auto modules() -> Containers::ArrayView<Int>;
|
||||||
|
|
||||||
|
auto architecture() -> Int&;
|
||||||
|
auto techs() -> Containers::ArrayView<Int>;
|
||||||
|
|
||||||
auto updateSteamId(const std::string& steam_id) -> bool;
|
auto updateSteamId(const std::string& steam_id) -> bool;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -208,6 +219,9 @@ class Mass {
|
||||||
void getWeaponType(const char* prop_name, Containers::ArrayView<Weapon> weapon_array);
|
void getWeaponType(const char* prop_name, Containers::ArrayView<Weapon> weapon_array);
|
||||||
auto writeWeaponType(const char* prop_name, Containers::ArrayView<Weapon> weapon_array) -> bool;
|
auto writeWeaponType(const char* prop_name, Containers::ArrayView<Weapon> weapon_array) -> bool;
|
||||||
|
|
||||||
|
void getTuningCategory(const char* big_node_prop_name, Int& big_node_id,
|
||||||
|
const char* small_nodes_prop_name, Containers::ArrayView<Int> small_nodes_ids);
|
||||||
|
|
||||||
Containers::Optional<UESaveFile> _mass;
|
Containers::Optional<UESaveFile> _mass;
|
||||||
|
|
||||||
static std::string _lastError;
|
static std::string _lastError;
|
||||||
|
|
Loading…
Reference in a new issue