mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
This commit is contained in:
parent
0fe07eac63
commit
1846563cf8
10
window.c
10
window.c
@ -338,11 +338,11 @@ restart:;
|
|||||||
w->hscroll.count = 0;
|
w->hscroll.count = 0;
|
||||||
w->widget = widget;
|
w->widget = widget;
|
||||||
|
|
||||||
((uint32*)w->custom)[0] = 0;
|
{
|
||||||
((uint32*)w->custom)[1] = 0;
|
int i;
|
||||||
((uint32*)w->custom)[2] = 0;
|
for (i=0;i<lengthof(w->custom);i++)
|
||||||
((uint32*)w->custom)[3] = 0;
|
w->custom[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
_last_window++;
|
_last_window++;
|
||||||
|
|
||||||
|
26
window.h
26
window.h
@ -161,7 +161,22 @@ enum {
|
|||||||
WDP_CENTER = -2,
|
WDP_CENTER = -2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
StringID caption;
|
||||||
|
bool caret;
|
||||||
|
WindowClass wnd_class;
|
||||||
|
WindowNumber wnd_num;
|
||||||
|
uint16 maxlen, maxwidth;
|
||||||
|
byte *buf;
|
||||||
|
} querystr_d;
|
||||||
|
|
||||||
#define WP(ptr,str) (*(str*)(ptr)->custom)
|
#define WP(ptr,str) (*(str*)(ptr)->custom)
|
||||||
|
// querystr_d is the bigest struct that comes in w->custom
|
||||||
|
// because 64-bit systems use 64-bit pointers, it is bigger on a 64-bit system
|
||||||
|
// then on a 32-bit system. Therefor the size is calculated from querystr_d
|
||||||
|
// instead of a hardcoded number.
|
||||||
|
// if any struct becomes bigger the querystr_d, it should be replaced.
|
||||||
|
#define WINDOW_CUSTOM_SIZE sizeof(querystr_d)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint16 count, cap, pos;
|
uint16 count, cap, pos;
|
||||||
@ -186,7 +201,7 @@ struct Window {
|
|||||||
//const WindowDesc *desc;
|
//const WindowDesc *desc;
|
||||||
uint32 desc_flags;
|
uint32 desc_flags;
|
||||||
|
|
||||||
byte custom[16];
|
byte custom[WINDOW_CUSTOM_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -250,15 +265,6 @@ typedef struct {
|
|||||||
byte gender;
|
byte gender;
|
||||||
} facesel_d;
|
} facesel_d;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
StringID caption;
|
|
||||||
bool caret;
|
|
||||||
WindowClass wnd_class;
|
|
||||||
WindowNumber wnd_num;
|
|
||||||
uint16 maxlen, maxwidth;
|
|
||||||
byte *buf;
|
|
||||||
} querystr_d;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int sel;
|
int sel;
|
||||||
byte cargo;
|
byte cargo;
|
||||||
|
Loading…
Reference in New Issue
Block a user