changeset 19278:2f2ce8473772 draft

(svn r24167) -Codechange: Rename NewGRFClass::GetCount() to NewGRFClass::GetClassCount()
author frosch <frosch@openttd.org>
date Sun, 22 Apr 2012 16:28:19 +0000
parents bdc478172220
children a6f596501843
files src/airport_gui.cpp src/newgrf_class.h src/newgrf_class_func.h src/object_gui.cpp src/rail_gui.cpp src/station_cmd.cpp src/terraform_gui.cpp
diffstat 7 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -207,7 +207,7 @@
 	{
 		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 @@
 		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));
 				}
--- a/src/newgrf_class.h
+++ b/src/newgrf_class.h
@@ -49,9 +49,9 @@
 	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);
 };
 
--- a/src/newgrf_class_func.h
+++ b/src/newgrf_class_func.h
@@ -109,7 +109,7 @@
  * 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 @@
 	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);
--- a/src/object_gui.cpp
+++ b/src/object_gui.cpp
@@ -42,7 +42,7 @@
 		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 @@
 	{
 		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 @@
 		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 @@
 		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());
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -937,7 +937,7 @@
 		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 @@
 			_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 @@
 		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 @@
 				/* 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 @@
 			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 @@
 
 			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 @@
 /** 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);
 }
 
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1105,7 +1105,7 @@
 	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;
 
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -163,7 +163,7 @@
 	{
 		/* 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 @@
 
 			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;