(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.
--- a/src/misc_gui.cpp Thu Jun 21 17:38:59 2007 +0000
+++ b/src/misc_gui.cpp Thu Jun 21 19:08:47 2007 +0000
@@ -702,7 +702,7 @@
* @param paramcount number of params to deal with
* @param params (optional) up to 5 pieces of additional information that may be
* 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];
BoundingRect br;
@@ -1214,7 +1214,7 @@
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
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)
};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(query_d));
--- a/src/news.h Thu Jun 21 17:38:59 2007 +0000
+++ b/src/news.h Thu Jun 21 19:08:47 2007 +0000
@@ -17,7 +17,7 @@
TileIndex data_a;
TileIndex data_b;
- uint32 params[10];
+ uint64 params[10];
};
typedef bool ValidationProc ( uint data_a, uint data_b );
--- a/src/strings.cpp Thu Jun 21 17:38:59 2007 +0000
+++ b/src/strings.cpp Thu Jun 21 19:08:47 2007 +0000
@@ -217,7 +217,7 @@
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[] = {
--- a/src/texteff.cpp Thu Jun 21 17:38:59 2007 +0000
+++ b/src/texteff.cpp Thu Jun 21 19:08:47 2007 +0000
@@ -35,8 +35,8 @@
int32 right;
int32 bottom;
uint16 duration;
- uint32 params_1;
- uint32 params_2;
+ uint64 params_1;
+ uint64 params_2;
TextEffectMode mode;
};
--- a/src/viewport.cpp Thu Jun 21 17:38:59 2007 +0000
+++ b/src/viewport.cpp Thu Jun 21 19:08:47 2007 +0000
@@ -58,7 +58,7 @@
StringSpriteToDraw *next;
int32 x;
int32 y;
- uint32 params[2];
+ uint64 params[2];
uint16 width;
};
@@ -580,7 +580,7 @@
}
/* 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;
StringSpriteToDraw *ss;
@@ -2028,7 +2028,7 @@
* @param to TileIndex of the last tile to highlight */
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.y = TileY(to) * TILE_SIZE;
@@ -2304,7 +2304,7 @@
TileIndex t1 = TileVirtXY(x, y);
uint distance = DistanceManhattan(t0, t1) + 1;
byte index = 0;
- uint params[2];
+ uint64 params[2];
if (distance != 1) {
int heightdiff = CalcHeightdiff(b, distance, t0, t1);
@@ -2383,7 +2383,7 @@
TileIndex t1 = TileVirtXY(x, y);
uint distance = DistanceManhattan(t0, t1) + 1;
byte index = 0;
- uint params[2];
+ uint64 params[2];
if (distance != 1) {
/* With current code passing a HT_LINE style to calculate the height
@@ -2416,7 +2416,7 @@
uint dx = delta(TileX(t0), TileX(t1)) + 1;
uint dy = delta(TileY(t0), TileY(t1)) + 1;
byte index = 0;
- uint params[3];
+ uint64 params[3];
/* 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 */
--- a/src/viewport.h Thu Jun 21 17:38:59 2007 +0000
+++ b/src/viewport.h Thu Jun 21 19:08:47 2007 +0000
@@ -49,7 +49,7 @@
void DrawGroundSprite(SpriteID image, SpriteID pal);
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 *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);
--- a/src/window.h Thu Jun 21 17:38:59 2007 +0000
+++ b/src/window.h Thu Jun 21 19:08:47 2007 +0000
@@ -321,7 +321,7 @@
struct tooltips_d {
StringID string_id;
byte paramcount;
- uint32 params[5];
+ uint64 params[5];
};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d));
@@ -764,7 +764,7 @@
void CDECL SetWindowWidgetsLoweredState(Window *w, bool lowered_stat, int widgets, ...);
/* 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)
{
GuiShowTooltipsWithArgs(str, 0, NULL);