Changeset - r7428:7a14b23c98c3
[Not reviewed]
master
0 2 0
rubidium - 17 years ago 2007-08-09 05:25:33
rubidium@openttd.org
(svn r10833) -Fix [FS#1115]: assertion (different cost between test and execution) of overbuilding road tunnels with tram tracks (and vice versa) when the dragged area contains both ends of the tunnel.
2 files changed with 21 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/road_cmd.cpp
Show inline comments
 
@@ -585,12 +585,13 @@ CommandCost DoConvertStreetRail(TileInde
 
 */
 
CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
 
{
 
	TileIndex start_tile, tile;
 
	CommandCost cost, ret;
 
	bool had_bridge = false;
 
	bool had_tunnel = false;
 
	bool had_success = false;
 
	DisallowedRoadDirections drd = DRD_NORTHBOUND;
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
 

	
 
	if (p1 >= MapSize()) return CMD_ERROR;
 
@@ -630,18 +631,25 @@ CommandCost CmdBuildLongRoad(TileIndex e
 
		ret = DoCommand(tile, drd << 6 | rt << 4 | bits, 0, flags, CMD_BUILD_ROAD);
 
		if (CmdFailed(ret)) {
 
			if (_error_message != STR_1007_ALREADY_BUILT) return CMD_ERROR;
 
			_error_message = INVALID_STRING_ID;
 
		} else {
 
			had_success = true;
 
			/* Only pay for the upgrade on one side of the bridge */
 
			if (IsBridgeTile(tile)) {
 
				if ((!had_bridge || GetBridgeRampDirection(tile) == DIAGDIR_SE || GetBridgeRampDirection(tile) == DIAGDIR_SW)) {
 
					cost.AddCost(ret);
 
			/* Only pay for the upgrade on one side of the bridges and tunnels */
 
			if (IsTileType(tile, MP_TUNNELBRIDGE)) {
 
				if (IsBridge(tile)) {
 
					if ((!had_bridge || GetBridgeRampDirection(tile) == DIAGDIR_SE || GetBridgeRampDirection(tile) == DIAGDIR_SW)) {
 
						cost.AddCost(ret);
 
					}
 
					had_bridge = true;
 
				} else {
 
					if ((!had_tunnel || GetTunnelDirection(tile) == DIAGDIR_SE || GetTunnelDirection(tile) == DIAGDIR_SW)) {
 
						cost.AddCost(ret);
 
					}
 
					had_tunnel = true;
 
				}
 
				had_bridge = true;
 
			} else {
 
				cost.AddCost(ret);
 
			}
 
		}
 

	
 
		if (tile == end_tile) break;
src/video/win32_v.cpp
Show inline comments
 
@@ -216,14 +216,15 @@ static void CALLBACK TrackMouseTimerProc
 
static void MakeWindow(bool full_screen)
 
{
 
	_fullscreen = full_screen;
 

	
 
	// recreate window?
 
	if ((full_screen || _wnd.fullscreen) && _wnd.main_wnd) {
 
		DestroyWindow(_wnd.main_wnd);
 
		HWND wnd = _wnd.main_wnd;
 
		_wnd.main_wnd = 0;
 
		DestroyWindow(wnd);
 
	}
 

	
 
#if defined(WINCE)
 
	/* WinCE is always fullscreen */
 
#else
 
	if (full_screen) {
 
@@ -516,12 +517,15 @@ static LRESULT CALLBACK WndProcGdi(HWND 
 
					HandleKeypress(MapWindowsKey(wParam) << 16);
 
					break;
 
			}
 
			break;
 

	
 
		case WM_SIZE:
 
			/* Resizing a destroy window is NOT good */
 
			if (_wnd.main_wnd == 0) return;
 

	
 
			if (wParam != SIZE_MINIMIZED) {
 
				/* Set maximized flag when we maximize (obviously), but also when we
 
				 * switched to fullscreen from a maximized state */
 
				_window_maximize = (wParam == SIZE_MAXIMIZED || (_window_maximize && _fullscreen));
 
				if (_window_maximize) {
 
					_bck_resolution[0] = _cur_resolution[0];
 
@@ -789,13 +793,15 @@ const char *VideoDriver_Win32::Start(con
 
}
 

	
 
void VideoDriver_Win32::Stop()
 
{
 
	DeleteObject(_wnd.gdi_palette);
 
	DeleteObject(_wnd.dib_sect);
 
	DestroyWindow(_wnd.main_wnd);
 
	HWND wnd = _wnd.main_wnd;
 
	_wnd.main_wnd = 0;
 
	DestroyWindow(wnd);
 

	
 
#if !defined(WINCE)
 
	if (_wnd.fullscreen) ChangeDisplaySettings(NULL, 0);
 
#endif
 
	MyShowCursor(true);
 
}
0 comments (0 inline, 0 general)