|
@@ -87,71 +87,72 @@ public:
|
|
|
|
|
|
virtual void OnPaint()
|
|
|
{
|
|
|
this->DrawWidgets();
|
|
|
|
|
|
uint y = 21;
|
|
|
for (uint i = 0; i < LAND_INFO_CENTERED_LINES; i++) {
|
|
|
if (StrEmpty(this->landinfo_data[i])) break;
|
|
|
|
|
|
DrawString(this->widget[LIW_BACKGROUND].left + 2, this->widget[LIW_BACKGROUND].right - 2, y, this->landinfo_data[i], i == 0 ? TC_LIGHT_BLUE : TC_FROMSTRING, SA_CENTER);
|
|
|
y += i == 0 ? 16 : 12;
|
|
|
}
|
|
|
|
|
|
if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) {
|
|
|
SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]);
|
|
|
DrawStringMultiLine(this->widget[LIW_BACKGROUND].left + 2, this->widget[LIW_BACKGROUND].right - 2, y, y + 22, STR_JUST_RAW_STRING, TC_FROMSTRING, SA_CENTER);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
LandInfoWindow(TileIndex tile) : Window(&_land_info_desc) {
|
|
|
Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
|
|
|
|
|
|
/* Because build_date is not set yet in every TileDesc, we make sure it is empty */
|
|
|
TileDesc td;
|
|
|
AcceptedCargo ac;
|
|
|
|
|
|
td.build_date = INVALID_DATE;
|
|
|
|
|
|
/* Most tiles have only one owner, but
|
|
|
* - drivethrough roadstops can be build on town owned roads (up to 2 owners) and
|
|
|
* - roads can have up to four owners (railroad, road, tram, 3rd-roadtype "highway").
|
|
|
*/
|
|
|
td.owner_type[0] = STR_LAND_AREA_INFORMATION_OWNER; // At least one owner is displayed, though it might be "N/A".
|
|
|
td.owner_type[1] = STR_NULL; // STR_NULL results in skipping the owner
|
|
|
td.owner_type[2] = STR_NULL;
|
|
|
td.owner_type[3] = STR_NULL;
|
|
|
td.owner[0] = OWNER_NONE;
|
|
|
td.owner[1] = OWNER_NONE;
|
|
|
td.owner[2] = OWNER_NONE;
|
|
|
td.owner[3] = OWNER_NONE;
|
|
|
|
|
|
td.station_class = STR_NULL;
|
|
|
td.station_name = STR_NULL;
|
|
|
|
|
|
td.grf = NULL;
|
|
|
|
|
|
GetAcceptedCargo(tile, ac);
|
|
|
AcceptedCargo ac;
|
|
|
memset(ac, 0, sizeof(AcceptedCargo));
|
|
|
AddAcceptedCargo(tile, ac);
|
|
|
GetTileDesc(tile, &td);
|
|
|
|
|
|
uint line_nr = 0;
|
|
|
|
|
|
/* Tiletype */
|
|
|
SetDParam(0, td.dparam[0]);
|
|
|
GetString(this->landinfo_data[line_nr], td.str, lastof(this->landinfo_data[line_nr]));
|
|
|
line_nr++;
|
|
|
|
|
|
/* Up to four owners */
|
|
|
for (uint i = 0; i < 4; i++) {
|
|
|
if (td.owner_type[i] == STR_NULL) continue;
|
|
|
|
|
|
SetDParam(0, STR_LAND_AREA_INFORMATION_OWNER_N_A);
|
|
|
if (td.owner[i] != OWNER_NONE && td.owner[i] != OWNER_WATER) GetNameOfOwner(td.owner[i], tile);
|
|
|
GetString(this->landinfo_data[line_nr], td.owner_type[i], lastof(this->landinfo_data[line_nr]));
|
|
|
line_nr++;
|
|
|
}
|
|
|
|
|
|
/* Cost to clear/revenue when cleared */
|
|
|
StringID str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A;
|
|
|
Company *c = Company::GetIfValid(_local_company);
|
|
|
if (c != NULL) {
|
|
|
Money old_money = c->money;
|