//--------------------------------------------------------- bool CSG_MetaData::Load_JSON(const CSG_String &File) { CSG_File Stream; CSG_String JSON; if( Stream.Open(File, SG_FILE_R, false) && Stream.Read(JSON, (size_t)Stream.Length()) > 0 ) { return( from_JSON(JSON) ); } return( false ); }
spell_list_t::spell_list_t(std::string const& filepath) { LOG("loading spells from %s", filepath.c_str()); std::string json_str = util::read_text_file(filepath); cJSON* root = cJSON_Parse(json_str.c_str()); ASSERT(root, ""); from_JSON(root); cJSON_Delete(root); LOG("Spells Loaded: %zu", this->size()); }