src/externalized/ModPackContentManager.cc
/** Load dialogue quote from file. */
Load dialogue quote from file.
Load dialogue quote from file .
ST::string* ModPackContentManager::loadDialogQuoteFromFile(const char* filename, int quote_number)
{
	std::string jsonFileName = std::string(filename) + ".json";
	std::map<std::string, std::vector<std::string> >::iterator it = m_dialogQuotesMap.find(jsonFileName);
	if(it != m_dialogQuotesMap.end())
	{
		SLOGD("cached quote %d %s", quote_number, jsonFileName.c_str());
		return new ST::string(it->second[quote_number].c_str());
	}
	else
	{
		if(doesGameResExists(jsonFileName.c_str()))
		{
			AutoSGPFile f(openGameResForReading(jsonFileName));
			std::string jsonQuotes = FileMan::fileReadText(f);
			std::vector<std::string> quotes;
			JsonUtility::parseJsonToListStrings(jsonQuotes.c_str(), quotes);
			m_dialogQuotesMap[jsonFileName] = quotes;
			return new ST::string(quotes[quote_number].c_str());
		}
		else
		{
			return DefaultContentManager::loadDialogQuoteFromFile(filename, quote_number);
		}
	}
}
ST :: string * ModPackContentManager :: loadDialogQuoteFromFile ( const char * filename , int quote_number ) { std :: string jsonFileName = std :: string ( filename ) + " " ; std :: map < std :: string , std :: vector < std :: string > > :: iterator it = m_dialogQuotesMap . find ( jsonFileName ) ; if ( it != m_dialogQuotesMap . end ( ) ) { SLOGD ( " " , quote_number , jsonFileName . c_str ( ) ) ; return new ST :: string ( it -> second [ quote_number ] . c_str ( ) ) ; } else { if ( doesGameResExists ( jsonFileName . c_str ( ) ) ) { AutoSGPFile f ( openGameResForReading ( jsonFileName ) ) ; std :: string jsonQuotes = FileMan :: fileReadText ( f ) ; std :: vector < std :: string > quotes ; JsonUtility :: parseJsonToListStrings ( jsonQuotes . c_str ( ) , quotes ) ; m_dialogQuotesMap [ jsonFileName ] = quotes ; return new ST :: string ( quotes [ quote_number ] . c_str ( ) ) ; } else { return DefaultContentManager :: loadDialogQuoteFromFile ( filename , quote_number ) ; } } }
Load dialogue quote from file.
Load dialogue quote from file .