(svn r9505) [NoAI] -Sync with trunk r9468:9504 noai
authortruelight
Tue, 27 Mar 2007 13:58:24 +0000
branchnoai
changeset 9566 9936b201d53f
parent 9565 7237786c6197
child 9567 d73c84a7875d
(svn r9505) [NoAI] -Sync with trunk r9468:9504
configure
src/build_vehicle_gui.cpp
src/gfx.cpp
src/newgrf_cargo.cpp
src/settings.cpp
src/vehicle_gui.h
--- a/configure	Tue Mar 27 13:47:20 2007 +0000
+++ b/configure	Tue Mar 27 13:58:24 2007 +0000
@@ -3,7 +3,10 @@
 CONFIGURE_EXECUTABLE="$_"
 # On *nix systems those two are equal when ./configure is done
 if [ "$0" != "$CONFIGURE_EXECUTABLE" ]; then
-	if [ -z "`echo $CONFIGURE_EXECUTABLE | grep make`" ]; then
+	# On some systems, when ./configure is triggered from 'make'
+	#  the $_ is filled with 'make'. So if that is true, skip 'make'
+	#  and use $0 (and hope that is correct ;))
+	if [ -n "`echo $CONFIGURE_EXECUTABLE | grep make`" ]; then
 		CONFIGURE_EXECUTABLE="$0"
 	else
 		CONFIGURE_EXECUTABLE="$CONFIGURE_EXECUTABLE $0"
--- a/src/build_vehicle_gui.cpp	Tue Mar 27 13:47:20 2007 +0000
+++ b/src/build_vehicle_gui.cpp	Tue Mar 27 13:58:24 2007 +0000
@@ -41,21 +41,22 @@
 	BUILD_VEHICLE_WIDGET_BUILD,
 	BUILD_VEHICLE_WIDGET_RENAME,
 	BUILD_VEHICLE_WIDGET_RESIZE,
+	BUILD_VEHICLE_WIDGET_END
 };
 
 static const Widget _build_vehicle_widgets[] = {
 	{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,                STR_018B_CLOSE_WINDOW },
-	{    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   227,     0,    13, 0x0,                     STR_018C_WINDOW_TITLE_DRAG_THIS },
+	{    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   239,     0,    13, 0x0,                     STR_018C_WINDOW_TITLE_DRAG_THIS },
 	{ WWT_PUSHTXTBTN,   RESIZE_NONE,    14,     0,    80,    14,    25, STR_SORT_BY,             STR_SORT_ORDER_TIP},
-	{      WWT_PANEL,  RESIZE_RIGHT,    14,    81,   215,    14,    25, 0x0,                     STR_SORT_CRITERIA_TIP},
-	{    WWT_TEXTBTN,     RESIZE_LR,    14,   216,   227,    14,    25, STR_0225,                STR_SORT_CRITERIA_TIP},
-	{     WWT_MATRIX,     RESIZE_RB,    14,     0,   215,    26,   121, 0x0,                     STR_NULL },
-	{  WWT_SCROLLBAR,    RESIZE_LRB,    14,   216,   227,    26,   121, 0x0,                     STR_0190_SCROLL_BAR_SCROLLS_LIST },
-	{      WWT_PANEL,    RESIZE_RTB,    14,     0,   227,   122,   223, 0x0,                     STR_NULL },
+	{      WWT_PANEL,  RESIZE_RIGHT,    14,    81,   227,    14,    25, 0x0,                     STR_SORT_CRITERIA_TIP},
+	{    WWT_TEXTBTN,     RESIZE_LR,    14,   228,   239,    14,    25, STR_0225,                STR_SORT_CRITERIA_TIP},
+	{     WWT_MATRIX,     RESIZE_RB,    14,     0,   227,    26,   121, 0x0,                     STR_NULL },
+	{  WWT_SCROLLBAR,    RESIZE_LRB,    14,   228,   239,    26,   121, 0x0,                     STR_0190_SCROLL_BAR_SCROLLS_LIST },
+	{      WWT_PANEL,    RESIZE_RTB,    14,     0,   239,   122,   243, 0x0,                     STR_NULL },
 
-	{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,     0,   114,   224,   235, 0x0,                     STR_NULL },
-	{ WWT_PUSHTXTBTN,    RESIZE_RTB,    14,   115,   215,   224,   235, 0x0,                     STR_NULL },
-	{  WWT_RESIZEBOX,   RESIZE_LRTB,    14,   216,   227,   224,   235, 0x0,                     STR_RESIZE_BUTTON },
+	{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,     0,   114,   244,   255, 0x0,                     STR_NULL },
+	{ WWT_PUSHTXTBTN,    RESIZE_RTB,    14,   115,   227,   244,   255, 0x0,                     STR_NULL },
+	{  WWT_RESIZEBOX,   RESIZE_LRTB,    14,   228,   239,   244,   255, 0x0,                     STR_RESIZE_BUTTON },
 	{   WIDGETS_END},
 };
 
@@ -527,8 +528,9 @@
  * @param x,y location where to draw the info
  * @param w how wide are the text allowed to be (size of widget/window to Draw in)
  * @param engine_number the engine of which to draw the info of
+ * @return y after drawing all the text
  */
-void DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number)
+int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number)
 {
 	const Engine *e = GetEngine(engine_number);
 	YearMonthDay ymd;
@@ -594,6 +596,8 @@
 	/* Additional text from NewGRF */
 	y += ShowAdditionalText(x, y, w, engine_number);
 	if (refitable) y += ShowRefitOptionsList(x, y, w, engine_number);
+
+	return y;
 }
 
 /* Figure out what train EngineIDs to put in the list */
@@ -793,6 +797,23 @@
 	}
 }
 
+static void ExpandPurchaseInfoWidget(Window *w, int expand_by)
+{
+	Widget *wi = &w->widget[BUILD_VEHICLE_WIDGET_PANEL];
+
+	SetWindowDirty(w);
+	wi->bottom += expand_by;
+
+	for (uint i = BUILD_VEHICLE_WIDGET_BUILD; i < BUILD_VEHICLE_WIDGET_END; i++) {
+		wi = &w->widget[i];
+		wi->top += expand_by;
+		wi->bottom += expand_by;
+	}
+
+	w->height += expand_by;
+	SetWindowDirty(w);
+}
+
 static void DrawBuildVehicleWindow(Window *w)
 {
 	const buildvehicle_d *bv = &WP(w, buildvehicle_d);
@@ -808,7 +829,9 @@
 
 	if (bv->sel_engine != INVALID_ENGINE) {
 		const Widget *wi = &w->widget[BUILD_VEHICLE_WIDGET_PANEL];
-		DrawVehiclePurchaseInfo(2, wi->top + 1, wi->right - wi->left - 2, bv->sel_engine);
+		int text_end = DrawVehiclePurchaseInfo(2, wi->top + 1, wi->right - wi->left - 2, bv->sel_engine);
+
+		if (text_end > wi->bottom) ExpandPurchaseInfoWidget(w, text_end - wi->bottom);
 	}
 
 	DrawString(85, 15, _sort_listing[bv->vehicle_type][bv->sort_criteria], 0x10);
@@ -941,7 +964,7 @@
 }
 
 static const WindowDesc _build_vehicle_desc = {
-	WDP_AUTO, WDP_AUTO, 228, 236,
+	WDP_AUTO, WDP_AUTO, 240, 256,
 	WC_BUILD_VEHICLE, WC_NONE,
 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
 	_build_vehicle_widgets,
@@ -982,14 +1005,12 @@
 			ResizeWindow(w, 0, 16);
 			break;
 		case VEH_ROAD:
-			ResizeWindow(w, 20, 16);
+			ResizeWindow(w, 0, 16);
 		case VEH_SHIP:
-			ResizeWindow(w, 27, 0);
 			break;
 		case VEH_AIRCRAFT:
 			bv->filter.flags =
 				tile == 0 ? AirportFTAClass::ALL : GetStationByTile(tile)->Airport()->flags;
-			ResizeWindow(w, 12, 0);
 			break;
 	}
 	SetupWindowStrings(w, type);
--- a/src/gfx.cpp	Tue Mar 27 13:47:20 2007 +0000
+++ b/src/gfx.cpp	Tue Mar 27 13:58:24 2007 +0000
@@ -548,10 +548,11 @@
 	mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
 	total_height = (num + 1) * mt;
 
-	if (maxh != -1 && total_height > (uint)maxh) {
+	if (maxh != -1 && (int)total_height > maxh) {
+		/* Check there's room enough for at least one line. */
+		if (maxh < mt) return 0;
+
 		num = maxh / mt - 1;
-		if (num < 1) return 0;
-
 		total_height = (num + 1) * mt;
 	}
 
--- a/src/newgrf_cargo.cpp	Tue Mar 27 13:47:20 2007 +0000
+++ b/src/newgrf_cargo.cpp	Tue Mar 27 13:58:24 2007 +0000
@@ -2,6 +2,7 @@
 
 #include "stdafx.h"
 #include "openttd.h"
+#include "debug.h"
 #include "cargotype.h"
 #include "newgrf.h"
 #include "newgrf_callbacks.h"
@@ -29,6 +30,8 @@
 
 static uint32 CargoGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
 {
+	DEBUG(grf, 1, "Unhandled cargo property 0x%X", variable);
+
 	*available = false;
 	return 0;
 }
--- a/src/settings.cpp	Tue Mar 27 13:47:20 2007 +0000
+++ b/src/settings.cpp	Tue Mar 27 13:58:24 2007 +0000
@@ -1502,7 +1502,7 @@
 static const SettingDesc _currency_settings[] = {
 	SDT_VAR(CurrencySpec, rate,    SLE_UINT16, S, 0,  1, 0, 100, 0, STR_NULL, NULL),
 	SDT_CHR(CurrencySpec, separator,           S, 0,        ".",    STR_NULL, NULL),
-	SDT_VAR(CurrencySpec, to_euro,  SLE_INT32, S, 0,  0, 0,1000, 0, STR_NULL, NULL),
+	SDT_VAR(CurrencySpec, to_euro,  SLE_INT32, S, 0,  0, 0,3000, 0, STR_NULL, NULL),
 	SDT_STR(CurrencySpec, prefix,   SLE_STRBQ, S, 0,       NULL,    STR_NULL, NULL),
 	SDT_STR(CurrencySpec, suffix,   SLE_STRBQ, S, 0, " credits",    STR_NULL, NULL),
 	SDT_END()
--- a/src/vehicle_gui.h	Tue Mar 27 13:47:20 2007 +0000
+++ b/src/vehicle_gui.h	Tue Mar 27 13:58:24 2007 +0000
@@ -32,7 +32,7 @@
 
 void PlayerVehWndProc(Window *w, WindowEvent *e);
 
-void DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number);
+int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number);
 
 void DrawTrainImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection);
 void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection);