Skip to content

Commit

Permalink
Don't crash if no loading tips found
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Apr 2, 2019
1 parent 7984af7 commit a799fc4
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/xrGame/GamePersistent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,21 +880,28 @@ void CGamePersistent::LoadTitle(bool change_tip, shared_str map_name)
pApp->LoadStage();
if (change_tip)
{
bool noTips = false;
string512 buff;
u8 tip_num;
luabind::functor<u8> m_functor;
bool is_single = !xr_strcmp(m_game_params.m_game_type, "single");
const bool is_single = !xr_strcmp(m_game_params.m_game_type, "single");
if (is_single)
{
R_ASSERT(GEnv.ScriptEngine->functor("loadscreen.get_tip_number", m_functor));
tip_num = m_functor(map_name.c_str());
if (GEnv.ScriptEngine->functor("loadscreen.get_tip_number", m_functor))
tip_num = m_functor(map_name.c_str());
else
noTips = true;
}
else
{
R_ASSERT(GEnv.ScriptEngine->functor("loadscreen.get_mp_tip_number", m_functor));
tip_num = m_functor(map_name.c_str());
if (GEnv.ScriptEngine->functor("loadscreen.get_mp_tip_number", m_functor))
tip_num = m_functor(map_name.c_str());
else
noTips = true;
}
// tip_num = 83;
if (noTips)
return;

xr_sprintf(buff, "%s%d:", StringTable().translate("ls_tip_number").c_str(), tip_num);
shared_str tmp = buff;

Expand Down

0 comments on commit a799fc4

Please sign in to comment.