mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-05-05 03:01:42 -04:00
roughly expanded overlay pic buffer to 0x1000, and added some safety guardian to avoid crash .
This commit is contained in:
parent
172e67823d
commit
a2117f8c25
2 changed files with 17 additions and 7 deletions
|
@ -238,8 +238,15 @@ CString* CIniFileSection::GetValue(std::size_t index) noexcept
|
|||
return NULL;
|
||||
|
||||
auto i = values.begin();
|
||||
for (auto e = 0;e < index;e++)
|
||||
for (auto e = 0; e < index; e++) {
|
||||
if (i == values.end()) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (i == values.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &i->second;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ void GetNodeName(CString& name, int n);
|
|||
/* --------- */
|
||||
|
||||
/* Overlay picture table (maximum overlay count=0xFF) */
|
||||
PICDATA* ovrlpics[0xFF][max_ovrl_img];
|
||||
PICDATA* ovrlpics[0x1000][max_ovrl_img];
|
||||
|
||||
// cancel draw flag
|
||||
BOOL bCancelDraw = FALSE;
|
||||
|
@ -5911,11 +5911,14 @@ void CIsoView::DrawMap()
|
|||
{
|
||||
if (!pic.bTried)
|
||||
{
|
||||
SetError("Loading graphics");
|
||||
theApp.m_loading->LoadOverlayGraphic(*rules.sections["OverlayTypes"].GetValue(m.overlay), m.overlay);
|
||||
UpdateOverlayPictures(m.overlay);
|
||||
if (ovrlpics[m.overlay][m.overlaydata] != NULL)
|
||||
pic = *ovrlpics[m.overlay][m.overlaydata];
|
||||
if (auto const pOverlayId = rules.sections["OverlayTypes"].GetValue(m.overlay)) {
|
||||
SetError("Loading graphics");
|
||||
theApp.m_loading->LoadOverlayGraphic(*pOverlayId, m.overlay);
|
||||
UpdateOverlayPictures(m.overlay);
|
||||
if (ovrlpics[m.overlay][m.overlaydata] != NULL) {
|
||||
pic = *ovrlpics[m.overlay][m.overlaydata];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pic.pic == NULL)
|
||||
|
|
Loading…
Add table
Reference in a new issue