Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Source/Graphics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ struct sImage {
void LoadPalette(size_t pFrom, const size_t pCount, const size_t pStartColorID = 0) {

auto Buffer = mData->data();
const size_t BufferSize = mData->size();
const size_t PaletteBytes = pCount * 3;
if (pFrom >= BufferSize || (BufferSize - pFrom) < PaletteBytes)
return;

for (size_t ColorID = pStartColorID; ColorID < pStartColorID + pCount; ColorID++) {

Expand Down
3 changes: 2 additions & 1 deletion Source/PC/Graphics_PC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ void cGraphics_PC::Load_Hill_Data() {

// Parts of this surface have the recruits from mImageRecruit copied onto it
mImageHillSprites = Decode_Image("hill.dat", 0x50, 0xFA00, 0x00);
for (uint32 x = 0; x < 0xA000; ++x) {
const uint32 ClearCount = std::min<uint32>(0xA000, mImageHillSprites.mData->size());
for (uint32 x = 0; x < ClearCount; ++x) {
mImageHillSprites.mData->data()[x] = 0;
}
}
Expand Down
Loading