diff --git a/src/GameObjects/Mass.cpp b/src/GameObjects/Mass.cpp index 6025185..b31fce5 100644 --- a/src/GameObjects/Mass.cpp +++ b/src/GameObjects/Mass.cpp @@ -56,28 +56,14 @@ Mass::getNameFromFile(Containers::StringView path) { return Containers::NullOpt; } - Gvas::File mass{path}; + Mass mass{path}; - if(!mass.valid()) { - LOG_ERROR_FORMAT("{} is invalid: {}", path, mass.lastError()); + if(mass._state != State::Valid) { + LOG_ERROR_FORMAT("{} is invalid: {}", path, mass._lastError); return Containers::NullOpt; } - auto unit_data = mass.at(MASS_UNIT_DATA); - - if(!unit_data) { - LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, path); - return Containers::NullOpt; - } - - auto name_prop = unit_data->at(MASS_NAME); - - if(!name_prop) { - LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_NAME, path); - return Containers::NullOpt; - } - - return {name_prop->value}; + return mass._name; } void