Changeset - r19264:619ce1a2ca96
[Not reviewed]
master
0 7 0
frosch - 12 years ago 2012-04-22 16:28:19
frosch@openttd.org
(svn r24167) -Codechange: Rename NewGRFClass::GetCount() to NewGRFClass::GetClassCount()
7 files changed with 20 insertions and 20 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -207,7 +207,7 @@ class BuildAirportWindow : public Picker
 
	{
 
		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));
 
				}
src/newgrf_class.h
Show inline comments
 
@@ -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);
 
};
 

	
src/newgrf_class_func.h
Show inline comments
 
@@ -109,7 +109,7 @@ NewGRFClass<Tspec, Tid, Tmax> *NewGRFCla
 
 * 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 *
 
	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);
src/object_gui.cpp
Show inline comments
 
@@ -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());
src/rail_gui.cpp
Show inline comments
 
@@ -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
 
/** 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);
 
}
 

	
src/station_cmd.cpp
Show inline comments
 
@@ -1105,7 +1105,7 @@ CommandCost CmdBuildRailStation(TileInde
 
	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;
 

	
src/terraform_gui.cpp
Show inline comments
 
@@ -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;
0 comments (0 inline, 0 general)