|
|
/* $Id$ */
|
|
|
|
|
|
/** @file roadveh_gui.cpp */
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
#include "openttd.h"
|
|
|
#include "debug.h"
|
|
|
#include "functions.h"
|
|
|
#include "roadveh.h"
|
|
|
#include "table/sprites.h"
|
|
|
#include "table/strings.h"
|
|
|
#include "gui.h"
|
|
|
#include "window_gui.h"
|
|
|
#include "vehicle.h"
|
|
|
#include "viewport.h"
|
|
|
#include "command_func.h"
|
|
|
#include "depot.h"
|
|
|
#include "vehicle_gui.h"
|
|
|
#include "newgrf_engine.h"
|
|
|
#include "strings_func.h"
|
|
|
|
|
|
|
|
|
void DrawRoadVehDetails(const Vehicle *v, int x, int y)
|
|
|
{
|
|
|
uint y_offset = RoadVehHasArticPart(v) ? 15 :0;
|
|
|
StringID str;
|
|
|
|
|
|
SetDParam(0, v->engine_type);
|
|
|
SetDParam(1, v->build_year);
|
|
|
SetDParam(2, v->value);
|
|
|
DrawString(x, y + y_offset, STR_9011_BUILT_VALUE, TC_FROMSTRING);
|
|
|
|
|
|
if (RoadVehHasArticPart(v)) {
|
|
|
AcceptedCargo max_cargo;
|
|
|
char capacity[512];
|
|
|
|
|
|
memset(max_cargo, 0, sizeof(max_cargo));
|
|
|
|
|
|
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
|
|
|
max_cargo[u->cargo_type] += u->cargo_cap;
|
|
|
}
|
|
|
|
|
|
GetString(capacity, STR_ARTICULATED_RV_CAPACITY, lastof(capacity));
|
|
|
|
|
|
bool first = true;
|
|
|
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
|
|
if (max_cargo[i] > 0) {
|
|
|
char buffer[128];
|
|
|
|
|
|
SetDParam(0, i);
|
|
|
SetDParam(1, max_cargo[i]);
|
|
|
GetString(buffer, STR_BARE_CARGO, lastof(buffer));
|
|
|
|
|
|
if (!first) strecat(capacity, ", ", lastof(capacity));
|
|
|
strecat(capacity, buffer, lastof(capacity));
|
|
|
first = false;
|