summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-21 19:08:47 +0000
committerrubidium <rubidium@openttd.org>2007-06-21 19:08:47 +0000
commit0b34c9aefe342c6ffe11d2d4720d7c06c157e04d (patch)
treed3371ccdafc2ee276ac7c5cecc77a905283e656d
parentfb7964e90270d4471774a4625e5ef03dd7a6eae2 (diff)
downloadopenttd-0b34c9aefe342c6ffe11d2d4720d7c06c157e04d.tar.xz
(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.
-rw-r--r--src/misc_gui.cpp4
-rw-r--r--src/news.h2
-rw-r--r--src/strings.cpp2
-rw-r--r--src/texteff.cpp4
-rw-r--r--src/viewport.cpp12
-rw-r--r--src/viewport.h2
-rw-r--r--src/window.h4
7 files changed, 15 insertions, 15 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 2a36406af..c608f340c 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -702,7 +702,7 @@ static void TooltipsWndProc(Window *w, WindowEvent *e)
* @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 @@ enum QueryWidgets {
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));
diff --git a/src/news.h b/src/news.h
index 0f5bc7cfa..e5a1675da 100644
--- a/src/news.h
+++ b/src/news.h
@@ -17,7 +17,7 @@ struct NewsItem {
TileIndex data_a;
TileIndex data_b;
- uint32 params[10];
+ uint64 params[10];
};
typedef bool ValidationProc ( uint data_a, uint data_b );
diff --git a/src/strings.cpp b/src/strings.cpp
index 37a4377c9..bb97c899c 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -217,7 +217,7 @@ void SetDParamStr(uint n, const char *str)
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[] = {
diff --git a/src/texteff.cpp b/src/texteff.cpp
index ca3bdf4cf..e5c29a4c7 100644
--- a/src/texteff.cpp
+++ b/src/texteff.cpp
@@ -35,8 +35,8 @@ struct TextEffect {
int32 right;
int32 bottom;
uint16 duration;
- uint32 params_1;
- uint32 params_2;
+ uint64 params_1;
+ uint64 params_2;
TextEffectMode mode;
};
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 11f97db7d..14dc7a37d 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -58,7 +58,7 @@ struct StringSpriteToDraw {
StringSpriteToDraw *next;
int32 x;
int32 y;
- uint32 params[2];
+ uint64 params[2];
uint16 width;
};
@@ -580,7 +580,7 @@ void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y)
}
/* 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 @@ void VpSetPlaceSizingLimit(int limit)
* @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 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth
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 @@ calc_heightdiff_single_direction:;
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 @@ calc_heightdiff_single_direction:;
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 */
diff --git a/src/viewport.h b/src/viewport.h
index be5d8feb4..528253b7a 100644
--- a/src/viewport.h
+++ b/src/viewport.h
@@ -49,7 +49,7 @@ void OffsetGroundSprite(int x, int y);
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);
diff --git a/src/window.h b/src/window.h
index f1888c294..958e95ef6 100644
--- a/src/window.h
+++ b/src/window.h
@@ -321,7 +321,7 @@ assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d));
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 SetWindowWidgetsHiddenState(Window *w, bool hidden_stat, int widgets,
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);