Changeset - r7006:514975584cfc
[Not reviewed]
master
0 7 0
rubidium - 17 years ago 2007-06-21 19:08:47
rubidium@openttd.org
(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.
7 files changed with 15 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/misc_gui.cpp
Show inline comments
 
@@ -699,13 +699,13 @@ static void TooltipsWndProc(Window *w, W
 

	
 
/** Shows a tooltip
 
 * @param str String to be displayed
 
 * @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;
 
	Window *w;
 
	uint i;
 
	int x, y;
 
@@ -1211,13 +1211,13 @@ 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));
 

	
 

	
 
static void QueryWndProc(Window *w, WindowEvent *e)
src/news.h
Show inline comments
 
@@ -14,13 +14,13 @@ struct NewsItem {
 
	byte type;
 
	byte callback;
 

	
 
	TileIndex data_a;
 
	TileIndex data_b;
 

	
 
	uint32 params[10];
 
	uint64 params[10];
 
};
 

	
 
typedef bool ValidationProc ( uint data_a, uint data_b );
 
typedef void DrawNewsCallbackProc(Window *w);
 
typedef StringID GetNewsStringCallbackProc(const NewsItem *ni);
 

	
src/strings.cpp
Show inline comments
 
@@ -214,13 +214,13 @@ void SetDParamStr(uint n, const char *st
 
{
 
	SetDParam(n, BindCString(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[] = {
 
	1000000000,
 
	100000000,
 
	10000000,
src/texteff.cpp
Show inline comments
 
@@ -32,14 +32,14 @@ struct TextEffect {
 
	StringID string_id;
 
	int32 x;
 
	int32 y;
 
	int32 right;
 
	int32 bottom;
 
	uint16 duration;
 
	uint32 params_1;
 
	uint32 params_2;
 
	uint64 params_1;
 
	uint64 params_2;
 
	TextEffectMode mode;
 
};
 

	
 

	
 
struct TextMessage {
 
	char message[MAX_TEXTMESSAGE_LENGTH];
src/viewport.cpp
Show inline comments
 
@@ -55,13 +55,13 @@ static bool _offset_ground_sprites;
 
struct StringSpriteToDraw {
 
	uint16 string;
 
	uint16 color;
 
	StringSpriteToDraw *next;
 
	int32 x;
 
	int32 y;
 
	uint32 params[2];
 
	uint64 params[2];
 
	uint16 width;
 
};
 

	
 
struct TileSpriteToDraw {
 
	SpriteID image;
 
	SpriteID pal;
 
@@ -577,13 +577,13 @@ void AddChildSpriteScreen(SpriteID image
 
	cs->x = x;
 
	cs->y = y;
 
	cs->next = NULL;
 
}
 

	
 
/* 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;
 

	
 
	if (vd->spritelist_mem >= vd->eof_spritelist_mem) {
 
		DEBUG(sprite, 0, "Out of sprite memory");
 
@@ -2025,13 +2025,13 @@ void VpSetPlaceSizingLimit(int limit)
 
/**
 
* Highlights all tiles between a set of two tiles. Used in dock and tunnel placement
 
* @param from TileIndex of the first tile to highlight
 
* @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;
 
	_thd.selstart.x = TileX(from) * TILE_SIZE;
 
	_thd.selstart.y = TileY(from) * TILE_SIZE;
 
	_thd.next_drawstyle = HT_RECT;
 
@@ -2301,13 +2301,13 @@ static void CalcRaildirsDrawstyle(TileHi
 

	
 
	if (_patches.measure_tooltip) {
 
		TileIndex t0 = TileVirtXY(thd->selstart.x, thd->selstart.y);
 
		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);
 
			/* If we are showing a tooltip for horizontal or vertical drags,
 
			 * 2 tiles have a length of 1. To bias towards the ceiling we add
 
			 * one before division. It feels more natural to count 3 lengths as 2 */
 
@@ -2380,13 +2380,13 @@ void VpSelectTilesWithMethod(int x, int 
 
calc_heightdiff_single_direction:;
 
			if (_patches.measure_tooltip) {
 
				TileIndex t0 = TileVirtXY(sx, sy);
 
				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
 
					 * difference is enough. However if/when a point-tool is created
 
					 * with this method, function should be called with new_style (below)
 
					 * instead of HT_LINE | style case HT_POINT is handled specially
 
@@ -2413,13 +2413,13 @@ calc_heightdiff_single_direction:;
 

	
 
				TileIndex t0 = TileVirtXY(sx, sy);
 
				TileIndex t1 = TileVirtXY(x, y);
 
				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 */
 
				style = _thd.next_drawstyle;
 
				if (style & HT_RECT) {
 
					if (dx == 1) {
src/viewport.h
Show inline comments
 
@@ -46,13 +46,13 @@ static inline void MaxZoomInOut(int how,
 

	
 
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);
 

	
 

	
 
void StartSpriteCombine();
 
void EndSpriteCombine();
 

	
src/window.h
Show inline comments
 
@@ -318,13 +318,13 @@ struct tree_d {
 
};
 
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));
 

	
 
struct buildvehicle_d {
 
	VehicleType vehicle_type;
 
	union {
 
@@ -761,13 +761,13 @@ void RelocateAllWindows(int neww, int ne
 
int PositionMainToolbar(Window *w);
 
void CDECL SetWindowWidgetsDisabledState(Window *w, bool disab_stat, int widgets, ...);
 
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);
 
}
 

	
 
/* widget.cpp */
0 comments (0 inline, 0 general)