(svn r12869) [0.6] -Backport from trunk r12714, r12708, r12674, r12577, r12553: 0.6
authorrubidium
Thu, 24 Apr 2008 12:36:18 +0000
branch0.6
changeset 10328 721fe18a2176
parent 10327 2274772a4424
child 10330 700e4a785535
(svn r12869) [0.6] -Backport from trunk r12714, r12708, r12674, r12577, r12553:
- Fix: Do not move windows below the toolbar on resizes unless they would go behind the toolbar [FS#1904] (r12714)
- Fix: Increase default sound buffer size only for Vista [FS#1914] (r12708)
- Fix: Colour remaps on station sprites only worked for company colours [FS#1902] (r12674)
- Fix: The convert signal button disallowed signal dragging when the signal GUI was closed (r12577)
- Fix: Redraw the signal GUI when the signal drag density changes in the patch settings and vice versa (r12553)
src/newgrf_station.cpp
src/rail_gui.cpp
src/settings.cpp
src/sound/win32_s.cpp
src/station_cmd.cpp
src/window.cpp
--- a/src/newgrf_station.cpp	Thu Apr 24 12:32:37 2008 +0000
+++ b/src/newgrf_station.cpp	Thu Apr 24 12:36:18 2008 +0000
@@ -753,7 +753,7 @@
 	const RailtypeInfo *rti = GetRailTypeInfo(railtype);
 	SpriteID relocation;
 	SpriteID image;
-	SpriteID pal = PLAYER_SPRITE_COLOR(_local_player);
+	SpriteID palette = PLAYER_SPRITE_COLOR(_local_player);
 	uint tile = 2;
 
 	statspec = GetCustomStationSpec(sclass, station);
@@ -791,6 +791,17 @@
 			image += relocation;
 		}
 
+		SpriteID pal;
+		if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOR)) {
+			if (seq->image.pal > 0) {
+				pal = seq->image.pal;
+			} else {
+				pal = palette;
+			}
+		} else {
+			pal = PAL_NONE;
+		}
+
 		if ((byte)seq->delta_z != 0x80) {
 			pt = RemapCoords(seq->delta_x, seq->delta_y, seq->delta_z);
 			DrawSprite(image, pal, x + pt.x, y + pt.y);
--- a/src/rail_gui.cpp	Thu Apr 24 12:32:37 2008 +0000
+++ b/src/rail_gui.cpp	Thu Apr 24 12:36:18 2008 +0000
@@ -583,7 +583,7 @@
 
 	case WE_PLACE_DRAG: {
 		/* no dragging if you have pressed the convert button */
-		if (_convert_signal_button && w->IsWidgetLowered(RTW_BUILD_SIGNALS)) return;
+		if (FindWindowById(WC_BUILD_SIGNAL, 0) != NULL && _convert_signal_button && w->IsWidgetLowered(RTW_BUILD_SIGNALS)) return;
 
 		VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method);
 		return;
@@ -1310,11 +1310,19 @@
 					break;
 
 				case BSW_DRAG_SIGNALS_DENSITY_DECREASE:
-					if (_patches.drag_signals_density > 1) _patches.drag_signals_density--;
+					if (_patches.drag_signals_density > 1) {
+						_patches.drag_signals_density--;
+						const Window *w = FindWindowById(WC_GAME_OPTIONS, 0);
+						if (w != NULL) SetWindowDirty(w);
+					}
 					break;
 
 				case BSW_DRAG_SIGNALS_DENSITY_INCREASE:
-					if (_patches.drag_signals_density < 20) _patches.drag_signals_density++;
+					if (_patches.drag_signals_density < 20) {
+						_patches.drag_signals_density++;
+						const Window *w = FindWindowById(WC_GAME_OPTIONS, 0);
+						if (w != NULL) SetWindowDirty(w);
+					}
 					break;
 
 				default: break;
--- a/src/settings.cpp	Thu Apr 24 12:32:37 2008 +0000
+++ b/src/settings.cpp	Thu Apr 24 12:36:18 2008 +0000
@@ -1206,6 +1206,15 @@
 	return 0;
 }
 
+static int32 DragSignalsDensityChanged(int32)
+{
+	const Window *w = FindWindowById(WC_BUILD_SIGNAL, 0);
+
+	if (w != NULL) SetWindowDirty(w);
+
+	return 0;
+}
+
 /**
  * Check for right TownLayout usage in editor mode.
  * The No Road mode is not desirable since towns have to be
@@ -1400,7 +1409,7 @@
 	SDT_BOOL(Patches, signal_side,                   N,NN,  true,        STR_CONFIG_PATCHES_SIGNALSIDE,          RedrawScreen),
 	SDT_BOOL(Patches, always_small_airport,          0,NN, false,        STR_CONFIG_PATCHES_SMALL_AIRPORTS,      NULL),
 	SDT_BOOL(Patches, enable_signal_gui,             S, 0, false,        STR_CONFIG_PATCHES_ENABLE_SIGNAL_GUI,   NULL),
-	 SDT_VAR(Patches, drag_signals_density,SLE_UINT8,S, 0,  4, 1, 20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,NULL),
+	 SDT_VAR(Patches, drag_signals_density,SLE_UINT8,S, 0,  4, 1, 20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,DragSignalsDensityChanged),
 	 SDT_VAR(Patches, semaphore_build_before,SLE_INT32, S, NC, 1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, NULL),
 	SDT_CONDVAR(Patches, town_layout, SLE_UINT8, 59, SL_MAX_VERSION, 0, MS, TL_ORIGINAL, TL_NO_ROADS, NUM_TLS - 1, 1, STR_CONFIG_PATCHES_TOWN_LAYOUT, CheckTownLayout),
 
--- a/src/sound/win32_s.cpp	Thu Apr 24 12:32:37 2008 +0000
+++ b/src/sound/win32_s.cpp	Thu Apr 24 12:36:18 2008 +0000
@@ -59,7 +59,7 @@
 	wfex.nBlockAlign = (wfex.nChannels * wfex.wBitsPerSample) / 8;
 	wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;
 
-	_bufsize = GetDriverParamInt(parm, "bufsize", 1024);
+	_bufsize = GetDriverParamInt(parm, "bufsize", (GB(GetVersion(), 0, 8) > 5) ? 2048 : 1024);
 
 	if (waveOutOpen(&_waveout, WAVE_MAPPER, &wfex, (DWORD_PTR)&waveOutProc, 0, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
 		return "waveOutOpen failed";
--- a/src/station_cmd.cpp	Thu Apr 24 12:32:37 2008 +0000
+++ b/src/station_cmd.cpp	Thu Apr 24 12:36:18 2008 +0000
@@ -2151,10 +2151,14 @@
 		}
 
 		SpriteID pal;
-		if (!(!HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
-			pal = palette;
+		if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOR)) {
+			if (dtss->image.pal > 0) {
+				pal = dtss->image.pal;
+			} else {
+				pal = palette;
+			}
 		} else {
-			pal = dtss->image.pal;
+			pal = PAL_NONE;
 		}
 
 		if ((byte)dtss->delta_z != 0x80) {
--- a/src/window.cpp	Thu Apr 24 12:32:37 2008 +0000
+++ b/src/window.cpp	Thu Apr 24 12:36:18 2008 +0000
@@ -2185,7 +2185,7 @@
 
 				const Window *wt = FindWindowById(WC_MAIN_TOOLBAR, 0);
 				if (wt != NULL) {
-					if (top < wt->height) top = wt->height;
+					if (top < wt->height && wt->left < (w->left + w->width) && (wt->left + wt->width) > w->left) top = wt->height;
 					if (top >= newh) top = newh - 1;
 				} else {
 					if (top < 0) top = 0;