Add assert-or-return workarounds for some crashes reported by zydonk on the forums.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7835 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
72a10b7cc7
commit
11335e28a9
|
@ -126,9 +126,10 @@ typedef struct {
|
|||
int YOffset; /**< Y offset into source position */
|
||||
} IMAGEDEF;
|
||||
|
||||
#define MAX_NUM_TPAGEIDS 16
|
||||
typedef struct {
|
||||
int NumImages; /**< Number of images contained here */
|
||||
int TPageIDs[16]; /**< OpenGL Texture IDs */
|
||||
int TPageIDs[MAX_NUM_TPAGEIDS]; /**< OpenGL Texture IDs */
|
||||
IMAGEDEF *ImageDefs; /**< Stored images */
|
||||
} IMAGEFILE;
|
||||
|
||||
|
|
|
@ -163,9 +163,10 @@ void pie_ImageFileID(IMAGEFILE *ImageFile, UWORD ID, int x, int y)
|
|||
PIEIMAGE pieImage;
|
||||
PIERECT dest;
|
||||
|
||||
assert(ID < ImageFile->NumImages);
|
||||
ASSERT_OR_RETURN(, ID < ImageFile->NumImages, "Out of range 1: %d", (int)Image->TPageID);
|
||||
Image = &ImageFile->ImageDefs[ID];
|
||||
|
||||
ASSERT_OR_RETURN(, Image->TPageID < MAX_NUM_TPAGEIDS, "Out of range 2: %d", (int)Image->TPageID);
|
||||
pie_SetRendMode(REND_ALPHA_TEX);
|
||||
pie_SetAlphaTest(true);
|
||||
|
||||
|
@ -188,10 +189,10 @@ void pie_ImageFileIDTile(IMAGEFILE *ImageFile, UWORD ID, int x, int y, int Width
|
|||
PIEIMAGE pieImage;
|
||||
PIERECT dest;
|
||||
|
||||
assert(ID < ImageFile->NumImages);
|
||||
|
||||
ASSERT_OR_RETURN(, ID < ImageFile->NumImages, "Out of range 1: %d", (int)Image->TPageID);
|
||||
Image = &ImageFile->ImageDefs[ID];
|
||||
|
||||
ASSERT_OR_RETURN(, Image->TPageID < MAX_NUM_TPAGEIDS, "Out of range 2: %d", (int)Image->TPageID);
|
||||
pie_SetRendMode(REND_GOURAUD_TEX);
|
||||
pie_SetAlphaTest(true);
|
||||
|
||||
|
|
|
@ -167,6 +167,7 @@ void pie_SetTexturePage(SDWORD num)
|
|||
{
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
ASSERT_OR_RETURN(, num < iV_TEX_MAX, "Index out of bounds: %d", num);
|
||||
glBindTexture(GL_TEXTURE_2D, _TEX_PAGE[num].id);
|
||||
}
|
||||
rendStates.texPage = num;
|
||||
|
|
Loading…
Reference in New Issue