summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-10-25 17:21:57 +0000
committeralberth <alberth@openttd.org>2009-10-25 17:21:57 +0000
commit95ffbc2476942d9bbf66255e990dd372a3d8d00a (patch)
tree4063fcc745e79ab1f00de632e57ddb65e89f08cc
parenta558159faa10e66f27246f9fcd2defc717b05567 (diff)
downloadopenttd-95ffbc2476942d9bbf66255e990dd372a3d8d00a.tar.xz
(svn r17870) -Codechange: Use fontsize when drawing roadveh, ship, and aircraft details.
-rw-r--r--src/aircraft_gui.cpp10
-rw-r--r--src/roadveh_gui.cpp14
-rw-r--r--src/ship_gui.cpp6
3 files changed, 15 insertions, 15 deletions
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp
index ac2317a45..689411a4d 100644
--- a/src/aircraft_gui.cpp
+++ b/src/aircraft_gui.cpp
@@ -31,7 +31,7 @@
*/
void DrawAircraftDetails(const Aircraft *v, int left, int right, int y)
{
- int y_offset = (v->Next()->cargo_cap != 0) ? -11 : 0;
+ int y_offset = (v->Next()->cargo_cap != 0) ? -(FONT_HEIGHT_NORMAL + 1): 0;
Money feeder_share = 0;
for (const Aircraft *u = v ; u != NULL ; u = u->Next()) {
@@ -46,26 +46,26 @@ void DrawAircraftDetails(const Aircraft *v, int left, int right, int y)
SetDParam(2, u->Next()->cargo_type);
SetDParam(3, u->Next()->cargo_cap);
SetDParam(4, GetCargoSubtypeText(u));
- DrawString(left, right, y + 10, (u->Next()->cargo_cap != 0) ? STR_VEHICLE_INFO_CAPACITY_CAPACITY : STR_VEHICLE_INFO_CAPACITY);
+ DrawString(left, right, y + FONT_HEIGHT_NORMAL, (u->Next()->cargo_cap != 0) ? STR_VEHICLE_INFO_CAPACITY_CAPACITY : STR_VEHICLE_INFO_CAPACITY);
}
if (u->cargo_cap != 0) {
uint cargo_count = u->cargo.Count();
- y_offset += 11;
+ y_offset += FONT_HEIGHT_NORMAL + 1;
if (cargo_count != 0) {
/* Cargo names (fix pluralness) */
SetDParam(0, u->cargo_type);
SetDParam(1, cargo_count);
SetDParam(2, u->cargo.Source());
- DrawString(left, right, y + 21 + y_offset, STR_VEHICLE_DETAILS_CARGO_FROM);
+ DrawString(left, right, y + 2 * FONT_HEIGHT_NORMAL + 1 + y_offset, STR_VEHICLE_DETAILS_CARGO_FROM);
feeder_share += u->cargo.FeederShare();
}
}
}
SetDParam(0, feeder_share);
- DrawString(left, right, y + 33 + y_offset, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
+ DrawString(left, right, y + 3 * FONT_HEIGHT_NORMAL + 3 + y_offset, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
}
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index 7531a11b5..00116e270 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -33,7 +33,7 @@ void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y)
{
const RoadVehicle *rv = RoadVehicle::From(v);
- uint y_offset = rv->HasArticulatedPart() ? 15 : 0;
+ uint y_offset = rv->HasArticulatedPart() ? 15 : 0; // Draw the first line below the sprite of an articulated RV instead of after it.
StringID str;
Money feeder_share = 0;
@@ -80,7 +80,7 @@ void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y)
}
}
- DrawString(left, right, y + 10 + y_offset, capacity, TC_BLUE);
+ DrawString(left, right, y + FONT_HEIGHT_NORMAL + y_offset, capacity, TC_BLUE);
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
if (u->cargo_cap == 0) continue;
@@ -93,12 +93,12 @@ void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y)
str = STR_VEHICLE_DETAILS_CARGO_FROM;
feeder_share += u->cargo.FeederShare();
}
- DrawString(left, right, y + 21 + y_offset, str);
+ DrawString(left, right, y + 2 * FONT_HEIGHT_NORMAL + 1 + y_offset, str);
- y_offset += 11;
+ y_offset += FONT_HEIGHT_NORMAL + 1;
}
- y_offset -= 11;
+ y_offset -= FONT_HEIGHT_NORMAL + 1;
} else {
SetDParam(0, v->cargo_type);
SetDParam(1, v->cargo_cap);
@@ -113,12 +113,12 @@ void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y)
str = STR_VEHICLE_DETAILS_CARGO_FROM;
feeder_share += v->cargo.FeederShare();
}
- DrawString(left, right, y + 21 + y_offset, str);
+ DrawString(left, right, y + 2 * FONT_HEIGHT_NORMAL + 1 + y_offset, str);
}
/* Draw Transfer credits text */
SetDParam(0, feeder_share);
- DrawString(left, right, y + 33 + y_offset, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
+ DrawString(left, right, y + 3 * FONT_HEIGHT_NORMAL + 3 + y_offset, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
}
/**
diff --git a/src/ship_gui.cpp b/src/ship_gui.cpp
index 81da28597..abc2a84d2 100644
--- a/src/ship_gui.cpp
+++ b/src/ship_gui.cpp
@@ -59,7 +59,7 @@ void DrawShipDetails(const Vehicle *v, int left, int right, int y)
SetDParam(0, v->cargo_type);
SetDParam(1, v->cargo_cap);
SetDParam(4, GetCargoSubtypeText(v));
- DrawString(left, right, y + 10, STR_VEHICLE_INFO_CAPACITY);
+ DrawString(left, right, y + FONT_HEIGHT_NORMAL, STR_VEHICLE_INFO_CAPACITY);
StringID str = STR_VEHICLE_DETAILS_CARGO_EMPTY;
if (!v->cargo.Empty()) {
@@ -68,9 +68,9 @@ void DrawShipDetails(const Vehicle *v, int left, int right, int y)
SetDParam(2, v->cargo.Source());
str = STR_VEHICLE_DETAILS_CARGO_FROM;
}
- DrawString(left, right, y + 21, str);
+ DrawString(left, right, y + 2 * FONT_HEIGHT_NORMAL + 1, str);
/* Draw Transfer credits text */
SetDParam(0, v->cargo.FeederShare());
- DrawString(left, right, y + 33, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
+ DrawString(left, right, y + 3 * FONT_HEIGHT_NORMAL + 3, STR_VEHICLE_INFO_FEEDER_CARGO_VALUE);
}