summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-04-22 16:28:19 +0000
committerfrosch <frosch@openttd.org>2012-04-22 16:28:19 +0000
commitc841a78f69370c2bf806cbe6c89b58ed8efc0bac (patch)
tree501e95f7bb5aabfc5fec171feeda7052a35a2751 /src
parent0f0e7e43cf09c0ff82e4119b08956670160aaa58 (diff)
downloadopenttd-c841a78f69370c2bf806cbe6c89b58ed8efc0bac.tar.xz
(svn r24167) -Codechange: Rename NewGRFClass::GetCount() to NewGRFClass::GetClassCount()
Diffstat (limited to 'src')
-rw-r--r--src/airport_gui.cpp4
-rw-r--r--src/newgrf_class.h2
-rw-r--r--src/newgrf_class_func.h4
-rw-r--r--src/object_gui.cpp8
-rw-r--r--src/rail_gui.cpp16
-rw-r--r--src/station_cmd.cpp2
-rw-r--r--src/terraform_gui.cpp4
7 files changed, 20 insertions, 20 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 8ac038b9c..630c32cf5 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -207,7 +207,7 @@ class BuildAirportWindow : public PickerWindowBase {
{
DropDownList *list = new DropDownList();
- for (uint i = 0; i < AirportClass::GetCount(); i++) {
+ for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
list->push_back(new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false));
}
@@ -268,7 +268,7 @@ public:
switch (widget) {
case WID_AP_CLASS_DROPDOWN: {
Dimension d = {0, 0};
- for (uint i = 0; i < AirportClass::GetCount(); i++) {
+ for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
SetDParam(0, AirportClass::Get((AirportClassID)i)->name);
d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
}
diff --git a/src/newgrf_class.h b/src/newgrf_class.h
index 94360f459..0690c6a51 100644
--- a/src/newgrf_class.h
+++ b/src/newgrf_class.h
@@ -49,9 +49,9 @@ public:
static void Reset();
static Tid Allocate(uint32 global_id);
static void Assign(Tspec *spec);
+ static uint GetClassCount();
static NewGRFClass *Get(Tid cls_id);
- static uint GetCount();
static const Tspec *GetByGrf(uint32 grfid, byte local_id, int *index);
};
diff --git a/src/newgrf_class_func.h b/src/newgrf_class_func.h
index 03c82a8d6..9bcb6b3c9 100644
--- a/src/newgrf_class_func.h
+++ b/src/newgrf_class_func.h
@@ -109,7 +109,7 @@ NewGRFClass<Tspec, Tid, Tmax> *NewGRFClass<Tspec, Tid, Tmax>::Get(Tid cls_id)
* Get the number of allocated classes.
* @return The number of classes.
*/
-DEFINE_NEWGRF_CLASS_METHOD(uint)::GetCount()
+DEFINE_NEWGRF_CLASS_METHOD(uint)::GetClassCount()
{
uint i;
for (i = 0; i < Tmax && classes[i].global_id != 0; i++) {}
@@ -162,6 +162,6 @@ DEFINE_NEWGRF_CLASS_METHOD(const Tspec *)::GetByGrf(uint32 grfid, byte local_id,
template void name::Insert(Tspec *spec); \
template void name::Assign(Tspec *spec); \
template NewGRFClass<Tspec, Tid, Tmax> *name::Get(Tid cls_id); \
- template uint name::GetCount(); \
+ template uint name::GetClassCount(); \
template const Tspec *name::GetSpec(uint index) const; \
template const Tspec *name::GetByGrf(uint32 grfid, byte localidx, int *index);
diff --git a/src/object_gui.cpp b/src/object_gui.cpp
index e907629e4..5fd9b1fcc 100644
--- a/src/object_gui.cpp
+++ b/src/object_gui.cpp
@@ -42,7 +42,7 @@ public:
this->vscroll = this->GetScrollbar(WID_BO_SCROLLBAR);
this->vscroll->SetCapacity(5);
this->vscroll->SetPosition(0);
- this->vscroll->SetCount(ObjectClass::GetCount());
+ this->vscroll->SetCount(ObjectClass::GetClassCount());
this->FinishInitNested(desc, 0);
@@ -77,7 +77,7 @@ public:
{
switch (widget) {
case WID_BO_CLASS_LIST: {
- for (uint i = 0; i < ObjectClass::GetCount(); i++) {
+ for (uint i = 0; i < ObjectClass::GetClassCount(); i++) {
size->width = max(size->width, GetStringBoundingBox(ObjectClass::Get((ObjectClassID)i)->name).width);
}
size->width += padding.width;
@@ -155,7 +155,7 @@ public:
switch (GB(widget, 0, 16)) {
case WID_BO_CLASS_LIST: {
int y = r.top;
- for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < ObjectClass::GetCount(); i++) {
+ for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < ObjectClass::GetClassCount(); i++) {
SetDParam(0, ObjectClass::Get((ObjectClassID)i)->name);
DrawString(r.left + WD_MATRIX_LEFT, r.right + WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, STR_JUST_STRING,
((int)i == _selected_object_class) ? TC_WHITE : TC_BLACK);
@@ -289,7 +289,7 @@ public:
switch (GB(widget, 0, 16)) {
case WID_BO_CLASS_LIST: {
int num_clicked = this->vscroll->GetPosition() + (pt.y - this->nested_array[widget]->pos_y) / this->line_height;
- if (num_clicked >= (int)ObjectClass::GetCount()) break;
+ if (num_clicked >= (int)ObjectClass::GetClassCount()) break;
_selected_object_class = (ObjectClassID)num_clicked;
this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX)->SetCount(ObjectClass::Get(_selected_object_class)->GetSpecCount());
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 38c7e95b7..4ce0d1785 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -937,7 +937,7 @@ public:
this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_OFF, !_settings_client.gui.station_show_coverage);
this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_ON, _settings_client.gui.station_show_coverage);
- if (!newstation || _railstation.station_class >= (int)StationClass::GetCount()) {
+ if (!newstation || _railstation.station_class >= (int)StationClass::GetClassCount()) {
/* New stations are not available or changed, so ensure the default station
* type is 'selected'. */
_railstation.station_class = STAT_CLASS_DFLT;
@@ -949,7 +949,7 @@ public:
_railstation.station_type = min(_railstation.station_type, _railstation.station_count - 1);
int count = 0;
- for (uint i = 0; i < StationClass::GetCount(); i++) {
+ for (uint i = 0; i < StationClass::GetClassCount(); i++) {
if (i == STAT_CLASS_WAYP) continue;
count++;
}
@@ -1024,7 +1024,7 @@ public:
switch (widget) {
case WID_BRAS_NEWST_LIST: {
Dimension d = {0, 0};
- for (uint i = 0; i < StationClass::GetCount(); i++) {
+ for (uint i = 0; i < StationClass::GetClassCount(); i++) {
if (i == STAT_CLASS_WAYP) continue;
SetDParam(0, StationClass::Get((StationClassID)i)->name);
d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
@@ -1046,7 +1046,7 @@ public:
/* If newstations exist, compute the non-zero minimal size. */
Dimension d = {0, 0};
StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data;
- for (StationClassID statclass = STAT_CLASS_BEGIN; statclass < (StationClassID)StationClass::GetCount(); statclass++) {
+ for (StationClassID statclass = STAT_CLASS_BEGIN; statclass < (StationClassID)StationClass::GetClassCount(); statclass++) {
if (statclass == STAT_CLASS_WAYP) continue;
StationClass *stclass = StationClass::Get(statclass);
for (uint16 j = 0; j < stclass->GetSpecCount(); j++) {
@@ -1102,7 +1102,7 @@ public:
case WID_BRAS_NEWST_LIST: {
uint statclass = 0;
uint row = 0;
- for (uint i = 0; i < StationClass::GetCount(); i++) {
+ for (uint i = 0; i < StationClass::GetClassCount(); i++) {
if (i == STAT_CLASS_WAYP) continue;
if (this->vscroll->IsVisible(statclass)) {
SetDParam(0, StationClass::Get((StationClassID)i)->name);
@@ -1283,8 +1283,8 @@ public:
case WID_BRAS_NEWST_LIST: {
int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_BRAS_NEWST_LIST, 0, this->line_height);
- if (y >= (int)StationClass::GetCount()) return;
- for (uint i = 0; i < StationClass::GetCount(); i++) {
+ if (y >= (int)StationClass::GetClassCount()) return;
+ for (uint i = 0; i < StationClass::GetClassCount(); i++) {
if (i == STAT_CLASS_WAYP) continue;
if (y == 0) {
if (_railstation.station_class != (StationClassID)i) {
@@ -1437,7 +1437,7 @@ static const WindowDesc _station_builder_desc(
/** Open station build window */
static void ShowStationBuilder(Window *parent)
{
- bool newstations = StationClass::GetCount() > 2 || StationClass::Get(STAT_CLASS_DFLT)->GetSpecCount() != 1;
+ bool newstations = StationClass::GetClassCount() > 2 || StationClass::Get(STAT_CLASS_DFLT)->GetSpecCount() != 1;
new BuildRailStationWindow(&_station_builder_desc, parent, newstations);
}
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 254f0d346..5a56d7a45 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1105,7 +1105,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
if (!ValParamRailtype(rt)) return CMD_ERROR;
/* Check if the given station class is valid */
- if ((uint)spec_class >= StationClass::GetCount() || spec_class == STAT_CLASS_WAYP) return CMD_ERROR;
+ if ((uint)spec_class >= StationClass::GetClassCount() || spec_class == STAT_CLASS_WAYP) return CMD_ERROR;
if (spec_index >= StationClass::Get(spec_class)->GetSpecCount()) return CMD_ERROR;
if (plat_len == 0 || numtracks == 0) return CMD_ERROR;
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 587135230..00d611e27 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -163,7 +163,7 @@ struct TerraformToolbarWindow : Window {
{
/* Don't show the place object button when there are no objects to place. */
NWidgetStacked *show_object = this->GetWidget<NWidgetStacked>(WID_TT_SHOW_PLACE_OBJECT);
- show_object->SetDisplayedPlane(ObjectClass::GetCount() != 0 ? 0 : SZSP_NONE);
+ show_object->SetDisplayedPlane(ObjectClass::GetClassCount() != 0 ? 0 : SZSP_NONE);
}
virtual void OnClick(Point pt, int widget, int click_count)
@@ -209,7 +209,7 @@ struct TerraformToolbarWindow : Window {
case WID_TT_PLACE_OBJECT: // Place object button
/* Don't show the place object button when there are no objects to place. */
- if (ObjectClass::GetCount() == 0) return;
+ if (ObjectClass::GetClassCount() == 0) return;
if (HandlePlacePushButton(this, WID_TT_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT)) {
ShowBuildObjectPicker(this);
this->last_user_action = widget;