mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-05-06 11:41:42 -04:00
#25, fixed waypoint related issue .
This commit is contained in:
parent
29caa6b9d8
commit
f5817e91ff
7 changed files with 46 additions and 29 deletions
|
@ -893,7 +893,7 @@ void CFinalSunDlg::SaveMap(CString FileName_)
|
|||
for (i = 0; i < Map->GetWaypointCount(); i++) {
|
||||
CString id;
|
||||
DWORD pos;
|
||||
Map->GetWaypointData(i, &id, &pos);
|
||||
Map->GetNthWaypointData(i, &id, &pos);
|
||||
int idi;
|
||||
idi = atoi(id);
|
||||
if (idi != i) break;
|
||||
|
@ -1055,7 +1055,7 @@ void CFinalSunDlg::SaveMap(CString FileName_)
|
|||
for (i = 0; i < Map->GetWaypointCount(); i++) {
|
||||
CString id;
|
||||
DWORD pos;
|
||||
Map->GetWaypointData(i, &id, &pos);
|
||||
Map->GetNthWaypointData(i, &id, &pos);
|
||||
int idi;
|
||||
idi = atoi(id);
|
||||
if (idi != i) {
|
||||
|
@ -1822,8 +1822,8 @@ void CFinalSunDlg::OnFileNew()
|
|||
last_succeeded_operation = 11003;
|
||||
|
||||
// create map function was created for SP. Fix it here;
|
||||
Map->DeleteWaypoint(0);
|
||||
Map->DeleteWaypoint(0);
|
||||
Map->DeleteWaypoint(98);
|
||||
Map->DeleteWaypoint(99);
|
||||
int midx = Map->GetIsoSize() / 2;
|
||||
int midy = Map->GetIsoSize() / 2;
|
||||
Map->AddWaypoint("0", midx + midy * Map->GetIsoSize());
|
||||
|
|
|
@ -1567,7 +1567,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point)
|
|||
for (i = 0; i < Map->GetWaypointCount(); i++) {
|
||||
CString id;
|
||||
DWORD pos;
|
||||
Map->GetWaypointData(i, &id, &pos);
|
||||
Map->GetNthWaypointData(i, &id, &pos);
|
||||
if (atoi(id) == e) bFound = TRUE;
|
||||
if (bFound) break;
|
||||
}
|
||||
|
@ -6151,7 +6151,7 @@ void CIsoView::FocusWaypoint(int index)
|
|||
|
||||
DWORD dwPos;
|
||||
|
||||
Map->GetWaypointData(index, NULL, &dwPos);
|
||||
Map->GetNthWaypointData(index, NULL, &dwPos);
|
||||
|
||||
x = dwPos % Map->GetIsoSize();
|
||||
y = dwPos / Map->GetIsoSize();
|
||||
|
|
|
@ -1872,15 +1872,11 @@ void CMapData::DeleteInfantry(DWORD dwIndex)
|
|||
|
||||
}
|
||||
|
||||
void CMapData::DeleteWaypoint(DWORD dwIndex)
|
||||
void CMapData::DeleteWaypoint(DWORD dwId)
|
||||
{
|
||||
if (dwIndex >= GetWaypointCount()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString id;
|
||||
DWORD pos;
|
||||
Map->GetWaypointData(dwIndex, &id, &pos);
|
||||
Map->GetWaypointData(dwId, &id, &pos);
|
||||
|
||||
int x = pos % m_IsoSize;
|
||||
int y = pos / m_IsoSize;
|
||||
|
@ -1895,9 +1891,11 @@ void CMapData::DeleteWaypoint(DWORD dwIndex)
|
|||
}
|
||||
|
||||
int k, l;
|
||||
for (k = -1; k < 2; k++)
|
||||
for (l = -1; l < 2; l++)
|
||||
for (k = -1; k < 2; k++) {
|
||||
for (l = -1; l < 2; l++) {
|
||||
Mini_UpdatePos(x + k, y + l, IsMultiplayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMapData::DeleteCelltag(DWORD dwIndex)
|
||||
|
@ -2771,7 +2769,7 @@ BOOL CMapData::IsGroundObjectAt(DWORD dwPos) const
|
|||
|
||||
}
|
||||
|
||||
void CMapData::GetWaypointData(DWORD dwIndex, CString* lpID, DWORD* lpdwPos) const
|
||||
void CMapData::GetNthWaypointData(DWORD dwIdx, CString* lpID, DWORD* lpdwPos) const
|
||||
{
|
||||
if (lpID) {
|
||||
*lpID = "";
|
||||
|
@ -2780,11 +2778,7 @@ void CMapData::GetWaypointData(DWORD dwIndex, CString* lpID, DWORD* lpdwPos) con
|
|||
*lpdwPos = 0;
|
||||
}
|
||||
|
||||
auto const& section = m_mapfile.GetSection("Waypoints");
|
||||
CString id;
|
||||
id.Format("%d", dwIndex);
|
||||
|
||||
auto const& data = section.GetString(id);
|
||||
auto const& [id, data] = m_mapfile.GetSection("Waypoints").Nth(dwIdx);
|
||||
|
||||
if (data.IsEmpty()) {
|
||||
return;
|
||||
|
@ -2801,6 +2795,26 @@ void CMapData::GetWaypointData(DWORD dwIndex, CString* lpID, DWORD* lpdwPos) con
|
|||
}
|
||||
}
|
||||
|
||||
void CMapData::GetWaypointData(DWORD dwId, CString* lpID, DWORD* lpdwPos) const
|
||||
{
|
||||
if (lpID) {
|
||||
*lpID = "";
|
||||
}
|
||||
if (lpdwPos) {
|
||||
*lpdwPos = 0;
|
||||
}
|
||||
|
||||
CString id;
|
||||
id.Format("%d", dwId);
|
||||
auto const& section = m_mapfile.GetSection("Waypoints");
|
||||
|
||||
auto const idx = section.FindIndex(id);
|
||||
|
||||
if (idx >= 0 && idx < section.Size()) {
|
||||
GetNthWaypointData(idx, lpID, lpdwPos);
|
||||
}
|
||||
}
|
||||
|
||||
void CMapData::GetStdAircraftData(DWORD dwIndex, STDOBJECTDATA* lpStdAircraft) const
|
||||
{
|
||||
auto const& section = m_mapfile.GetSection("Aircraft");
|
||||
|
@ -6094,7 +6108,7 @@ void CMapData::ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeigh
|
|||
DWORD pos;
|
||||
CString id;
|
||||
|
||||
GetWaypointData(i, &id, &pos);
|
||||
GetNthWaypointData(i, &id, &pos);
|
||||
|
||||
wp_id[i] = id;
|
||||
wp_pos[i] = pos;
|
||||
|
|
|
@ -387,7 +387,8 @@ public:
|
|||
DWORD GetInfantryCount() const;
|
||||
void GetStdUnitData(DWORD dwIndex, STDOBJECTDATA* lpStdUnit) const;
|
||||
void GetStdAircraftData(DWORD dwIndex, STDOBJECTDATA* lpStdAircraft) const;
|
||||
void GetWaypointData(DWORD dwIndex, CString* lpID, DWORD* lpdwPos) const;
|
||||
void GetNthWaypointData(DWORD dwIdx, CString* lpID, DWORD* lpdwPos) const;
|
||||
void GetWaypointData(DWORD dwId, CString* lpID, DWORD* lpdwPos) const;
|
||||
BOOL IsGroundObjectAt(DWORD dwPos) const;
|
||||
BOOL AddTerrain(LPCTSTR lpType, DWORD dwPos, int suggestedIndex = -1);
|
||||
void GetTerrainData(DWORD dwIndex, CString* lpType) const;
|
||||
|
@ -415,7 +416,7 @@ public:
|
|||
void DeleteStructure(DWORD dwIndex);
|
||||
void DeleteUnit(DWORD dwIndex);
|
||||
void DeleteCelltag(DWORD dwIndex);
|
||||
void DeleteWaypoint(DWORD dwIndex);
|
||||
void DeleteWaypoint(DWORD id);
|
||||
void DeleteInfantry(DWORD dwIndex);
|
||||
|
||||
INT GetCelltagAt(DWORD dwPos) const
|
||||
|
|
|
@ -159,7 +159,7 @@ BOOL CMapValidator::CheckMap()
|
|||
for (i = 0; i < d; i++) {
|
||||
DWORD pos;
|
||||
CString id;
|
||||
Map->GetWaypointData(i, &id, &pos);
|
||||
Map->GetNthWaypointData(i, &id, &pos);
|
||||
if (atoi(id) < 8) {
|
||||
below8found++;
|
||||
}
|
||||
|
@ -328,9 +328,11 @@ BOOL CMapValidator::CheckMap()
|
|||
DWORD pos;
|
||||
CString id;
|
||||
|
||||
Map->GetWaypointData(i, &id, &pos);
|
||||
Map->GetNthWaypointData(i, &id, &pos);
|
||||
|
||||
if (atoi(id) > 99) bWaypBig = TRUE;
|
||||
if (atoi(id) > 99) {
|
||||
bWaypBig = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (bWaypBig)
|
||||
|
|
|
@ -76,7 +76,7 @@ BOOL CSearchWaypointDlg::OnInitDialog()
|
|||
for (i = 0; i < count; i++) {
|
||||
CString id;
|
||||
DWORD pos;
|
||||
Map->GetWaypointData(i, &id, &pos);
|
||||
Map->GetNthWaypointData(i, &id, &pos);
|
||||
|
||||
ctrl.SetItemData(ctrl.InsertString(i, id), i);
|
||||
}
|
||||
|
|
|
@ -577,7 +577,7 @@ int get_player_count()
|
|||
for (i = 0; i < Map->GetWaypointCount(); i++) {
|
||||
CString id;
|
||||
DWORD pos;
|
||||
Map->GetWaypointData(i, &id, &pos);
|
||||
Map->GetNthWaypointData(i, &id, &pos);
|
||||
int idi;
|
||||
idi = atoi(id);
|
||||
if (idi != i) break;
|
||||
|
@ -1983,7 +1983,7 @@ void CUserScriptsDlg::OnOK()
|
|||
int k;
|
||||
for (k = 0; k < Map->GetWaypointCount(); k++) {
|
||||
CString id;
|
||||
Map->GetWaypointData(k, &id, &pos);
|
||||
Map->GetNthWaypointData(k, &id, &pos);
|
||||
|
||||
if (id == params[0]) {
|
||||
bFound = TRUE;
|
||||
|
|
Loading…
Add table
Reference in a new issue