added some friendly comments, hoping it will reduce struggle of the future maintenance .

This commit is contained in:
Zero Fanker 2024-11-20 22:30:51 -05:00
parent f2150618d4
commit f5601fb046
2 changed files with 11 additions and 2 deletions

View file

@ -435,9 +435,13 @@ void CTriggerEventsDlg::OnSelchangeParameter()
int original_cuparam = curparam;
#ifdef RA2_MODE
CString Param1 = GetParam(g_data["EventsRA2"][GetParam(EventData, startpos)], 1);
// 3rd position control code
CString Code = GetParam(g_data["ParamTypes"][Param1], 2);
//MessageBox(Param1, Code);
if (atoi(Code) == 2) curparam--;
// means there are parameters taken up 2 slots, even if only 1 is meaningful
if (atoi(Code) == 2) {
curparam--;
}
#endif
// END FIx

View file

@ -88,6 +88,11 @@ inline CString GetUnitPictureFilename(const CString& artSectionId, DWORD dwPicIn
return {};
}
/**
* @brief Retrieve a stringified parameter from a serialized string, concated with ','
* @param data Serialized string input
* @param param Nth param to retrieve, starts from 0
*/
inline CString GetParam(const CString& data, const int param)
{
int paramStrPos = 0;