missing files added
--HG-- branch : novattd150
This commit is contained in:
218
src/cargo_table_gui.cpp
Normal file
218
src/cargo_table_gui.cpp
Normal file
@@ -0,0 +1,218 @@
|
||||
/* $Id: cargo_table_gui.cpp 21909 2011-01-26 08:14:36Z TheDude $ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "window_gui.h"
|
||||
#include "window_func.h"
|
||||
#include "strings_func.h"
|
||||
#include "company_func.h"
|
||||
#include "company_base.h"
|
||||
#include "table/strings.h"
|
||||
#include "textbuf_gui.h"
|
||||
#include "cargotype.h"
|
||||
#include "widgets/dropdown_type.h"
|
||||
|
||||
#include "widgets/cargo_table_widget.h"
|
||||
|
||||
static const uint EXP_TOPPADDING = 5;
|
||||
static const uint EXP_LINESPACE = 2; ///< Amount of vertical space for a horizontal (sub-)total line.
|
||||
static const uint EXP_BLOCKSPACE = 10; ///< Amount of vertical space between two blocks of numbers.
|
||||
|
||||
enum CargoOption {
|
||||
WID_CT_OPTION_CARGO_TOTAL = 0,
|
||||
WID_CT_OPTION_CARGO_MONTH,
|
||||
};
|
||||
|
||||
static void DrawPrice(Money amount, int left, int right, int top)
|
||||
{
|
||||
SetDParam(0, amount);
|
||||
DrawString(left, right, top, STR_FINANCES_POSITIVE_INCOME, TC_FROMSTRING, SA_RIGHT);
|
||||
}
|
||||
|
||||
void InvalidateCargosWindows(CompanyID cid)
|
||||
{
|
||||
if (cid == _local_company) SetWindowDirty(WC_STATUS_BAR, 0);
|
||||
SetWindowDirty(WC_CARGOS, cid);
|
||||
}
|
||||
|
||||
/** Cargos window handler. */
|
||||
struct CargosWindow : Window {
|
||||
|
||||
CargoOption cargoPeriod;
|
||||
CargosWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
||||
{
|
||||
this->InitNested(window_number);
|
||||
this->owner = (Owner)this->window_number;
|
||||
this->cargoPeriod = WID_CT_OPTION_CARGO_TOTAL;
|
||||
}
|
||||
|
||||
virtual void SetStringParameters(int widget) const
|
||||
{
|
||||
if(widget != WID_CT_CAPTION) return;
|
||||
SetDParam(0, (CompanyID)this->window_number);
|
||||
SetDParam(1, (CompanyID)this->window_number);
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
{
|
||||
if(widget != WID_CT_HEADER_CARGO) return;
|
||||
this->cargoPeriod = (this->cargoPeriod == WID_CT_OPTION_CARGO_TOTAL) ? WID_CT_OPTION_CARGO_MONTH : WID_CT_OPTION_CARGO_TOTAL;
|
||||
this->SetDirty();
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
{
|
||||
uint extra_width = 0;
|
||||
switch(widget){
|
||||
case WID_CT_HEADER_AMOUNT:
|
||||
case WID_CT_HEADER_INCOME:
|
||||
extra_width += 16;
|
||||
case WID_CT_HEADER_CARGO:
|
||||
size->width = 96 + extra_width;
|
||||
size->height = EXP_BLOCKSPACE + EXP_LINESPACE;
|
||||
break;
|
||||
|
||||
case WID_CT_AMOUNT:
|
||||
case WID_CT_INCOME:
|
||||
extra_width += 16;
|
||||
case WID_CT_LIST:
|
||||
size->width = 96 + extra_width;
|
||||
size->height = (_sorted_standard_cargo_specs_size + 3) * (EXP_BLOCKSPACE + EXP_LINESPACE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawWidget(const Rect &r, int widget) const
|
||||
{
|
||||
int rect_x = (r.left + WD_FRAMERECT_LEFT);
|
||||
int y = r.top;
|
||||
const Company *c = Company::Get((CompanyID)this->window_number);
|
||||
uint32 sum_cargo_amount = 0;
|
||||
Money sum_cargo_income = 0;
|
||||
|
||||
switch(widget){
|
||||
case WID_CT_HEADER_CARGO:
|
||||
//DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_HEADER_CARGO, TC_FROMSTRING, SA_LEFT);
|
||||
y += EXP_BLOCKSPACE + EXP_LINESPACE;
|
||||
break;
|
||||
case WID_CT_HEADER_AMOUNT:
|
||||
DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_HEADER_AMOUNT, TC_FROMSTRING, SA_CENTER);
|
||||
y += EXP_BLOCKSPACE + EXP_LINESPACE;
|
||||
break;
|
||||
case WID_CT_HEADER_INCOME:
|
||||
DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_HEADER_INCOME, TC_FROMSTRING, SA_RIGHT);
|
||||
y += EXP_BLOCKSPACE + EXP_LINESPACE;
|
||||
break;
|
||||
|
||||
case WID_CT_LIST:{
|
||||
y += EXP_TOPPADDING; //top padding
|
||||
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
|
||||
const CargoSpec *cs = _sorted_cargo_specs[i];
|
||||
|
||||
GfxFillRect(rect_x, y, rect_x + 8, y + 5, 0);
|
||||
GfxFillRect(rect_x + 1, y + 1, rect_x + 7, y + 4, cs->legend_colour); //coloured cargo rectangles
|
||||
|
||||
SetDParam(0, cs->name);
|
||||
DrawString(r.left + 14, r.right, y, STR_TOOLBAR_CARGOS_NAME); //cargo name
|
||||
|
||||
y += EXP_BLOCKSPACE + EXP_LINESPACE; //padding
|
||||
}
|
||||
|
||||
//total
|
||||
GfxFillRect(rect_x, y, rect_x + 96, y, 0);
|
||||
y += EXP_BLOCKSPACE + EXP_LINESPACE;
|
||||
|
||||
StringID string_to_draw = STR_TOOLBAR_CARGOS_HEADER_TOTAL;
|
||||
if(this->cargoPeriod != WID_CT_OPTION_CARGO_TOTAL) string_to_draw++;
|
||||
DrawString(r.left, r.right, y, string_to_draw);
|
||||
break;
|
||||
}
|
||||
case WID_CT_AMOUNT:
|
||||
y += EXP_TOPPADDING;
|
||||
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
|
||||
const CargoSpec *cs = _sorted_cargo_specs[i];
|
||||
|
||||
if(this->cargoPeriod == WID_CT_OPTION_CARGO_MONTH){
|
||||
sum_cargo_amount += c->cargo_units_period[0][cs->Index()];
|
||||
SetDParam(0, c->cargo_units_period[0][cs->Index()]);
|
||||
}
|
||||
else{
|
||||
sum_cargo_amount += c->cargo_units[cs->Index()];
|
||||
SetDParam(0, c->cargo_units[cs->Index()]);
|
||||
}
|
||||
|
||||
DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_UNITS, TC_FROMSTRING, SA_RIGHT); //cargo amount in pcs
|
||||
y += EXP_BLOCKSPACE + EXP_LINESPACE;
|
||||
}
|
||||
|
||||
//total
|
||||
GfxFillRect(rect_x, y, rect_x + 108, y, 0);
|
||||
y += EXP_BLOCKSPACE + EXP_LINESPACE;
|
||||
SetDParam(0, sum_cargo_amount);
|
||||
DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_UNITS_TOTAL, TC_FROMSTRING, SA_RIGHT);
|
||||
break;
|
||||
|
||||
case WID_CT_INCOME:
|
||||
y += EXP_TOPPADDING;
|
||||
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
|
||||
const CargoSpec *cs = _sorted_cargo_specs[i];
|
||||
|
||||
if(this->cargoPeriod == WID_CT_OPTION_CARGO_MONTH){
|
||||
sum_cargo_income += c->cargo_income_period[0][cs->Index()];
|
||||
DrawPrice(c->cargo_income_period[0][cs->Index()], r.left, r.right, y); //cargo income in money
|
||||
}
|
||||
else{
|
||||
sum_cargo_income += c->cargo_income[cs->Index()];
|
||||
DrawPrice(c->cargo_income[cs->Index()], r.left, r.right, y); //cargo income in money
|
||||
}
|
||||
|
||||
y += EXP_BLOCKSPACE + EXP_LINESPACE;
|
||||
}
|
||||
|
||||
//total
|
||||
GfxFillRect(rect_x, y, rect_x + 108, y, 0);
|
||||
y += EXP_BLOCKSPACE + EXP_LINESPACE;
|
||||
DrawPrice(sum_cargo_income, r.left, r.right, y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const NWidgetPart _nested_cargos_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY, WID_CT_CAPTION), SetDataTip(STR_TOOLBAR_CARGOS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 1),
|
||||
NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT), SetPIP(0, 9, 0),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CT_HEADER_CARGO), SetMinimalSize(96, 16),SetFill(1, 0), SetPadding(2,2,2,2), SetDataTip(STR_TOOLBAR_CARGOS_HEADER_CARGO, STR_TOOLBAR_CARGOS_HEADER_CARGO),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_HEADER_AMOUNT), SetMinimalSize(108, 16), SetFill(1, 0), SetPadding(2,2,2,2), SetDataTip(STR_TOOLBAR_CARGOS_HEADER_AMOUNT, STR_TOOLBAR_CARGOS_HEADER_AMOUNT),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_HEADER_INCOME), SetMinimalSize(108, 16), SetFill(1, 0), SetPadding(2,2,2,2), SetDataTip(STR_TOOLBAR_CARGOS_HEADER_INCOME, STR_TOOLBAR_CARGOS_HEADER_INCOME),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 1),
|
||||
NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT), SetPIP(0, 9, 0),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_LIST),SetMinimalSize(96, 0),SetFill(1, 0), SetPadding(2,2,2,2), SetResize(1, 1),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_AMOUNT),SetMinimalSize(108, 0),SetFill(1, 0), SetPadding(2,2,2,2), SetResize(1, 1),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_INCOME),SetMinimalSize(108, 0),SetFill(1, 0), SetPadding(2,2,2,2), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
static WindowDesc _cargos_desc(
|
||||
WDP_AUTO, NULL, 0, 0,
|
||||
WC_CARGOS, WC_NONE,
|
||||
WDF_CONSTRUCTION,
|
||||
_nested_cargos_widgets, lengthof(_nested_cargos_widgets)
|
||||
);
|
||||
|
||||
void ShowCompanyCargos(CompanyID company)
|
||||
{
|
||||
if (!Company::IsValidID(company)) return;
|
||||
AllocateWindowDescFront<CargosWindow>(&_cargos_desc, company);
|
||||
}
|
||||
|
||||
14
src/cargo_table_gui.h
Normal file
14
src/cargo_table_gui.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/* $Id: cargo_table_gui.h 21700 2011-01-03 11:55:08Z $ */
|
||||
|
||||
/** @file cargo_table_gui.h GUI Functions related to cargos. */
|
||||
|
||||
#ifndef CARGO_TABLE_H
|
||||
#define CARGO_TABLE_H
|
||||
|
||||
#include "company_type.h"
|
||||
#include "gfx_type.h"
|
||||
|
||||
void ShowCompanyCargos(CompanyID company);
|
||||
void InvalidateCargosWindows(CompanyID cid);
|
||||
|
||||
#endif /* CARGO_TABLE_H */
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: rev.cpp.in 26440 2014-04-01 18:33:16Z frosch $ */
|
||||
/* $Id: rev.cpp.in 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -39,7 +39,7 @@ bool IsReleasedVersion()
|
||||
* norev000 is for non-releases that are made on systems without
|
||||
* subversion or sources that are not a checkout of subversion.
|
||||
*/
|
||||
const char _openttd_revision[] = "1.4.0";
|
||||
const char _openttd_revision[] = "1.5.0-beta2";
|
||||
|
||||
/**
|
||||
* The text version of OpenTTD's build date.
|
||||
@@ -72,11 +72,11 @@ const byte _openttd_revision_modified = 0;
|
||||
* final release will always have a lower version number than the released
|
||||
* version, thus making comparisons on specific revisions easy.
|
||||
*/
|
||||
const uint32 _openttd_newgrf_version = 1 << 28 | 4 << 24 | 0 << 20 | 1 << 19 | (26440 & ((1 << 19) - 1));
|
||||
const uint32 _openttd_newgrf_version = 1 << 28 | 5 << 24 | 0 << 20 | 0 << 19 | (0 & ((1 << 19) - 1));
|
||||
|
||||
#ifdef __MORPHOS__
|
||||
/**
|
||||
* Variable used by MorphOS to show the version.
|
||||
*/
|
||||
extern const char morphos_versions_tag[] = "$VER: OpenTTD 1.4.0 (02.04.14) OpenTTD Team [MorphOS, PowerPC]";
|
||||
extern const char morphos_versions_tag[] = "$VER: OpenTTD h8ec37454M-novattd150 (17.03.15) OpenTTD Team [MorphOS, PowerPC]";
|
||||
#endif
|
||||
|
||||
20
src/widgets/cargo_table_widget.h
Normal file
20
src/widgets/cargo_table_widget.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/* $Id: cargo_table_widget.h 23600 2011-12-19 20:46:17Z TheDude $ */
|
||||
|
||||
/** @file cargo_table_widget.h Types related to the cargos widgets. */
|
||||
|
||||
#ifndef WIDGETS_CARGO_TABLE_WIDGET_H
|
||||
#define WIDGETS_CARGO_TABLE_WIDGET_H
|
||||
|
||||
/** Widgets of the #CargosWindow class. */
|
||||
enum CargosWidgets {
|
||||
WID_CT_BACKGROUND, ///< Caption of the window.
|
||||
WID_CT_CAPTION,
|
||||
WID_CT_HEADER_CARGO,
|
||||
WID_CT_HEADER_AMOUNT,
|
||||
WID_CT_HEADER_INCOME,
|
||||
WID_CT_LIST,
|
||||
WID_CT_AMOUNT,
|
||||
WID_CT_INCOME,
|
||||
};
|
||||
|
||||
#endif /* WIDGETS_CARGO_TABLE_WIDGET_H */
|
||||
33
src/zoning.h
Normal file
33
src/zoning.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/** @file zoning.h */
|
||||
|
||||
#ifndef ZONING_H_
|
||||
#define ZONING_H_
|
||||
|
||||
#include "tile_cmd.h"
|
||||
|
||||
enum EvaluationMode {
|
||||
CHECKNOTHING = 0,
|
||||
CHECKOPINION = 1, ///< Check the local authority's opinion.
|
||||
CHECKBUILD = 2, ///< Check wither or not the player can build.
|
||||
CHECKSTACATCH = 3, ///< Check catchment area for stations
|
||||
CHECKBULUNSER = 4, ///< Check for unserved buildings
|
||||
CHECKINDUNSER = 5, ///< Check for unserved industries
|
||||
CHECKTOWNZONES = 6, ///< Town zones (Tz*)
|
||||
CHECKCBBORDERS = 7, ///< Citybuilder cargo acceptment zone
|
||||
CHECKCBTOWNBORDERS = 8, ///< Citybuilder server town borders
|
||||
CHECKTOWNADZONES = 9, ///< Town advertisement zone
|
||||
CHECKTOWNGROWTHTILES = 10 ///< Town growth tiles (new house, skipped/removed house)
|
||||
};
|
||||
|
||||
struct Zoning {
|
||||
EvaluationMode inner;
|
||||
EvaluationMode outer;
|
||||
};
|
||||
|
||||
extern Zoning _zoning;
|
||||
|
||||
SpriteID TileZoningSpriteEvaluation(TileIndex tile, Owner owner, EvaluationMode ev_mode);
|
||||
void DrawTileZoning(const TileInfo *ti);
|
||||
void ShowZoningToolbar();
|
||||
|
||||
#endif /*ZONING_H_*/
|
||||
Reference in New Issue
Block a user