Changeset - r23553:9f01781fc43d
src/autoreplace_gui.cpp
Show inline comments
 
@@ -157,13 +157,13 @@ class ReplaceVehicleWindow : public Wind
 
	{
 
		EngineID e = this->sel_engine[0];
 

	
 
		if (this->engines[0].NeedRebuild()) {
 
			/* We need to rebuild the left engines list */
 
			this->GenerateReplaceVehList(true);
 
			this->vscroll[0]->SetCount(this->engines[0].size());
 
			this->vscroll[0]->SetCount((uint)this->engines[0].size());
 
			if (this->reset_sel_engine && this->sel_engine[0] == INVALID_ENGINE && this->engines[0].size() != 0) {
 
				this->sel_engine[0] = this->engines[0][0];
 
			}
 
		}
 

	
 
		if (this->engines[1].NeedRebuild() || e != this->sel_engine[0]) {
 
@@ -177,13 +177,13 @@ class ReplaceVehicleWindow : public Wind
 
					/* Select the current replacement for sel_engine[0]. */
 
					const Company *c = Company::Get(_local_company);
 
					this->sel_engine[1] = EngineReplacementForCompany(c, this->sel_engine[0], this->sel_group);
 
				}
 
				/* Regenerate the list on the right. Note: This resets sel_engine[1] to INVALID_ENGINE, if it is no longer available. */
 
				this->GenerateReplaceVehList(false);
 
				this->vscroll[1]->SetCount(this->engines[1].size());
 
				this->vscroll[1]->SetCount((uint)this->engines[1].size());
 
				if (this->reset_sel_engine && this->sel_engine[1] != INVALID_ENGINE) {
 
					int position = 0;
 
					for (EngineID &eid : this->engines[1]) {
 
						if (eid == this->sel_engine[1]) break;
 
						++position;
 
					}
 
@@ -381,13 +381,13 @@ public:
 
			}
 

	
 
			case WID_RV_LEFT_MATRIX:
 
			case WID_RV_RIGHT_MATRIX: {
 
				int side = (widget == WID_RV_LEFT_MATRIX) ? 0 : 1;
 
				EngineID start  = this->vscroll[side]->GetPosition(); // what is the offset for the start (scrolling)
 
				EngineID end    = min(this->vscroll[side]->GetCapacity() + start, this->engines[side].size());
 
				EngineID end    = min(this->vscroll[side]->GetCapacity() + start, (uint)this->engines[side].size());
 

	
 
				/* Do the actual drawing */
 
				DrawEngineList((VehicleType)this->window_number, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP,
 
						&this->engines[side], start, end, this->sel_engine[side], side == 0, this->sel_group);
 
				break;
 
			}
src/bridge_gui.cpp
Show inline comments
 
@@ -150,13 +150,13 @@ public:
 
		this->parent = FindWindowById(WC_BUILD_TOOLBAR, GB(this->type, 15, 2));
 
		this->bridges->SetListing(this->last_sorting);
 
		this->bridges->SetSortFuncs(this->sorter_funcs);
 
		this->bridges->NeedResort();
 
		this->SortBridgeList();
 

	
 
		this->vscroll->SetCount(bl->size());
 
		this->vscroll->SetCount((uint)bl->size());
 
	}
 

	
 
	~BuildBridgeWindow()
 
	{
 
		this->last_sorting = this->bridges->GetListing();
 

	
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -1526,25 +1526,25 @@ struct BuildVehicleWindow : Window {
 
	}
 

	
 
	void DrawWidget(const Rect &r, int widget) const override
 
	{
 
		switch (widget) {
 
			case WID_BV_LIST:
 
				DrawEngineList(this->vehicle_type, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, &this->eng_list, this->vscroll->GetPosition(), min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->eng_list.size()), this->sel_engine, false, DEFAULT_GROUP);
 
				DrawEngineList(this->vehicle_type, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, &this->eng_list, this->vscroll->GetPosition(), min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)this->eng_list.size()), this->sel_engine, false, DEFAULT_GROUP);
 
				break;
 

	
 
			case WID_BV_SORT_ASCENDING_DESCENDING:
 
				this->DrawSortButtonState(WID_BV_SORT_ASCENDING_DESCENDING, this->descending_sort_order ? SBS_DOWN : SBS_UP);
 
				break;
 
		}
 
	}
 

	
 
	void OnPaint() override
 
	{
 
		this->GenerateBuildList();
 
		this->vscroll->SetCount(this->eng_list.size());
 
		this->vscroll->SetCount((uint)this->eng_list.size());
 

	
 
		this->SetWidgetsDisabledState(this->sel_engine == INVALID_ENGINE, WID_BV_SHOW_HIDE, WID_BV_BUILD, WID_BV_RENAME, WIDGET_LIST_END);
 

	
 
		this->DrawWidgets();
 

	
 
		if (!this->IsShaded()) {
src/company_gui.cpp
Show inline comments
 
@@ -683,13 +683,13 @@ private:
 
			for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
 
				if (_livery_class[scheme] == this->livery_class && HasBit(_loaded_newgrf_features.used_liveries, scheme)) {
 
					this->rows++;
 
				}
 
			}
 
		} else {
 
			this->rows = this->groups.size();
 
			this->rows = (uint)this->groups.size();
 
		}
 

	
 
		this->vscroll->SetCount(this->rows);
 
	}
 

	
 
public:
 
@@ -899,13 +899,13 @@ public:
 
				if (_livery_class[scheme] == this->livery_class && HasBit(_loaded_newgrf_features.used_liveries, scheme)) {
 
					if (pos-- > 0) continue;
 
					draw_livery(STR_LIVERY_DEFAULT + scheme, c->livery[scheme], HasBit(this->sel, scheme), scheme == LS_DEFAULT, 0);
 
				}
 
			}
 
		} else {
 
			uint max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->groups.size());
 
			uint max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)this->groups.size());
 
			for (uint i = this->vscroll->GetPosition(); i < max; ++i) {
 
				const Group *g = this->groups[i];
 
				SetDParam(0, g->index);
 
				draw_livery(STR_GROUP_NAME, g->livery, this->sel == g->index, false, this->indents[i] * LEVEL_WIDTH);
 
			}
 
		}
src/core/math_func.hpp
Show inline comments
 
@@ -244,15 +244,15 @@ static inline T Delta(const T a, const T
 
 * @param x The value to check
 
 * @param base The base value of the interval
 
 * @param size The size of the interval
 
 * @return True if the value is in the interval, false else.
 
 */
 
template <typename T>
 
static inline bool IsInsideBS(const T x, const uint base, const uint size)
 
static inline bool IsInsideBS(const T x, const size_t base, const size_t size)
 
{
 
	return (uint)(x - base) < size;
 
	return (size_t)(x - base) < size;
 
}
 

	
 
/**
 
 * Checks if a value is in an interval.
 
 *
 
 * Returns true if a value is in the interval of [min, max).
 
@@ -260,15 +260,15 @@ static inline bool IsInsideBS(const T x,
 
 * @param x The value to check
 
 * @param min The minimum of the interval
 
 * @param max The maximum of the interval
 
 * @see IsInsideBS()
 
 */
 
template <typename T>
 
static inline bool IsInsideMM(const T x, const uint min, const uint max)
 
static inline bool IsInsideMM(const T x, const size_t min, const size_t max)
 
{
 
	return (uint)(x - min) < (max - min);
 
	return (size_t)(x - min) < (max - min);
 
}
 

	
 
/**
 
 * Type safe swap operation
 
 * @param a variable to swap with b
 
 * @param b variable to swap with a
src/core/sort_func.hpp
Show inline comments
 
@@ -22,13 +22,13 @@
 
 * @param base Pointer to the first element of the array to be sorted.
 
 * @param num Number of elements in the array pointed by base.
 
 * @param comparator Function that compares two elements.
 
 * @param desc Sort descending.
 
 */
 
template <typename T>
 
static inline void QSortT(T *base, uint num, int (CDECL *comparator)(const T*, const T*), bool desc = false)
 
static inline void QSortT(T *base, size_t num, int (CDECL *comparator)(const T*, const T*), bool desc = false)
 
{
 
	if (num < 2) return;
 

	
 
	qsort(base, num, sizeof(T), (int (CDECL *)(const void *, const void *))comparator);
 

	
 
	if (desc) MemReverseT(base, num);
 
@@ -46,13 +46,13 @@ static inline void QSortT(T *base, uint 
 
 * @param base Pointer to the first element of the array to be sorted.
 
 * @param num Number of elements in the array pointed by base.
 
 * @param comparator Function that compares two elements.
 
 * @param desc Sort descending.
 
 */
 
template <typename T>
 
static inline void GSortT(T *base, uint num, int (CDECL *comparator)(const T*, const T*), bool desc = false)
 
static inline void GSortT(T *base, size_t num, int (CDECL *comparator)(const T*, const T*), bool desc = false)
 
{
 
	if (num < 2) return;
 

	
 
	assert(base != NULL);
 
	assert(comparator != NULL);
 

	
src/depot_gui.cpp
Show inline comments
 
@@ -395,13 +395,13 @@ struct DepotWindow : Window {
 
			}
 
		}
 

	
 
		uint16 rows_in_display = wid->current_y / wid->resize_y;
 

	
 
		uint16 num = this->vscroll->GetPosition() * this->num_columns;
 
		int maxval = min(this->vehicle_list.size(), num + (rows_in_display * this->num_columns));
 
		int maxval = min((uint)this->vehicle_list.size(), num + (rows_in_display * this->num_columns));
 
		int y;
 
		for (y = r.top + 1; num < maxval; y += this->resize.step_height) { // Draw the rows
 
			for (byte i = 0; i < this->num_columns && num < maxval; i++, num++) {
 
				/* Draw all vehicles in the current row */
 
				const Vehicle *v = this->vehicle_list[num];
 
				if (this->num_columns == 1) {
 
@@ -410,13 +410,13 @@ struct DepotWindow : Window {
 
					int x = r.left + (rtl ? (this->num_columns - i - 1) : i) * this->resize.step_width;
 
					this->DrawVehicleInDepot(v, x, x + this->resize.step_width - 1, y);
 
				}
 
			}
 
		}
 

	
 
		maxval = min(this->vehicle_list.size() + this->wagon_list.size(), (this->vscroll->GetPosition() * this->num_columns) + (rows_in_display * this->num_columns));
 
		maxval = min((uint)this->vehicle_list.size() + (uint)this->wagon_list.size(), (this->vscroll->GetPosition() * this->num_columns) + (rows_in_display * this->num_columns));
 

	
 
		/* Draw the train wagons without an engine in front. */
 
		for (; num < maxval; num++, y += this->resize.step_height) {
 
			const Vehicle *v = this->wagon_list[num - this->vehicle_list.size()];
 
			this->DrawVehicleInDepot(v, r.left, r.right, y);
 
		}
 
@@ -480,13 +480,13 @@ struct DepotWindow : Window {
 
		bool wagon = false;
 
		if (this->vehicle_list.size() > pos) {
 
			*veh = this->vehicle_list[pos];
 
			/* Skip vehicles that are scrolled off the list */
 
			if (this->type == VEH_TRAIN) x += this->hscroll->GetPosition();
 
		} else {
 
			pos -= this->vehicle_list.size();
 
			pos -= (uint)this->vehicle_list.size();
 
			*veh = this->wagon_list[pos];
 
			/* free wagons don't have an initial loco. */
 
			x -= ScaleGUITrad(VEHICLEINFO_FULL_VEHICLE_WIDTH);
 
			wagon = true;
 
		}
 

	
 
@@ -731,17 +731,17 @@ struct DepotWindow : Window {
 
				for (const Train *v = Train::From(this->vehicle_list[num]); v != NULL; v = v->Next()) {
 
					width += v->GetDisplayImageWidth();
 
				}
 
				max_width = max(max_width, width);
 
			}
 
			/* Always have 1 empty row, so people can change the setting of the train */
 
			this->vscroll->SetCount(this->vehicle_list.size() + this->wagon_list.size() + 1);
 
			this->vscroll->SetCount((uint)this->vehicle_list.size() + (uint)this->wagon_list.size() + 1);
 
			/* Always make it longer than the longest train, so you can attach vehicles at the end, and also see the next vertical tile separator line */
 
			this->hscroll->SetCount(max_width + ScaleGUITrad(2 * VEHICLEINFO_FULL_VEHICLE_WIDTH + 1));
 
		} else {
 
			this->vscroll->SetCount(CeilDiv(this->vehicle_list.size(), this->num_columns));
 
			this->vscroll->SetCount(CeilDiv((uint)this->vehicle_list.size(), this->num_columns));
 
		}
 

	
 
		/* Setup disabled buttons. */
 
		TileIndex tile = this->window_number;
 
		this->SetWidgetsDisabledState(!IsTileOwner(tile, _local_company),
 
			WID_D_STOP_ALL,
src/engine_gui.cpp
Show inline comments
 
@@ -322,13 +322,13 @@ void DrawVehicleEngine(int left, int rig
 
 * Sort all items using quick sort and given 'CompareItems' function
 
 * @param el list to be sorted
 
 * @param compare function for evaluation of the quicksort
 
 */
 
void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare)
 
{
 
	uint size = el->size();
 
	size_t size = el->size();
 
	/* out-of-bounds access at the next line for size == 0 (even with operator[] at some systems)
 
	 * generally, do not sort if there are less than 2 items */
 
	if (size < 2) return;
 
	QSortT(el->data(), size, compare);
 
}
 

	
src/fios.cpp
Show inline comments
 
@@ -339,13 +339,13 @@ bool FiosFileScanner::AddFile(const char
 
static void FiosGetFileList(SaveLoadOperation fop, fios_getlist_callback_proc *callback_proc, Subdirectory subdir, FileList &file_list)
 
{
 
	struct stat sb;
 
	struct dirent *dirent;
 
	DIR *dir;
 
	FiosItem *fios;
 
	int sort_start;
 
	size_t sort_start;
 
	char d_name[sizeof(fios->name)];
 

	
 
	file_list.Clear();
 

	
 
	/* A parent directory link exists if we are not in the root directory */
 
	if (!FiosIsRoot(_fios_path)) {
src/fios.h
Show inline comments
 
@@ -125,13 +125,13 @@ public:
 
	}
 

	
 
	/**
 
	 * Get the number of files in the list.
 
	 * @return The number of files stored in the list.
 
	 */
 
	inline uint Length() const
 
	inline size_t Length() const
 
	{
 
		return this->files.size();
 
	}
 

	
 
	/**
 
	 * Get a pointer to the first file information.
 
@@ -152,36 +152,36 @@ public:
 
	}
 

	
 
	/**
 
	 * Get a pointer to the indicated file information. File information must exist.
 
	 * @return Address of the indicated existing file information.
 
	 */
 
	inline const FiosItem *Get(uint index) const
 
	inline const FiosItem *Get(size_t index) const
 
	{
 
		return this->files.data() + index;
 
	}
 

	
 
	/**
 
	 * Get a pointer to the indicated file information. File information must exist.
 
	 * @return Address of the indicated existing file information.
 
	 */
 
	inline FiosItem *Get(uint index)
 
	inline FiosItem *Get(size_t index)
 
	{
 
		return this->files.data() + index;
 
	}
 

	
 
	inline const FiosItem &operator[](uint index) const
 
	inline const FiosItem &operator[](size_t index) const
 
	{
 
		return this->files[index];
 
	}
 

	
 
	/**
 
	 * Get a reference to the indicated file information. File information must exist.
 
	 * @return The requested file information.
 
	 */
 
	inline FiosItem &operator[](uint index)
 
	inline FiosItem &operator[](size_t index)
 
	{
 
		return this->files[index];
 
	}
 

	
 
	/** Remove all items from the list. */
 
	inline void Clear()
src/fios_gui.cpp
Show inline comments
 
@@ -241,14 +241,14 @@ static const TextColour _fios_colours[] 
 
/**
 
 * Sort the collected list save games prior to displaying it in the save/load gui.
 
 * @param[in,out] file_list List of save game files found in the directory.
 
 */
 
static void SortSaveGameList(FileList &file_list)
 
{
 
	uint sort_start = 0;
 
	uint sort_end = 0;
 
	size_t sort_start = 0;
 
	size_t sort_end = 0;
 

	
 
	/* Directories are always above the files (FIOS_TYPE_DIR)
 
	 * Drives (A:\ (windows only) are always under the files (FIOS_TYPE_DRIVE)
 
	 * Only sort savegames/scenarios, not directories
 
	 */
 
	for (const FiosItem *item = file_list.Begin(); item != file_list.End(); item++) {
 
@@ -257,13 +257,13 @@ static void SortSaveGameList(FileList &f
 
			case FIOS_TYPE_PARENT: sort_start++; break;
 
			case FIOS_TYPE_DRIVE:  sort_end++;   break;
 
			default: break;
 
		}
 
	}
 

	
 
	uint s_amount = file_list.Length() - sort_start - sort_end;
 
	size_t s_amount = file_list.Length() - sort_start - sort_end;
 
	QSortT(file_list.Get(sort_start), s_amount, CompareFiosItems);
 
}
 

	
 
struct SaveLoadWindow : public Window {
 
private:
 
	static const uint EDITBOX_MAX_SIZE   =  50;
 
@@ -779,13 +779,13 @@ public:
 
				this->selected = NULL;
 
				_load_check_data.Clear();
 
				if (!gui_scope) break;
 

	
 
				_fios_path_changed = true;
 
				this->fios_items.BuildFileList(this->abstract_filetype, this->fop);
 
				this->vscroll->SetCount(this->fios_items.Length());
 
				this->vscroll->SetCount((uint)this->fios_items.Length());
 
				this->selected = NULL;
 
				_load_check_data.Clear();
 

	
 
				/* We reset the files filtered */
 
				this->OnInvalidateData(SLIWD_FILTER_CHANGES);
 

	
src/gfx.cpp
Show inline comments
 
@@ -571,13 +571,13 @@ int GetStringHeight(StringID str, int ma
 
int GetStringLineCount(StringID str, int maxw)
 
{
 
	char buffer[DRAW_STRING_BUFFER];
 
	GetString(buffer, str, lastof(buffer));
 

	
 
	Layouter layout(buffer, maxw);
 
	return layout.size();
 
	return (uint)layout.size();
 
}
 

	
 
/**
 
 * Calculate string bounding box for multi-line strings.
 
 * @param str        String to check.
 
 * @param suggestion Suggested bounding box.
src/gfx_layout.cpp
Show inline comments
 
@@ -446,13 +446,13 @@ int FallbackParagraphLayout::FallbackLin
 
/**
 
 * Get the number of runs in this line.
 
 * @return The number of runs.
 
 */
 
int FallbackParagraphLayout::FallbackLine::CountRuns() const
 
{
 
	return this->size();
 
	return (uint)this->size();
 
}
 

	
 
/**
 
 * Get a specific visual run.
 
 * @return The visual run.
 
 */
src/group_gui.cpp
Show inline comments
 
@@ -511,14 +511,14 @@ public:
 
		 * else this->list will contain all vehicles which belong to the selected group */
 
		this->BuildVehicleList();
 
		this->SortVehicleList();
 

	
 
		this->BuildGroupList(this->owner);
 

	
 
		this->group_sb->SetCount(this->groups.size());
 
		this->vscroll->SetCount(this->vehicles.size());
 
		this->group_sb->SetCount((uint)this->groups.size());
 
		this->vscroll->SetCount((uint)this->vehicles.size());
 

	
 
		/* The drop down menu is out, *but* it may not be used, retract it. */
 
		if (this->vehicles.size() == 0 && this->IsWidgetLowered(WID_GL_MANAGE_VEHICLES_DROPDOWN)) {
 
			this->RaiseWidget(WID_GL_MANAGE_VEHICLES_DROPDOWN);
 
			HideDropDownMenu(this);
 
		}
 
@@ -572,13 +572,13 @@ public:
 
				break;
 

	
 
			case WID_GL_INFO: {
 
				Money this_year = 0;
 
				Money last_year = 0;
 
				uint32 occupancy = 0;
 
				uint32 vehicle_count = this->vehicles.size();
 
				size_t vehicle_count = this->vehicles.size();
 

	
 
				for (uint i = 0; i < vehicle_count; i++) {
 
					const Vehicle *v = this->vehicles[i];
 
					assert(v->owner == this->owner);
 

	
 
					this_year += v->GetDisplayProfitThisYear();
 
@@ -608,13 +608,13 @@ public:
 

	
 
				break;
 
			}
 

	
 
			case WID_GL_LIST_GROUP: {
 
				int y1 = r.top + WD_FRAMERECT_TOP;
 
				int max = min(this->group_sb->GetPosition() + this->group_sb->GetCapacity(), this->groups.size());
 
				int max = min(this->group_sb->GetPosition() + this->group_sb->GetCapacity(), (uint)this->groups.size());
 
				for (int i = this->group_sb->GetPosition(); i < max; ++i) {
 
					const Group *g = this->groups[i];
 

	
 
					assert(g->owner == this->owner);
 

	
 
					DrawGroupInfo(y1, r.left, r.right, g->index, this->indents[i] * LEVEL_WIDTH, g->replace_protection, g->folded || (i + 1 < (int)this->groups.size() && indents[i + 1] > this->indents[i]));
 
@@ -632,13 +632,13 @@ public:
 
				break;
 

	
 
			case WID_GL_LIST_VEHICLE:
 
				if (this->vli.index != ALL_GROUP) {
 
					/* Mark vehicles which are in sub-groups */
 
					int y = r.top;
 
					uint max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->vehicles.size());
 
					uint max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)this->vehicles.size());
 
					for (uint i = this->vscroll->GetPosition(); i < max; ++i) {
 
						const Vehicle *v = this->vehicles[i];
 
						if (v->group_id != this->vli.index) {
 
							GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->resize.step_height - 2, _colour_gradient[COLOUR_GREY][3], FILLRECT_CHECKER);
 
						}
 
						y += this->resize.step_height;
src/industry_gui.cpp
Show inline comments
 
@@ -1208,13 +1208,13 @@ protected:
 
			FOR_ALL_INDUSTRIES(i) {
 
				this->industries.push_back(i);
 
			}
 

	
 
			this->industries.shrink_to_fit();
 
			this->industries.RebuildDone();
 
			this->vscroll->SetCount(this->industries.size()); // Update scrollbar as well.
 
			this->vscroll->SetCount((uint)this->industries.size()); // Update scrollbar as well.
 
		}
 

	
 
		if (!this->industries.Sort()) return;
 
		IndustryDirectoryWindow::last_industry = NULL; // Reset name sorter sort cache
 
		this->SetWidgetDirty(WID_ID_INDUSTRY_LIST); // Set the modified widget dirty
 
	}
src/linkgraph/linkgraph.h
Show inline comments
 
@@ -493,13 +493,13 @@ public:
 
	inline ConstNode operator[](NodeID num) const { return ConstNode(this, num); }
 

	
 
	/**
 
	 * Get the current size of the component.
 
	 * @return Size.
 
	 */
 
	inline uint Size() const { return this->nodes.size(); }
 
	inline uint Size() const { return (uint)this->nodes.size(); }
 

	
 
	/**
 
	 * Get date of last compression.
 
	 * @return Date of last compression.
 
	 */
 
	inline Date LastCompression() const { return this->last_compression; }
src/music/win32_m.cpp
Show inline comments
 
@@ -39,13 +39,13 @@ static struct {
 
	bool do_stop;        ///< flag for stopping playback at next opportunity
 
	byte current_volume; ///< current effective volume setting
 
	byte new_volume;     ///< volume setting to change to
 

	
 
	MidiFile current_file;           ///< file currently being played from
 
	PlaybackSegment current_segment; ///< segment info for current playback
 
	DWORD playback_start_time;       ///< timestamp current file began playback
 
	size_t playback_start_time;      ///< timestamp current file began playback
 
	size_t current_block;            ///< next block index to send
 
	MidiFile next_file;              ///< upcoming file to play
 
	PlaybackSegment next_segment;    ///< segment info for upcoming file
 

	
 
	byte channel_volumes[16]; ///< last seen volume controller values in raw data
 
} _midi;
 
@@ -181,13 +181,13 @@ void CALLBACK TimerCallback(UINT uTimerI
 

	
 
	/* skip beginning of file? */
 
	if (_midi.current_segment.start > 0 && _midi.current_block == 0 && _midi.current_segment.start_block == 0) {
 
		/* find first block after start time and pretend playback started earlier
 
		* this is to allow all blocks prior to the actual start to still affect playback,
 
		* as they may contain important controller and program changes */
 
		uint preload_bytes = 0;
 
		size_t preload_bytes = 0;
 
		for (size_t bl = 0; bl < _midi.current_file.blocks.size(); bl++) {
 
			MidiFile::DataBlock &block = _midi.current_file.blocks[bl];
 
			preload_bytes += block.data.size();
 
			if (block.ticktime >= _midi.current_segment.start) {
 
				if (_midi.current_segment.loop) {
 
					DEBUG(driver, 2, "Win32-MIDI: timer: loop from block %d (ticktime %d, realtime %.3f, bytes %d)", (int)bl, (int)block.ticktime, ((int)block.realtime)/1000.0, (int)preload_bytes);
 
@@ -207,13 +207,13 @@ void CALLBACK TimerCallback(UINT uTimerI
 
		}
 
	}
 

	
 

	
 
	/* play pending blocks */
 
	DWORD current_time = timeGetTime();
 
	DWORD playback_time = current_time - _midi.playback_start_time;
 
	size_t playback_time = current_time - _midi.playback_start_time;
 
	while (_midi.current_block < _midi.current_file.blocks.size()) {
 
		MidiFile::DataBlock &block = _midi.current_file.blocks[_midi.current_block];
 

	
 
		/* check that block isn't at end-of-song override */
 
		if (_midi.current_segment.end > 0 && block.ticktime >= _midi.current_segment.end) {
 
			if (_midi.current_segment.loop) {
src/network/network_content.cpp
Show inline comments
 
@@ -247,13 +247,13 @@ void ClientNetworkContentSocketHandler::
 

	
 
	assert(cv->size() < 255);
 
	assert(cv->size() < (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint8)) /
 
			(sizeof(uint8) + sizeof(uint32) + (send_md5sum ? /*sizeof(ContentInfo::md5sum)*/16 : 0)));
 

	
 
	Packet *p = new Packet(send_md5sum ? PACKET_CONTENT_CLIENT_INFO_EXTID_MD5 : PACKET_CONTENT_CLIENT_INFO_EXTID);
 
	p->Send_uint8(cv->size());
 
	p->Send_uint8((uint8)cv->size());
 

	
 
	for (const ContentInfo *ci : *cv) {
 
		p->Send_uint8((byte)ci->type);
 
		p->Send_uint32(ci->unique_id);
 
		if (!send_md5sum) continue;
 

	
 
@@ -296,13 +296,13 @@ void ClientNetworkContentSocketHandler::
 
		if (!ci->IsSelected() || ci->state == ContentInfo::ALREADY_HERE) continue;
 

	
 
		content.push_back(ci->id);
 
		bytes += ci->filesize;
 
	}
 

	
 
	files = content.size();
 
	files = (uint)content.size();
 

	
 
	/* If there's nothing to download, do nothing. */
 
	if (files == 0) return;
 

	
 
	if (_settings_client.network.no_http_content_downloads || fallback) {
 
		this->DownloadSelectedContentFallback(content);
 
@@ -314,13 +314,13 @@ void ClientNetworkContentSocketHandler::
 
/**
 
 * Initiate downloading the content over HTTP.
 
 * @param content The content to download.
 
 */
 
void ClientNetworkContentSocketHandler::DownloadSelectedContentHTTP(const ContentIDList &content)
 
{
 
	uint count = content.size();
 
	uint count = (uint)content.size();
 

	
 
	/* Allocate memory for the whole request.
 
	 * Requests are "id\nid\n..." (as strings), so assume the maximum ID,
 
	 * which is uint32 so 10 characters long. Then the newlines and
 
	 * multiply that all with the count and then add the '\0'. */
 
	uint bytes = (10 + 1) * count + 1;
 
@@ -342,13 +342,13 @@ void ClientNetworkContentSocketHandler::
 
/**
 
 * Initiate downloading the content over the fallback protocol.
 
 * @param content The content to download.
 
 */
 
void ClientNetworkContentSocketHandler::DownloadSelectedContentFallback(const ContentIDList &content)
 
{
 
	uint count = content.size();
 
	uint count = (uint)content.size();
 
	const ContentID *content_ids = content.data();
 
	this->Connect();
 

	
 
	while (count > 0) {
 
		/* We can "only" send a limited number of IDs in a single packet.
 
		 * A packet begins with the packet size and a byte for the type.
src/network/network_content.h
Show inline comments
 
@@ -126,13 +126,13 @@ public:
 

	
 
	void ReverseLookupDependency(ConstContentVector &parents, const ContentInfo *child) const;
 
	void ReverseLookupTreeDependency(ConstContentVector &tree, const ContentInfo *child) const;
 
	void CheckDependencyState(ContentInfo *ci);
 

	
 
	/** Get the number of content items we know locally. */
 
	uint Length() const { return this->infos.size(); }
 
	uint Length() const { return (uint)this->infos.size(); }
 
	/** Get the begin of the content inf iterator. */
 
	ConstContentIterator Begin() const { return this->infos.data(); }
 
	/** Get the nth position of the content inf iterator. */
 
	ConstContentIterator Get(uint32 index) const { return this->infos.data() + index; }
 
	/** Get the end of the content inf iterator. */
 
	ConstContentIterator End() const { return this->Begin() + this->Length(); }
src/network/network_content_gui.cpp
Show inline comments
 
@@ -397,13 +397,13 @@ class NetworkContentListWindow : public 
 

	
 
		this->FilterContentList();
 
		this->content.shrink_to_fit();
 
		this->content.RebuildDone();
 
		this->SortContentList();
 

	
 
		this->vscroll->SetCount(this->content.size()); // Update the scrollbar
 
		this->vscroll->SetCount((int)this->content.size()); // Update the scrollbar
 
		this->ScrollToSelected();
 
	}
 

	
 
	/** Sort content by name. */
 
	static int CDECL NameSorter(const ContentInfo * const *a, const ContentInfo * const *b)
 
	{
 
@@ -810,13 +810,13 @@ public:
 

	
 
			case WID_NCL_CHECKBOX:
 
			case WID_NCL_TYPE:
 
			case WID_NCL_NAME:
 
				if (this->content.SortType() == widget - WID_NCL_CHECKBOX) {
 
					this->content.ToggleSortOrder();
 
					if (this->content.size() > 0) this->list_pos = this->content.size() - this->list_pos - 1;
 
					if (this->content.size() > 0) this->list_pos = (int)this->content.size() - this->list_pos - 1;
 
				} else {
 
					this->content.SetSortType(widget - WID_NCL_CHECKBOX);
 
					this->content.ForceResort();
 
					this->SortContentList();
 
				}
 
				this->ScrollToSelected();
 
@@ -885,13 +885,13 @@ public:
 
			case WKC_HOME:
 
				/* jump to beginning */
 
				this->list_pos = 0;
 
				break;
 
			case WKC_END:
 
				/* jump to end */
 
				this->list_pos = this->content.size() - 1;
 
				this->list_pos = (int)this->content.size() - 1;
 
				break;
 

	
 
			case WKC_SPACE:
 
			case WKC_RETURN:
 
				if (keycode == WKC_RETURN || !IsWidgetFocused(WID_NCL_FILTER)) {
 
					if (this->selected != NULL) {
src/network/network_gui.cpp
Show inline comments
 
@@ -266,13 +266,13 @@ protected:
 
		} else {
 
			this->servers.SetFilterState(false);
 
		}
 

	
 
		this->servers.shrink_to_fit();
 
		this->servers.RebuildDone();
 
		this->vscroll->SetCount(this->servers.size());
 
		this->vscroll->SetCount((int)this->servers.size());
 

	
 
		/* Sort the list of network games as requested. */
 
		this->servers.Sort();
 
		this->UpdateListPos();
 
	}
 

	
 
@@ -707,13 +707,13 @@ public:
 
			case WID_NG_MAPSIZE: // Sort by map size
 
			case WID_NG_DATE:    // Sort by date
 
			case WID_NG_YEARS:   // Sort by years
 
			case WID_NG_INFO:    // Connectivity (green dot)
 
				if (this->servers.SortType() == widget - WID_NG_NAME) {
 
					this->servers.ToggleSortOrder();
 
					if (this->list_pos != SLP_INVALID) this->list_pos = this->servers.size() - this->list_pos - 1;
 
					if (this->list_pos != SLP_INVALID) this->list_pos = (ServerListPosition)this->servers.size() - this->list_pos - 1;
 
				} else {
 
					this->servers.SetSortType(widget - WID_NG_NAME);
 
					this->servers.ForceResort();
 
					this->SortNetworkGameList();
 
				}
 
				this->ScrollToSelectedServer();
 
@@ -844,13 +844,13 @@ public:
 
				case WKC_HOME:
 
					/* jump to beginning */
 
					this->list_pos = 0;
 
					break;
 
				case WKC_END:
 
					/* jump to end */
 
					this->list_pos = this->servers.size() - 1;
 
					this->list_pos = (ServerListPosition)this->servers.size() - 1;
 
					break;
 
				default: NOT_REACHED();
 
			}
 

	
 
			this->server = this->servers[this->list_pos];
 

	
 
@@ -1784,13 +1784,13 @@ struct NetworkClientListPopupWindow : Wi
 
	{
 
		Dimension d = *size;
 
		for (const ClientListAction &action : this->actions) {
 
			d = maxdim(GetStringBoundingBox(action.name), d);
 
		}
 

	
 
		d.height *= this->actions.size();
 
		d.height *= (uint)this->actions.size();
 
		d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
		d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
		*size = d;
 
	}
 

	
 
	void DrawWidget(const Rect &r, int widget) const override
src/newgrf.cpp
Show inline comments
 
@@ -4819,13 +4819,13 @@ static void NewSpriteGroup(ByteReader *b
 
					adjust.divmod_val = 0;
 
				}
 

	
 
				/* Continue reading var adjusts while bit 5 is set. */
 
			} while (HasBit(varadjust, 5));
 

	
 
			group->num_adjusts = adjusts.size();
 
			group->num_adjusts = (uint)adjusts.size();
 
			group->adjusts = MallocT<DeterministicSpriteGroupAdjust>(group->num_adjusts);
 
			MemCpyT(group->adjusts, adjusts.data(), group->num_adjusts);
 

	
 
			std::vector<DeterministicSpriteGroupRange> ranges;
 
			ranges.resize(buf->ReadByte());
 
			for (uint i = 0; i < ranges.size(); i++) {
 
@@ -9199,13 +9199,13 @@ static void FinalisePriceBaseMultipliers
 
{
 
	extern const PriceBaseSpec _price_base_specs[];
 
	/** Features, to which '_grf_id_overrides' applies. Currently vehicle features only. */
 
	static const uint32 override_features = (1 << GSF_TRAINS) | (1 << GSF_ROADVEHICLES) | (1 << GSF_SHIPS) | (1 << GSF_AIRCRAFT);
 

	
 
	/* Evaluate grf overrides */
 
	int num_grfs = _grf_files.size();
 
	int num_grfs = (uint)_grf_files.size();
 
	int *grf_overrides = AllocaM(int, num_grfs);
 
	for (int i = 0; i < num_grfs; i++) {
 
		grf_overrides[i] = -1;
 

	
 
		GRFFile *source = _grf_files[i];
 
		uint32 override = _grf_id_overrides[source->grfid];
src/newgrf_debug_gui.cpp
Show inline comments
 
@@ -892,13 +892,13 @@ struct SpriteAlignerWindow : Window {
 

	
 
			case WID_SA_LIST: {
 
				const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(widget);
 
				int step_size = nwid->resize_y;
 

	
 
				std::vector<SpriteID> &list = _newgrf_debug_sprite_picker.sprites;
 
				int max = min<int>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), list.size());
 
				int max = min<int>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)list.size());
 

	
 
				int y = r.top + WD_FRAMERECT_TOP;
 
				for (int i = this->vscroll->GetPosition(); i < max; i++) {
 
					SetDParam(0, list[i]);
 
					DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_BLACK_COMMA, TC_FROMSTRING, SA_RIGHT | SA_FORCE);
 
					y += step_size;
 
@@ -1012,13 +1012,13 @@ struct SpriteAlignerWindow : Window {
 
	void OnInvalidateData(int data = 0, bool gui_scope = true) override
 
	{
 
		if (!gui_scope) return;
 
		if (data == 1) {
 
			/* Sprite picker finished */
 
			this->RaiseWidget(WID_SA_PICKER);
 
			this->vscroll->SetCount(_newgrf_debug_sprite_picker.sprites.size());
 
			this->vscroll->SetCount((uint)_newgrf_debug_sprite_picker.sprites.size());
 
		}
 
	}
 

	
 
	void OnResize() override
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, WID_SA_LIST);
src/newgrf_gui.cpp
Show inline comments
 
@@ -879,13 +879,13 @@ struct NewGRFWindow : public Window, New
 
				GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, this->active_over == -2 ? PC_DARK_GREY : PC_BLACK);
 

	
 
				uint step_height = this->GetWidget<NWidgetBase>(WID_NS_AVAIL_LIST)->resize_y;
 
				int offset_y = (step_height - FONT_HEIGHT_NORMAL) / 2;
 
				uint y = r.top + WD_FRAMERECT_TOP;
 
				uint min_index = this->vscroll2->GetPosition();
 
				uint max_index = min(min_index + this->vscroll2->GetCapacity(), this->avails.size());
 
				uint max_index = min(min_index + this->vscroll2->GetCapacity(), (uint)this->avails.size());
 

	
 
				for (uint i = min_index; i < max_index; i++) {
 
					const GRFConfig *c = this->avails[i];
 
					bool h = (c == this->avail_sel);
 
					const char *text = c->GetName();
 

	
 
@@ -1325,13 +1325,13 @@ struct NewGRFWindow : public Window, New
 
				/* jump to beginning */
 
				this->avail_pos = 0;
 
				break;
 

	
 
			case WKC_END:
 
				/* jump to end */
 
				this->avail_pos = this->avails.size() - 1;
 
				this->avail_pos = (uint)this->avails.size() - 1;
 
				break;
 

	
 
			default:
 
				return ES_NOT_HANDLED;
 
		}
 

	
 
@@ -1489,13 +1489,13 @@ private:
 
			this->avail_pos = find_index(this->avails, this->avail_sel);
 
			if (this->avail_pos == -1) {
 
				this->avail_sel = NULL;
 
			}
 
		}
 

	
 
		this->vscroll2->SetCount(this->avails.size()); // Update the scrollbar
 
		this->vscroll2->SetCount((uint)this->avails.size()); // Update the scrollbar
 
	}
 

	
 
	/**
 
	 * Insert a GRF into the active list.
 
	 * @param ins_pos Insert GRF at this position.
 
	 * @return True if the GRF was successfully added.
 
@@ -2064,13 +2064,13 @@ struct SavePresetWindow : public Window 
 
		this->presetname_editbox.cancel_button = WID_SVP_CANCEL;
 

	
 
		this->CreateNestedTree();
 
		this->vscroll = this->GetScrollbar(WID_SVP_SCROLLBAR);
 
		this->FinishInitNested(0);
 

	
 
		this->vscroll->SetCount(this->presets.size());
 
		this->vscroll->SetCount((uint)this->presets.size());
 
		this->SetFocusedWidget(WID_SVP_EDITBOX);
 
		if (initial_text != NULL) this->presetname_editbox.text.Assign(initial_text);
 
	}
 

	
 
	~SavePresetWindow()
 
	{
 
@@ -2084,13 +2084,13 @@ struct SavePresetWindow : public Window 
 
				size->height = 0;
 
				for (uint i = 0; i < this->presets.size(); i++) {
 
					Dimension d = GetStringBoundingBox(this->presets[i]);
 
					size->width = max(size->width, d.width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT);
 
					resize->height = max(resize->height, d.height);
 
				}
 
				size->height = ClampU(this->presets.size(), 5, 20) * resize->height + 1;
 
				size->height = ClampU((uint)this->presets.size(), 5, 20) * resize->height + 1;
 
				break;
 
			}
 
		}
 
	}
 

	
 
	void DrawWidget(const Rect &r, int widget) const override
 
@@ -2100,13 +2100,13 @@ struct SavePresetWindow : public Window 
 
				GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK);
 

	
 
				uint step_height = this->GetWidget<NWidgetBase>(WID_SVP_PRESET_LIST)->resize_y;
 
				int offset_y = (step_height - FONT_HEIGHT_NORMAL) / 2;
 
				uint y = r.top + WD_FRAMERECT_TOP;
 
				uint min_index = this->vscroll->GetPosition();
 
				uint max_index = min(min_index + this->vscroll->GetCapacity(), this->presets.size());
 
				uint max_index = min(min_index + this->vscroll->GetCapacity(), (uint)this->presets.size());
 

	
 
				for (uint i = min_index; i < max_index; i++) {
 
					if ((int)i == this->selected) GfxFillRect(r.left + 1, y, r.right - 1, y + step_height - 2, PC_DARK_BLUE);
 

	
 
					const char *text = this->presets[i];
 
					DrawString(r.left + WD_FRAMERECT_LEFT, r.right, y + offset_y, text, ((int)i == this->selected) ? TC_WHITE : TC_SILVER);
src/newgrf_sound.cpp
Show inline comments
 
@@ -53,13 +53,13 @@ SoundEntry *GetSound(SoundID index)
 
	return &_sounds[index];
 
}
 

	
 

	
 
uint GetNumSounds()
 
{
 
	return _sounds.size();
 
	return (uint)_sounds.size();
 
}
 

	
 

	
 
/**
 
 * Extract meta data from a NewGRF sound.
 
 * @param sound Sound to load.
src/os/windows/string_uniscribe.cpp
Show inline comments
 
@@ -107,13 +107,13 @@ public:
 

	
 
	/** A single line worth of VisualRuns. */
 
	class UniscribeLine : public AutoDeleteSmallVector<UniscribeVisualRun *>, public ParagraphLayouter::Line {
 
	public:
 
		virtual int GetLeading() const;
 
		virtual int GetWidth() const;
 
		virtual int CountRuns() const { return this->size();  }
 
		virtual int CountRuns() const { return (uint)this->size();  }
 
		virtual const VisualRun *GetVisualRun(int run) const { return this->at(run);  }
 

	
 
		int GetInternalCharLength(WChar c) const
 
		{
 
			/* Uniscribe uses UTF-16 internally which means we need to account for surrogate pairs. */
 
			return c >= 0x010000U ? 2 : 1;
src/saveload/game_sl.cpp
Show inline comments
 
@@ -129,13 +129,13 @@ static const SaveLoad _game_language_str
 
	 SLE_END()
 
};
 

	
 
static void SaveReal_GSTR(LanguageStrings *ls)
 
{
 
	_game_saveload_string  = ls->language;
 
	_game_saveload_strings = ls->lines.size();
 
	_game_saveload_strings = (uint)ls->lines.size();
 

	
 
	SlObject(NULL, _game_language_header);
 
	for (uint i = 0; i < _game_saveload_strings; i++) {
 
		_game_saveload_string = ls->lines[i];
 
		SlObject(NULL, _game_language_string);
 
	}
src/script/api/script_road.cpp
Show inline comments
 
@@ -242,24 +242,24 @@ static int32 LookupWithBuildOnSlopes(::S
 
			/* An invalid slope. */
 
			return -1;
 
	}
 

	
 
	/* Now perform the actual rotation. */
 
	for (int j = 0; j < base_rotate; j++) {
 
		for (int i = 0; i < existing->size; i++) {
 
		for (size_t i = 0; i < existing->size; i++) {
 
			existing->array[i] = RotateNeighbour(existing->array[i]);
 
		}
 
		start = RotateNeighbour(start);
 
		end   = RotateNeighbour(end);
 
	}
 

	
 
	/* Create roadbits out of the data for easier handling. */
 
	RoadBits start_roadbits    = NeighbourToRoadBits(start);
 
	RoadBits new_roadbits      = start_roadbits | NeighbourToRoadBits(end);
 
	RoadBits existing_roadbits = ROAD_NONE;
 
	for (int i = 0; i < existing->size; i++) {
 
	for (size_t i = 0; i < existing->size; i++) {
 
		existing_roadbits |= NeighbourToRoadBits(existing->array[i]);
 
	}
 

	
 
	switch (slope) {
 
		case SLOPE_W:
 
			/* A slope similar to a SLOPE_W. */
 
@@ -351,13 +351,13 @@ static bool NormaliseTileOffset(int32 *t
 
	int32 start = start_;
 
	int32 end = end_;
 

	
 
	/* The start tile and end tile cannot be the same tile either. */
 
	if (start == end) return -1;
 

	
 
	for (int i = 0; i < existing->size; i++) {
 
	for (size_t i = 0; i < existing->size; i++) {
 
		if (!NormaliseTileOffset(&existing->array[i])) return -1;
 
	}
 

	
 
	if (!NormaliseTileOffset(&start)) return -1;
 
	if (!NormaliseTileOffset(&end)) return -1;
 

	
src/script/squirrel_helper_type.hpp
Show inline comments
 
@@ -11,11 +11,11 @@
 

	
 
#ifndef SQUIRREL_HELPER_TYPE_HPP
 
#define SQUIRREL_HELPER_TYPE_HPP
 

	
 
/** Definition of a simple array. */
 
struct Array {
 
	int32 size;    ///< The size of the array.
 
	size_t size;   ///< The size of the array.
 
	int32 array[]; ///< The data of the array.
 
};
 

	
 
#endif /* SQUIRREL_HELPER_TYPE_HPP */
src/settings_gui.cpp
Show inline comments
 
@@ -252,13 +252,13 @@ struct GameOptionsWindow : Window {
 
				for (int i = 0; i < _nb_grf_names; i++) {
 
					int result = _nb_orig_names + i;
 
					list->push_back(new DropDownListStringItem(_grf_names[i], result, enabled_item != result && enabled_item >= 0));
 
				}
 
				QSortT(list->data(), list->size(), DropDownListStringItem::NatSortFunc);
 

	
 
				int newgrf_size = list->size();
 
				size_t newgrf_size = list->size();
 
				/* Insert newgrf_names at the top of the list */
 
				if (newgrf_size > 0) {
 
					list->push_back(new DropDownListItem(-1, false)); // separator line
 
					newgrf_size++;
 
				}
 

	
src/signs_gui.cpp
Show inline comments
 
@@ -307,13 +307,13 @@ struct SignListWindow : Window, SignList
 
	}
 

	
 
	void BuildSortSignList()
 
	{
 
		if (this->signs.NeedRebuild()) {
 
			this->BuildSignsList();
 
			this->vscroll->SetCount(this->signs.size());
 
			this->vscroll->SetCount((uint)this->signs.size());
 
			this->SetWidgetDirty(WID_SIL_CAPTION);
 
		}
 
		this->SortSignsList();
 
	}
 

	
 
	void OnHundredthTick() override
 
@@ -468,13 +468,13 @@ struct SignWindow : Window, SignList {
 
		this->BuildSignsList();
 
		this->SortSignsList();
 

	
 
		/* Search through the list for the current sign, excluding
 
		 * - the first sign if we want the previous sign or
 
		 * - the last sign if we want the next sign */
 
		uint end = this->signs.size() - (next ? 1 : 0);
 
		size_t end = this->signs.size() - (next ? 1 : 0);
 
		for (uint i = next ? 0 : 1; i < end; i++) {
 
			if (this->cur_sign == this->signs[i]->index) {
 
				/* We've found the current sign, so return the sign before/after it */
 
				return this->signs[i + (next ? 1 : -1)];
 
			}
 
		}
src/station_gui.cpp
Show inline comments
 
@@ -202,13 +202,13 @@ protected:
 
			}
 
		}
 

	
 
		this->stations.shrink_to_fit();
 
		this->stations.RebuildDone();
 

	
 
		this->vscroll->SetCount(this->stations.size()); // Update the scrollbar
 
		this->vscroll->SetCount((uint)this->stations.size()); // Update the scrollbar
 
	}
 

	
 
	/** Sort stations by their name */
 
	static int CDECL StationNameSorter(const Station * const *a, const Station * const *b)
 
	{
 
		static char buf_cache[64];
 
@@ -408,13 +408,13 @@ public:
 
				/* draw arrow pointing up/down for ascending/descending sorting */
 
				this->DrawSortButtonState(WID_STL_SORTBY, this->stations.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
 
				break;
 

	
 
			case WID_STL_LIST: {
 
				bool rtl = _current_text_dir == TD_RTL;
 
				int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->stations.size());
 
				int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)this->stations.size());
 
				int y = r.top + WD_FRAMERECT_TOP;
 
				for (int i = this->vscroll->GetPosition(); i < max; ++i) { // do until max number of stations of owner
 
					const Station *st = this->stations[i];
 
					assert(st->xy != INVALID_TILE);
 

	
 
					/* Do not do the complex check HasStationInUse here, it may be even false
 
@@ -2328,13 +2328,13 @@ struct SelectStationWindow : Window {
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	void OnInvalidateData(int data = 0, bool gui_scope = true) override
 
	{
 
		if (!gui_scope) return;
 
		FindStationsNearby<T>(this->area, true);
 
		this->vscroll->SetCount(_stations_nearby_list.size() + 1);
 
		this->vscroll->SetCount((uint)_stations_nearby_list.size() + 1);
 
		this->SetDirty();
 
	}
 
};
 

	
 
static WindowDesc _select_station_desc(
 
	WDP_AUTO, "build_station_join", 200, 180,
src/strgen/strgen_base.cpp
Show inline comments
 
@@ -1026,27 +1026,27 @@ void LanguageWriter::WriteLang(const Str
 
				buffer.AppendByte(num);
 

	
 
				/* Write each case */
 
				for (c = casep; c != NULL; c = c->next) {
 
					buffer.AppendByte(c->caseidx);
 
					/* Make some space for the 16-bit length */
 
					uint pos = buffer.size();
 
					uint pos = (uint)buffer.size();
 
					buffer.AppendByte(0);
 
					buffer.AppendByte(0);
 
					/* Write string */
 
					PutCommandString(&buffer, c->string);
 
					buffer.AppendByte(0); // terminate with a zero
 
					/* Fill in the length */
 
					uint size = buffer.size() - (pos + 2);
 
					uint size = (uint)buffer.size() - (pos + 2);
 
					buffer[pos + 0] = GB(size, 8, 8);
 
					buffer[pos + 1] = GB(size, 0, 8);
 
				}
 
			}
 

	
 
			if (cmdp != NULL) PutCommandString(&buffer, cmdp);
 

	
 
			this->WriteLength(buffer.size());
 
			this->WriteLength((uint)buffer.size());
 
			this->Write(buffer.data(), buffer.size());
 
			buffer.clear();
 
		}
 
	}
 
}
src/textfile_gui.cpp
Show inline comments
 
@@ -113,13 +113,13 @@ void TextfileWindow::SetupScrollbars()
 
		this->hscroll->SetCount(0);
 
	} else {
 
		uint max_length = 0;
 
		for (uint i = 0; i < this->lines.size(); i++) {
 
			max_length = max(max_length, GetStringBoundingBox(this->lines[i], FS_MONO).width);
 
		}
 
		this->vscroll->SetCount(this->lines.size() * FONT_HEIGHT_MONO);
 
		this->vscroll->SetCount((uint)this->lines.size() * FONT_HEIGHT_MONO);
 
		this->hscroll->SetCount(max_length + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT);
 
	}
 

	
 
	this->SetWidgetDisabledState(WID_TF_HSCROLLBAR, IsWidgetLowered(WID_TF_WRAPTEXT));
 
}
 

	
src/timetable_cmd.cpp
Show inline comments
 
@@ -289,13 +289,13 @@ CommandCost CmdSetTimetableStart(TileInd
 
			}
 
		} else {
 
			vehs.push_back(v);
 
		}
 

	
 
		int total_duration = v->orders.list->GetTimetableTotalDuration();
 
		int num_vehs = vehs.size();
 
		int num_vehs = (uint)vehs.size();
 

	
 
		if (num_vehs >= 2) {
 
			QSortT(vehs.data(), vehs.size(), &VehicleTimetableSorter);
 
		}
 

	
 
		int idx = vehs.begin() - std::find(vehs.begin(), vehs.end(), v);
src/town_gui.cpp
Show inline comments
 
@@ -656,13 +656,13 @@ private:
 
			FOR_ALL_TOWNS(t) {
 
				this->towns.push_back(t);
 
			}
 

	
 
			this->towns.shrink_to_fit();
 
			this->towns.RebuildDone();
 
			this->vscroll->SetCount(this->towns.size()); // Update scrollbar as well.
 
			this->vscroll->SetCount((uint)this->towns.size()); // Update scrollbar as well.
 
		}
 
		/* Always sort the towns. */
 
		this->last_town = NULL;
 
		this->towns.Sort();
 
		this->SetWidgetDirty(WID_TD_LIST); // Force repaint of the displayed towns.
 
	}
src/vehicle_gui.cpp
Show inline comments
 
@@ -130,13 +130,13 @@ void BaseVehicleListWindow::BuildVehicle
 

	
 
	GenerateVehicleSortList(&this->vehicles, this->vli);
 

	
 
	this->unitnumber_digits = GetUnitNumberDigits(this->vehicles);
 

	
 
	this->vehicles.RebuildDone();
 
	this->vscroll->SetCount(this->vehicles.size());
 
	this->vscroll->SetCount((uint)this->vehicles.size());
 
}
 

	
 
/**
 
 * Compute the size for the Action dropdown.
 
 * @param show_autoreplace If true include the autoreplace item.
 
 * @param show_group If true include group-related stuff.
 
@@ -1383,13 +1383,13 @@ void BaseVehicleListWindow::DrawVehicleL
 
	int image_left  = (rtl && show_orderlist) ? orderlist_right : text_left;
 
	int image_right = (!rtl && show_orderlist) ? orderlist_left : text_right;
 

	
 
	int vehicle_button_x = rtl ? right - GetSpriteSize(SPR_PROFIT_LOT).width : left;
 

	
 
	int y = r.top;
 
	uint max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->vehicles.size());
 
	uint max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)this->vehicles.size());
 
	for (uint i = this->vscroll->GetPosition(); i < max; ++i) {
 
		const Vehicle *v = this->vehicles[i];
 
		StringID str;
 

	
 
		SetDParam(0, v->GetDisplayProfitThisYear());
 
		SetDParam(1, v->GetDisplayProfitLastYear());
src/viewport.cpp
Show inline comments
 
@@ -596,13 +596,13 @@ void OffsetGroundSprite(int x, int y)
 
			_vd.foundation_part = FOUNDATION_PART_HALFTILE;
 
			break;
 
		default: NOT_REACHED();
 
	}
 

	
 
	/* _vd.last_child == NULL if foundation sprite was clipped by the viewport bounds */
 
	if (_vd.last_child != NULL) _vd.foundation[_vd.foundation_part] = _vd.parent_sprites_to_draw.size() - 1;
 
	if (_vd.last_child != NULL) _vd.foundation[_vd.foundation_part] = (uint)_vd.parent_sprites_to_draw.size() - 1;
 

	
 
	_vd.foundation_offset[_vd.foundation_part].x = x * ZOOM_LVL_BASE;
 
	_vd.foundation_offset[_vd.foundation_part].y = y * ZOOM_LVL_BASE;
 
	_vd.last_foundation_child[_vd.foundation_part] = _vd.last_child;
 
}
 

	
 
@@ -823,13 +823,13 @@ void AddChildSpriteScreen(SpriteID image
 
	/* make the sprites transparent with the right palette */
 
	if (transparent) {
 
		SetBit(image, PALETTE_MODIFIER_TRANSPARENT);
 
		pal = PALETTE_TO_TRANSPARENT;
 
	}
 

	
 
	*_vd.last_child = _vd.child_screen_sprites_to_draw.size();
 
	*_vd.last_child = (uint)_vd.child_screen_sprites_to_draw.size();
 

	
 
	/*C++17: ChildScreenSpriteToDraw &cs = */ _vd.child_screen_sprites_to_draw.emplace_back();
 
	ChildScreenSpriteToDraw &cs = _vd.child_screen_sprites_to_draw.back();
 
	cs.image = image;
 
	cs.pal = pal;
 
	cs.sub = sub;
src/widgets/dropdown.cpp
Show inline comments
 
@@ -409,13 +409,13 @@ void ShowDropDownListAt(Window *w, const
 
			available_height = available_height_above;
 
		}
 

	
 
		/* If the dropdown doesn't fully fit, we need a dropdown. */
 
		if (height > available_height) {
 
			scroll = true;
 
			uint avg_height = height / list->size();
 
			uint avg_height = height / (uint)list->size();
 

	
 
			/* Check at least there is space for one item. */
 
			assert(available_height >= avg_height);
 

	
 
			/* Fit the list. */
 
			uint rows = available_height / avg_height;
0 comments (0 inline, 0 general)