mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-04-30 09:01:41 -04:00
refined 'AddInfantry' function, simplified for most called cases .
This commit is contained in:
parent
602550eb6a
commit
718423eef0
4 changed files with 11 additions and 9 deletions
|
@ -2259,7 +2259,7 @@ void CIsoView::HandleProperties(int n, int type)
|
|||
|
||||
|
||||
Map->DeleteInfantry(n);
|
||||
Map->AddInfantry(&data, nullptr, nullptr, 0, n);
|
||||
Map->AddInfantry(&data, n);
|
||||
|
||||
RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
|
||||
break;
|
||||
|
@ -3015,7 +3015,7 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point)
|
|||
Map->DeleteInfantry(m_id);
|
||||
}
|
||||
|
||||
Map->AddInfantry(&infantry, nullptr, nullptr, 0, m_id);
|
||||
Map->AddInfantry(&infantry, m_id);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -4866,7 +4866,7 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y)
|
|||
return;
|
||||
}
|
||||
|
||||
Map->AddInfantry(NULL, AD.data_s, currentOwner, x + y * Map->GetIsoSize());
|
||||
Map->AddInfantry(NULL, -1, AD.data_s, currentOwner, x + y * Map->GetIsoSize());
|
||||
//RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
|
||||
} break;
|
||||
case MouseActionType::AddStructure: {
|
||||
|
@ -4954,7 +4954,7 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y)
|
|||
Map->GetInfantryData(t, &infantry);
|
||||
Map->DeleteInfantry(t);
|
||||
infantry.house = AD.data_s;
|
||||
Map->AddInfantry(&infantry);
|
||||
Map->AddInfantry(&infantry, t);
|
||||
bchanged = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2180,7 +2180,7 @@ BOOL CMapData::AddNode(NODE* lpNode, WORD dwPos)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CMapData::AddInfantry(INFANTRY* lpInfantry, LPCTSTR lpType, LPCTSTR lpHouse, DWORD dwPos, int suggestedIndex)
|
||||
BOOL CMapData::AddInfantry(INFANTRY* lpInfantry, int suggestedIndex, LPCTSTR lpType, LPCTSTR lpHouse, DWORD dwPos)
|
||||
{
|
||||
|
||||
INFANTRY infantry;
|
||||
|
@ -2238,7 +2238,7 @@ BOOL CMapData::AddInfantry(INFANTRY* lpInfantry, LPCTSTR lpType, LPCTSTR lpHouse
|
|||
itoa(i, c, 10);
|
||||
inf.pos = c;
|
||||
DeleteInfantry(oldInf);
|
||||
AddInfantry(&inf);
|
||||
AddInfantry(&inf, oldInf);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6337,7 +6337,9 @@ void CMapData::ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeigh
|
|||
int y = atoi(obj.y);
|
||||
|
||||
|
||||
if (x < 0 || y < 0 || x >= m_IsoSize || y >= m_IsoSize) continue;
|
||||
if (x < 0 || y < 0 || x >= m_IsoSize || y >= m_IsoSize) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AddInfantry(&obj);
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ public:
|
|||
INT GetUnitTypeID(LPCTSTR lpType);
|
||||
void InitializeUnitTypes();
|
||||
BOOL AddStructure(STRUCTURE* lpStructure, LPCTSTR lpType = NULL, LPCTSTR lpHouse = NULL, DWORD dwPos = 0, CString suggestedID = "");
|
||||
BOOL AddInfantry(INFANTRY* lpInfantry, LPCTSTR lpType = NULL, LPCTSTR lpHouse = NULL, DWORD dwPos = 0, int suggestedIndex = -1);
|
||||
BOOL AddInfantry(INFANTRY* lpInfantry, int suggestedIndex = -1, LPCTSTR lpType = NULL, LPCTSTR lpHouse = NULL, DWORD dwPos = 0);
|
||||
BOOL AddNode(NODE* lpNode, WORD dwPos);
|
||||
void GetStdStructureData(DWORD dwIndex, STDOBJECTDATA* lpStdStructure) const;
|
||||
CString GetStructureData(DWORD dwIndex, STRUCTURE* lpStructure) const;
|
||||
|
|
|
@ -2350,7 +2350,7 @@ void CUserScriptsDlg::OnOK()
|
|||
id.flag4 = GetParam(data, 12);
|
||||
id.flag5 = GetParam(data, 13);
|
||||
|
||||
if (Map->AddInfantry(&id, NULL, NULL, NULL, lastInfantryDeleted) == FALSE) {
|
||||
if (Map->AddInfantry(&id, lastInfantryDeleted, NULL, NULL, NULL) == FALSE) {
|
||||
report += "AddInfantry failed\r\n";
|
||||
} else {
|
||||
report += "Infantry added\r\n";
|
||||
|
|
Loading…
Add table
Reference in a new issue