Codechange: Rename _current_data to _current_gamestrings_data.
This commit is contained in:
@@ -311,7 +311,7 @@ void GameStrings::Compile()
|
||||
}
|
||||
|
||||
/** The currently loaded game strings. */
|
||||
std::shared_ptr<GameStrings> _current_data = nullptr;
|
||||
std::shared_ptr<GameStrings> _current_gamestrings_data = nullptr;
|
||||
|
||||
/**
|
||||
* Get the string pointer of a particular game string.
|
||||
@@ -320,8 +320,8 @@ std::shared_ptr<GameStrings> _current_data = nullptr;
|
||||
*/
|
||||
std::string_view GetGameStringPtr(StringIndexInTab id)
|
||||
{
|
||||
if (_current_data == nullptr || _current_data->cur_language == nullptr || id.base() >= _current_data->cur_language->lines.size()) return GetStringPtr(STR_UNDEFINED);
|
||||
return _current_data->cur_language->lines[id];
|
||||
if (_current_gamestrings_data == nullptr || _current_gamestrings_data->cur_language == nullptr || id.base() >= _current_gamestrings_data->cur_language->lines.size()) return GetStringPtr(STR_UNDEFINED);
|
||||
return _current_gamestrings_data->cur_language->lines[id];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,8 +334,8 @@ const StringParams &GetGameStringParams(StringIndexInTab id)
|
||||
/* An empty result for STR_UNDEFINED. */
|
||||
static StringParams empty;
|
||||
|
||||
if (id.base() >= _current_data->string_params.size()) return empty;
|
||||
return _current_data->string_params[id];
|
||||
if (id.base() >= _current_gamestrings_data->string_params.size()) return empty;
|
||||
return _current_gamestrings_data->string_params[id];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,8 +348,8 @@ const std::string &GetGameStringName(StringIndexInTab id)
|
||||
/* The name for STR_UNDEFINED. */
|
||||
static const std::string undefined = "STR_UNDEFINED";
|
||||
|
||||
if (id.base() >= _current_data->string_names.size()) return undefined;
|
||||
return _current_data->string_names[id];
|
||||
if (id.base() >= _current_gamestrings_data->string_names.size()) return undefined;
|
||||
return _current_gamestrings_data->string_names[id];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -358,8 +358,8 @@ const std::string &GetGameStringName(StringIndexInTab id)
|
||||
*/
|
||||
void RegisterGameTranslation(Squirrel *engine)
|
||||
{
|
||||
_current_data = LoadTranslations();
|
||||
if (_current_data == nullptr) return;
|
||||
_current_gamestrings_data = LoadTranslations();
|
||||
if (_current_gamestrings_data == nullptr) return;
|
||||
|
||||
HSQUIRRELVM vm = engine->GetVM();
|
||||
sq_pushroottable(vm);
|
||||
@@ -367,7 +367,7 @@ void RegisterGameTranslation(Squirrel *engine)
|
||||
if (SQ_FAILED(sq_get(vm, -2))) return;
|
||||
|
||||
int idx = 0;
|
||||
for (const auto &p : _current_data->string_names) {
|
||||
for (const auto &p : _current_gamestrings_data->string_names) {
|
||||
sq_pushstring(vm, p, -1);
|
||||
sq_pushinteger(vm, idx);
|
||||
sq_rawset(vm, -3);
|
||||
@@ -384,15 +384,15 @@ void RegisterGameTranslation(Squirrel *engine)
|
||||
*/
|
||||
void ReconsiderGameScriptLanguage()
|
||||
{
|
||||
if (_current_data == nullptr) return;
|
||||
if (_current_gamestrings_data == nullptr) return;
|
||||
|
||||
std::string language = FS2OTTD(_current_language->file.stem());
|
||||
for (auto &p : _current_data->compiled_strings) {
|
||||
for (auto &p : _current_gamestrings_data->compiled_strings) {
|
||||
if (p.language == language) {
|
||||
_current_data->cur_language = &p;
|
||||
_current_gamestrings_data->cur_language = &p;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_current_data->cur_language = &_current_data->compiled_strings[0];
|
||||
_current_gamestrings_data->cur_language = &_current_gamestrings_data->compiled_strings[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user