mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-03-13 22:22:13 +00:00
Work-around for possible q3lcc/q3asm bug ([unsigned] int to unsigned short conversion)
This commit is contained in:
parent
6c4071fd30
commit
d3c1de5f40
2 changed files with 12 additions and 15 deletions
|
@ -5798,24 +5798,21 @@ static void UI_Update(const char *name)
|
|||
}
|
||||
}
|
||||
|
||||
static qboolean UI_ParseResolution(char* str, int* width, int* height)
|
||||
static qboolean UI_ParseResolution(char* str, resolution_t* res)
|
||||
{
|
||||
char* x = strchr(str, 'x');
|
||||
if (!x)
|
||||
{
|
||||
*width = *height = 0;
|
||||
res->width = res->height = 0;
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
*x++ = 0;
|
||||
|
||||
if (1 != sscanf(str, "%d", width) || 1 != sscanf(x, "%d", height))
|
||||
{
|
||||
*width = *height = 0;
|
||||
return qfalse;
|
||||
}
|
||||
res->width = atoi(str);
|
||||
res->height = atoi(x);
|
||||
|
||||
return qtrue;
|
||||
return res->width > 0 && res->height > 0;
|
||||
}
|
||||
|
||||
static void UI_SelectCurrentResolution()
|
||||
|
@ -5852,17 +5849,16 @@ static void UI_GetSupportedModes()
|
|||
|
||||
for (tok=strtok(buf, delim); tok; tok=strtok(NULL, delim))
|
||||
{
|
||||
int width, height;
|
||||
if (UI_ParseResolution(tok, &width, &height))
|
||||
resolution_t tmp;
|
||||
if (UI_ParseResolution(tok, &tmp))
|
||||
{
|
||||
idx = uiInfo.uiDC.numSupportedModes++;
|
||||
if (uiInfo.uiDC.numSupportedModes > MAX_NUM_SUPPORTED_MODES)
|
||||
if (uiInfo.uiDC.numSupportedModes == MAX_NUM_SUPPORTED_MODES)
|
||||
{
|
||||
Com_Printf(S_COLOR_YELLOW "Warning: more than MAX_NUM_SUPPORTED_MODES resolutions found.\n");
|
||||
return;
|
||||
break;
|
||||
}
|
||||
uiInfo.uiDC.supportedMode[idx].width = width;
|
||||
uiInfo.uiDC.supportedMode[idx].height = height;
|
||||
uiInfo.uiDC.supportedMode[idx] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -507,7 +507,8 @@ typedef struct {
|
|||
#define MAX_NUM_SUPPORTED_MODES 256
|
||||
|
||||
typedef struct {
|
||||
unsigned short width, height;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
} resolution_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Reference in a new issue