Merge pull request #178 from lioncash/phack-cleanup

Clean up a little bit of the PHackSettings.
This commit is contained in:
Pierre Bourdon 2014-03-16 23:49:12 +01:00
commit fe37a772a4
1 changed files with 12 additions and 6 deletions

View File

@ -87,20 +87,25 @@ void CPHackSettings::CreateGUIControls()
void CPHackSettings::LoadPHackData() void CPHackSettings::LoadPHackData()
{ {
std::string sTemp; std::string sTemp;
char sIndex[15]; std::string sIndex;
PHackChoice->Clear(); PHackChoice->Clear();
PHackChoice->Append(_("[Custom]")); PHackChoice->Append(_("[Custom]"));
for (int i = 0; ; i++) for (int i = 0; ; i++)
{ {
sprintf(sIndex,"%d",i); sIndex = std::to_string(i);
if (!PHPresetsIni.Exists(sIndex, "Title")) if (!PHPresetsIni.Exists(sIndex, "Title"))
break; break;
PHPresetsIni.Get(sIndex, "Title", &sTemp); PHPresetsIni.Get(sIndex, "Title", &sTemp);
if (sTemp.empty()) if (sTemp.empty())
sTemp = wxString(_("(UNKNOWN)")).char_str(); sTemp = WxStrToStr(_("(UNKNOWN)"));
if (i == 0) if (i == 0)
PHackChoice->Append(StrToWxStr("-------------")); PHackChoice->Append(StrToWxStr("-------------"));
PHackChoice->Append(StrToWxStr(sTemp)); PHackChoice->Append(StrToWxStr(sTemp));
} }
PHackChoice->Select(0); PHackChoice->Select(0);
@ -116,12 +121,13 @@ void CPHackSettings::SetRefresh(wxCommandEvent& event)
{ {
bool bTemp; bool bTemp;
std::string sTemp; std::string sTemp;
char sIndex[15]; std::string sIndex;
int index = event.GetSelection(); int index = event.GetSelection();
if (index > 1) if (index > 1)
{ {
index -= 2; index -= 2;
sprintf(sIndex,"%d", index); sIndex = std::to_string(index);
PHPresetsIni.Get(sIndex, "PH_SZNear", &bTemp); PHPresetsIni.Get(sIndex, "PH_SZNear", &bTemp);
PHackSZNear->Set3StateValue((wxCheckBoxState)bTemp); PHackSZNear->Set3StateValue((wxCheckBoxState)bTemp);