Added missed update of frames number. Fixed wrong Asserts.

This commit is contained in:
alyokhin 2022-06-15 12:15:56 +03:00
parent 1ad80452fc
commit 71d15617ea

View file

@ -1007,7 +1007,7 @@ void CGraphic::AppendFrames(const sequence_of_images &frames)
ExpandFor(frames.size());
for (auto &frame : frames) {
SDL_Rect dstRect {frame_map[currFrame].x, frame_map[currFrame].y, Width, Height};
SDL_Rect dstRect { frame_map[currFrame].x, frame_map[currFrame].y, Width, Height };
SDL_BlitSurface(frame.get(), NULL, Surface, &dstRect);
currFrame++;
}
@ -1021,7 +1021,7 @@ void CGraphic::AppendFrames(const sequence_of_images &frames)
*/
void CGraphic::ExpandFor(const uint16_t numOfFramesToAdd)
{
Assert(numOfFramesToAdd > 0 && !Resized); /// We can't add frames into a resized graphic set
Assert(!Resized); /// We can't add frames into a resized graphic set
if (numOfFramesToAdd == 0) {
return;
@ -1063,8 +1063,7 @@ void CGraphic::ExpandFor(const uint16_t numOfFramesToAdd)
SDL_FreeSurface(Surface);
Surface = newSurface;
Assert(GraphicWidth / Width * GraphicHeight / Height == NumFrames);
NumFrames = GraphicWidth / Width * GraphicHeight / Height;
GenFramesMap();
}