1
0
Fork 0

(svn r10262) -Fix (r10258): some places that needed to be changed to uint64 were hidden/forgotten, which caused memory corruptions and that in caused all kinds of assertions to trigger.

release/0.6
rubidium 2007-06-21 19:08:47 +00:00
parent fb7964e902
commit 0b34c9aefe
7 changed files with 15 additions and 15 deletions

View File

@ -702,7 +702,7 @@ static void TooltipsWndProc(Window *w, WindowEvent *e)
* @param paramcount number of params to deal with * @param paramcount number of params to deal with
* @param params (optional) up to 5 pieces of additional information that may be * @param params (optional) up to 5 pieces of additional information that may be
* added to a tooltip; currently only supports parameters of {NUM} (integer) */ * added to a tooltip; currently only supports parameters of {NUM} (integer) */
void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint32 params[]) void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[])
{ {
char buffer[512]; char buffer[512];
BoundingRect br; BoundingRect br;
@ -1214,7 +1214,7 @@ enum QueryWidgets {
struct query_d { struct query_d {
void (*proc)(Window*, bool); ///< callback function executed on closing of popup. Window* points to parent, bool is true if 'yes' clicked, false otherwise void (*proc)(Window*, bool); ///< callback function executed on closing of popup. Window* points to parent, bool is true if 'yes' clicked, false otherwise
StringID message; ///< message shown for query window StringID message; ///< message shown for query window
uint32 params[20]; ///< local copy of _decode_parameters uint64 params[10]; ///< local copy of _decode_parameters
bool calledback; ///< has callback been executed already (internal usage for WE_DESTROY event) bool calledback; ///< has callback been executed already (internal usage for WE_DESTROY event)
}; };
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(query_d)); assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(query_d));

View File

@ -17,7 +17,7 @@ struct NewsItem {
TileIndex data_a; TileIndex data_a;
TileIndex data_b; TileIndex data_b;
uint32 params[10]; uint64 params[10];
}; };
typedef bool ValidationProc ( uint data_a, uint data_b ); typedef bool ValidationProc ( uint data_a, uint data_b );

View File

@ -217,7 +217,7 @@ void SetDParamStr(uint n, const char *str)
void InjectDParam(int amount) void InjectDParam(int amount)
{ {
memmove(_decode_parameters + amount, _decode_parameters, sizeof(_decode_parameters) - amount * sizeof(uint32)); memmove(_decode_parameters + amount, _decode_parameters, sizeof(_decode_parameters) - amount * sizeof(uint64));
} }
static const uint32 _divisor_table[] = { static const uint32 _divisor_table[] = {

View File

@ -35,8 +35,8 @@ struct TextEffect {
int32 right; int32 right;
int32 bottom; int32 bottom;
uint16 duration; uint16 duration;
uint32 params_1; uint64 params_1;
uint32 params_2; uint64 params_2;
TextEffectMode mode; TextEffectMode mode;
}; };

View File

@ -58,7 +58,7 @@ struct StringSpriteToDraw {
StringSpriteToDraw *next; StringSpriteToDraw *next;
int32 x; int32 x;
int32 y; int32 y;
uint32 params[2]; uint64 params[2];
uint16 width; uint16 width;
}; };
@ -580,7 +580,7 @@ void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y)
} }
/* Returns a StringSpriteToDraw */ /* Returns a StringSpriteToDraw */
void *AddStringToDraw(int x, int y, StringID string, uint32 params_1, uint32 params_2) void *AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2)
{ {
ViewportDrawer *vd = _cur_vd; ViewportDrawer *vd = _cur_vd;
StringSpriteToDraw *ss; StringSpriteToDraw *ss;
@ -2028,7 +2028,7 @@ void VpSetPlaceSizingLimit(int limit)
* @param to TileIndex of the last tile to highlight */ * @param to TileIndex of the last tile to highlight */
void VpSetPresizeRange(TileIndex from, TileIndex to) void VpSetPresizeRange(TileIndex from, TileIndex to)
{ {
uint distance = DistanceManhattan(from, to) + 1; uint64 distance = DistanceManhattan(from, to) + 1;
_thd.selend.x = TileX(to) * TILE_SIZE; _thd.selend.x = TileX(to) * TILE_SIZE;
_thd.selend.y = TileY(to) * TILE_SIZE; _thd.selend.y = TileY(to) * TILE_SIZE;
@ -2304,7 +2304,7 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth
TileIndex t1 = TileVirtXY(x, y); TileIndex t1 = TileVirtXY(x, y);
uint distance = DistanceManhattan(t0, t1) + 1; uint distance = DistanceManhattan(t0, t1) + 1;
byte index = 0; byte index = 0;
uint params[2]; uint64 params[2];
if (distance != 1) { if (distance != 1) {
int heightdiff = CalcHeightdiff(b, distance, t0, t1); int heightdiff = CalcHeightdiff(b, distance, t0, t1);
@ -2383,7 +2383,7 @@ calc_heightdiff_single_direction:;
TileIndex t1 = TileVirtXY(x, y); TileIndex t1 = TileVirtXY(x, y);
uint distance = DistanceManhattan(t0, t1) + 1; uint distance = DistanceManhattan(t0, t1) + 1;
byte index = 0; byte index = 0;
uint params[2]; uint64 params[2];
if (distance != 1) { if (distance != 1) {
/* With current code passing a HT_LINE style to calculate the height /* With current code passing a HT_LINE style to calculate the height
@ -2416,7 +2416,7 @@ calc_heightdiff_single_direction:;
uint dx = delta(TileX(t0), TileX(t1)) + 1; uint dx = delta(TileX(t0), TileX(t1)) + 1;
uint dy = delta(TileY(t0), TileY(t1)) + 1; uint dy = delta(TileY(t0), TileY(t1)) + 1;
byte index = 0; byte index = 0;
uint params[3]; uint64 params[3];
/* If dragging an area (eg dynamite tool) and it is actually a single /* If dragging an area (eg dynamite tool) and it is actually a single
* row/column, change the type to 'line' to get proper calculation for height */ * row/column, change the type to 'line' to get proper calculation for height */

View File

@ -49,7 +49,7 @@ void OffsetGroundSprite(int x, int y);
void DrawGroundSprite(SpriteID image, SpriteID pal); void DrawGroundSprite(SpriteID image, SpriteID pal);
void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z); void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z);
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, byte dz, byte z); void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, byte dz, byte z);
void *AddStringToDraw(int x, int y, StringID string, uint32 params_1, uint32 params_2); void *AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2);
void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y); void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y);

View File

@ -321,7 +321,7 @@ assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d));
struct tooltips_d { struct tooltips_d {
StringID string_id; StringID string_id;
byte paramcount; byte paramcount;
uint32 params[5]; uint64 params[5];
}; };
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d)); assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d));
@ -764,7 +764,7 @@ void CDECL SetWindowWidgetsHiddenState(Window *w, bool hidden_stat, int widgets,
void CDECL SetWindowWidgetsLoweredState(Window *w, bool lowered_stat, int widgets, ...); void CDECL SetWindowWidgetsLoweredState(Window *w, bool lowered_stat, int widgets, ...);
/* misc_gui.cpp */ /* misc_gui.cpp */
void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint params[]); void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[]);
static inline void GuiShowTooltips(StringID str) static inline void GuiShowTooltips(StringID str)
{ {
GuiShowTooltipsWithArgs(str, 0, NULL); GuiShowTooltipsWithArgs(str, 0, NULL);