Changeset - r28389:d1118c144a7d
[Not reviewed]
master
0 59 0
Rubidium - 11 months ago 2024-01-03 21:33:38
rubidium@openttd.org
Codechange: coding style fixes
59 files changed with 121 insertions and 121 deletions:
0 comments (0 inline, 0 general)
src/company_func.h
Show inline comments
 
@@ -24,14 +24,14 @@ void ShowBuyCompanyDialog(CompanyID comp
 
void CompanyAdminUpdate(const Company *company);
 
void CompanyAdminBankrupt(CompanyID company_id);
 
void UpdateLandscapingLimits();
 
void UpdateCompanyLiveries(Company *c);
 

	
 
bool CheckCompanyHasMoney(CommandCost &cost);
 
void SubtractMoneyFromCompany(const CommandCost& cost);
 
void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost& cost);
 
void SubtractMoneyFromCompany(const CommandCost &cost);
 
void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost &cost);
 
CommandCost CheckOwnership(Owner owner, TileIndex tile = 0U);
 
CommandCost CheckTileOwnership(TileIndex tile);
 

	
 
extern CompanyID _local_company;
 
extern CompanyID _current_company;
 

	
src/core/overflowsafe_type.hpp
Show inline comments
 
@@ -34,13 +34,13 @@ private:
 

	
 
	/** The non-overflow safe backend to store the value in. */
 
	T m_value;
 
public:
 
	constexpr OverflowSafeInt() : m_value(0) { }
 

	
 
	constexpr OverflowSafeInt(const OverflowSafeInt& other) : m_value(other.m_value) { }
 
	constexpr OverflowSafeInt(const OverflowSafeInt &other) : m_value(other.m_value) { }
 
	constexpr OverflowSafeInt(const T int_) : m_value(int_) { }
 

	
 
	inline constexpr OverflowSafeInt& operator = (const OverflowSafeInt& other) { this->m_value = other.m_value; return *this; }
 
	inline constexpr OverflowSafeInt& operator = (T other) { this->m_value = other; return *this; }
 

	
 
	inline constexpr OverflowSafeInt operator - () const { return OverflowSafeInt(this->m_value == T_MIN ? T_MAX : -this->m_value); }
src/core/pool_type.hpp
Show inline comments
 
@@ -139,14 +139,14 @@ struct Pool : PoolBase {
 
	 * Iterator to iterate all valid T of a pool
 
	 * @tparam T Type of the class/struct that is going to be iterated
 
	 */
 
	template <class T>
 
	struct PoolIterator {
 
		typedef T value_type;
 
		typedef T* pointer;
 
		typedef T& reference;
 
		typedef T *pointer;
 
		typedef T &reference;
 
		typedef size_t difference_type;
 
		typedef std::forward_iterator_tag iterator_category;
 

	
 
		explicit PoolIterator(size_t index) : index(index)
 
		{
 
			this->ValidateIndex();
 
@@ -183,14 +183,14 @@ struct Pool : PoolBase {
 
	 * Iterator to iterate all valid T of a pool
 
	 * @tparam T Type of the class/struct that is going to be iterated
 
	 */
 
	template <class T, class F>
 
	struct PoolIteratorFiltered {
 
		typedef T value_type;
 
		typedef T* pointer;
 
		typedef T& reference;
 
		typedef T *pointer;
 
		typedef T &reference;
 
		typedef size_t difference_type;
 
		typedef std::forward_iterator_tag iterator_category;
 

	
 
		explicit PoolIteratorFiltered(size_t index, F filter) : index(index), filter(filter)
 
		{
 
			this->ValidateIndex();
src/core/span_type.hpp
Show inline comments
 
@@ -36,13 +36,13 @@ struct is_compatible_element
 

	
 
/* Template to check if a container is compatible. gsl-lite also includes is_array and is_std_array, but as we don't use them, they are omitted. */
 
template <class C, class E>
 
struct is_compatible_container : std::bool_constant
 
<
 
	has_size_and_data<C>::value
 
	&& is_compatible_element<C,E>::value
 
	&& is_compatible_element<C, E>::value
 
>{};
 

	
 
/**
 
 * A trimmed down version of what std::span will be in C++20.
 
 *
 
 * It is fully forwards compatible, so if this codebase switches to C++20,
src/engine.cpp
Show inline comments
 
@@ -1078,13 +1078,13 @@ static void NewVehicleAvailable(Engine *
 
		/* maybe make another rail type available */
 
		assert(e->u.rail.railtype < RAILTYPE_END);
 
		for (Company *c : Company::Iterate()) c->avail_railtypes = AddDateIntroducedRailTypes(c->avail_railtypes | GetRailTypeInfo(e->u.rail.railtype)->introduces_railtypes, TimerGameCalendar::date);
 
	} else if (e->type == VEH_ROAD) {
 
		/* maybe make another road type available */
 
		assert(e->u.road.roadtype < ROADTYPE_END);
 
		for (Company* c : Company::Iterate()) c->avail_roadtypes = AddDateIntroducedRoadTypes(c->avail_roadtypes | GetRoadTypeInfo(e->u.road.roadtype)->introduces_roadtypes, TimerGameCalendar::date);
 
		for (Company *c : Company::Iterate()) c->avail_roadtypes = AddDateIntroducedRoadTypes(c->avail_roadtypes | GetRoadTypeInfo(e->u.road.roadtype)->introduces_roadtypes, TimerGameCalendar::date);
 
	}
 

	
 
	/* Only broadcast event if AIs are able to build this vehicle type. */
 
	if (!IsVehicleTypeDisabled(e->type, true)) AI::BroadcastNewEvent(new ScriptEventEngineAvailable(index));
 

	
 
	/* Only provide the "New Vehicle available" news paper entry, if engine can be built. */
src/fontcache.cpp
Show inline comments
 
@@ -95,13 +95,13 @@ bool GetFontAAState(FontSize size, bool 
 
	/* AA is only supported for 32 bpp */
 
	if (check_blitter && BlitterFactory::GetCurrentBlitter()->GetScreenDepth() != 32) return false;
 

	
 
	return GetFontCacheSubSetting(size)->aa;
 
}
 

	
 
void SetFont(FontSize fontsize, const std::string& font, uint size, bool aa)
 
void SetFont(FontSize fontsize, const std::string &font, uint size, bool aa)
 
{
 
	FontCacheSubSetting *setting = GetFontCacheSubSetting(fontsize);
 
	bool changed = false;
 

	
 
	if (setting->font != font) {
 
		setting->font = font;
src/group_gui.cpp
Show inline comments
 
@@ -898,13 +898,13 @@ public:
 
						}
 
						break;
 
					}
 

	
 
					case GB_SHARED_ORDERS: {
 
						if (!VehicleClicked(vehgroup)) {
 
							const Vehicle* v = vehgroup.vehicles_begin[0];
 
							const Vehicle *v = vehgroup.vehicles_begin[0];
 
							if (vindex == v->index) {
 
								if (vehgroup.NumVehicles() == 1) {
 
									ShowVehicleViewWindow(v);
 
								} else {
 
									ShowVehicleListWindow(v);
 
								}
src/industry_cmd.cpp
Show inline comments
 
@@ -1660,13 +1660,13 @@ static CommandCost CheckIfFarEnoughFromC
 
{
 
	const IndustrySpec *indspec = GetIndustrySpec(type);
 

	
 
	/* On a large map with many industries, it may be faster to check an area. */
 
	static const int dmax = 14;
 
	if (Industry::GetNumItems() > (size_t) (dmax * dmax * 2)) {
 
		const Industry* i = nullptr;
 
		const Industry *i = nullptr;
 
		TileArea tile_area = TileArea(tile, 1, 1).Expand(dmax);
 
		for (TileIndex atile : tile_area) {
 
			if (GetTileType(atile) == MP_INDUSTRY) {
 
				const Industry *i2 = Industry::GetByTile(atile);
 
				if (i == i2) continue;
 
				i = i2;
src/misc/array.hpp
Show inline comments
 
@@ -25,13 +25,13 @@ protected:
 

	
 
	static const uint Tcapacity = B * N; ///< total max number of items
 

	
 
	SuperArray data; ///< array of arrays of items
 

	
 
	/** return first sub-array with free space for new item */
 
	inline SubArray& FirstFreeSubArray()
 
	inline SubArray &FirstFreeSubArray()
 
	{
 
		uint super_size = data.Length();
 
		if (super_size > 0) {
 
			SubArray &s = data[super_size - 1];
 
			if (!s.IsFull()) return s;
 
		}
src/misc/dbg_helpers.h
Show inline comments
 
@@ -121,13 +121,13 @@ struct DumpTarget {
 
	KNOWN_NAMES m_known_names;            ///< map of known object instances and their structured names
 

	
 
	DumpTarget()
 
		: m_indent(0)
 
	{}
 

	
 
	static size_t& LastTypeId();
 
	static size_t &LastTypeId();
 
	std::string GetCurrentStructName();
 
	bool FindKnownName(size_t type_id, const void *ptr, std::string &name);
 

	
 
	void WriteIndent();
 

	
 
	void WriteValue(const std::string &name, int value);
src/misc/fixedsizearray.hpp
Show inline comments
 
@@ -36,31 +36,31 @@ protected:
 
	 * the only member of fixed size array is pointer to the block
 
	 *  of C array of items. Header can be found on the offset -sizeof(ArrayHeader).
 
	 */
 
	T *data;
 

	
 
	/** return reference to the array header (non-const) */
 
	inline ArrayHeader& Hdr()
 
	inline ArrayHeader &Hdr()
 
	{
 
		return *(ArrayHeader*)(((byte*)data) - HeaderSize);
 
	}
 

	
 
	/** return reference to the array header (const) */
 
	inline const ArrayHeader& Hdr() const
 
	inline const ArrayHeader &Hdr() const
 
	{
 
		return *(ArrayHeader*)(((byte*)data) - HeaderSize);
 
	}
 

	
 
	/** return reference to the block reference counter */
 
	inline uint& RefCnt()
 
	inline uint &RefCnt()
 
	{
 
		return Hdr().reference_count;
 
	}
 

	
 
	/** return reference to number of used items */
 
	inline uint& SizeRef()
 
	inline uint &SizeRef()
 
	{
 
		return Hdr().items;
 
	}
 

	
 
public:
 
	/** Default constructor. Preallocate space for items and header, then initialize header. */
src/misc/hashtable.hpp
Show inline comments
 
@@ -213,13 +213,13 @@ public:
 
			m_num_items--;
 
		}
 
		return item;
 
	}
 

	
 
	/** non-const item search & removal */
 
	Titem_& Pop(const Tkey &key)
 
	Titem_ &Pop(const Tkey &key)
 
	{
 
		Titem_ *item = TryPop(key);
 
		assert(item != nullptr);
 
		return *item;
 
	}
 

	
src/music/dmusic.cpp
Show inline comments
 
@@ -34,15 +34,15 @@
 
#endif /* defined(_MSC_VER) */
 

	
 
static const int MS_TO_REFTIME = 1000 * 10; ///< DirectMusic time base is 100 ns.
 
static const int MIDITIME_TO_REFTIME = 10;  ///< Time base of the midi file reader is 1 us.
 

	
 

	
 
#define FOURCC_INFO  mmioFOURCC('I','N','F','O')
 
#define FOURCC_fmt   mmioFOURCC('f','m','t',' ')
 
#define FOURCC_data  mmioFOURCC('d','a','t','a')
 
#define FOURCC_INFO  mmioFOURCC('I', 'N', 'F', 'O')
 
#define FOURCC_fmt   mmioFOURCC('f', 'm', 't', ' ')
 
#define FOURCC_data  mmioFOURCC('d', 'a', 't', 'a')
 

	
 
/** A DLS file. */
 
struct DLSFile {
 
	/** An instrument region maps a note range to wave data. */
 
	struct DLSRegion {
 
		RGNHEADER hdr;
src/music/midifile.cpp
Show inline comments
 
@@ -374,13 +374,13 @@ static bool FixupMidiData(MidiFile &targ
 
	last_ticktime = 0;
 
	uint32_t last_realtime = 0;
 
	size_t cur_tempo = 0, cur_block = 0;
 
	while (cur_block < target.blocks.size()) {
 
		MidiFile::DataBlock &block = target.blocks[cur_block];
 
		MidiFile::TempoChange &tempo = target.tempos[cur_tempo];
 
		MidiFile::TempoChange &next_tempo = target.tempos[cur_tempo+1];
 
		MidiFile::TempoChange &next_tempo = target.tempos[cur_tempo + 1];
 
		if (block.ticktime <= next_tempo.ticktime) {
 
			/* block is within the current tempo */
 
			int64_t tickdiff = block.ticktime - last_ticktime;
 
			last_ticktime = block.ticktime;
 
			last_realtime += uint32_t(tickdiff * tempo.tempo / target.tickdiv);
 
			block.realtime = last_realtime;
 
@@ -789,18 +789,18 @@ struct MpsMachine {
 
		this->shouldplayflag = true;
 
		this->current_tempo = (int32_t)this->initial_tempo * 24 / 60;
 
		this->tempo_ticks = this->current_tempo;
 

	
 
		/* Always reset percussion channel to program 0 */
 
		this->target.blocks.push_back(MidiFile::DataBlock());
 
		AddMidiData(this->target.blocks.back(), MIDIST_PROGCHG+9, 0x00);
 
		AddMidiData(this->target.blocks.back(), MIDIST_PROGCHG + 9, 0x00);
 

	
 
		/* Technically should be an endless loop, but having
 
		 * a maximum (about 10 minutes) avoids getting stuck,
 
		 * in case of corrupted data. */
 
		for (uint32_t tick = 0; tick < 100000; tick+=1) {
 
		for (uint32_t tick = 0; tick < 100000; tick += 1) {
 
			this->target.blocks.push_back(MidiFile::DataBlock());
 
			auto &block = this->target.blocks.back();
 
			block.ticktime = tick;
 
			if (!this->PlayFrame(block)) {
 
				break;
 
			}
src/network/core/host.cpp
Show inline comments
 
@@ -49,13 +49,13 @@ static void NetworkFindBroadcastIPsInter
 
		sockaddr_storage address;
 
		memset(&address, 0, sizeof(address));
 
		/* iiBroadcast is unusable, because it always seems to be set to 255.255.255.255. */
 
		memcpy(&address, &ifo[j].iiAddress.Address, sizeof(sockaddr));
 
		((sockaddr_in*)&address)->sin_addr.s_addr = ifo[j].iiAddress.AddressIn.sin_addr.s_addr | ~ifo[j].iiNetmask.AddressIn.sin_addr.s_addr;
 
		NetworkAddress addr(address, sizeof(sockaddr));
 
		if (std::none_of(broadcast->begin(), broadcast->end(), [&addr](NetworkAddress const& elem) -> bool { return elem == addr; })) broadcast->push_back(addr);
 
		if (std::none_of(broadcast->begin(), broadcast->end(), [&addr](NetworkAddress const &elem) -> bool { return elem == addr; })) broadcast->push_back(addr);
 
	}
 

	
 
	free(ifo);
 
	closesocket(sock);
 
}
 

	
 
@@ -69,13 +69,13 @@ static void NetworkFindBroadcastIPsInter
 
	for (ifa = ifap; ifa != nullptr; ifa = ifa->ifa_next) {
 
		if (!(ifa->ifa_flags & IFF_BROADCAST)) continue;
 
		if (ifa->ifa_broadaddr == nullptr) continue;
 
		if (ifa->ifa_broadaddr->sa_family != AF_INET) continue;
 

	
 
		NetworkAddress addr(ifa->ifa_broadaddr, sizeof(sockaddr));
 
		if (std::none_of(broadcast->begin(), broadcast->end(), [&addr](NetworkAddress const& elem) -> bool { return elem == addr; })) broadcast->push_back(addr);
 
		if (std::none_of(broadcast->begin(), broadcast->end(), [&addr](NetworkAddress const &elem) -> bool { return elem == addr; })) broadcast->push_back(addr);
 
	}
 
	freeifaddrs(ifap);
 
}
 
#endif /* all NetworkFindBroadcastIPsInternals */
 

	
 
/**
src/network/network_command.cpp
Show inline comments
 
@@ -534,11 +534,11 @@ CommandDataBuffer SanitizeCmdStrings(con
 
 * Unpack a generic command packet into its actual typed components.
 
 * @tparam Tcmd Command type to be unpacked.
 
 * @tparam Tcb Index into the callback list.
 
 * @param cp Command packet to unpack.
 
 */
 
template <Commands Tcmd, size_t Tcb>
 
void UnpackNetworkCommand(const CommandPacket* cp)
 
void UnpackNetworkCommand(const CommandPacket *cp)
 
{
 
	auto args = EndianBufferReader::ToValue<typename CommandTraits<Tcmd>::Args>(cp->data);
 
	Command<Tcmd>::PostFromNet(cp->err_msg, std::get<Tcb>(_callback_tuple), cp->my_cmd, args);
 
}
src/network/network_gui.cpp
Show inline comments
 
@@ -1094,13 +1094,13 @@ struct NetworkStartServerWindow : public
 
				ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD);
 
				break;
 

	
 
			case WID_NSS_PLAY_HEIGHTMAP:
 
				if (!CheckServerName()) return;
 
				_is_network_server = true;
 
				ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD);
 
				ShowSaveLoadDialog(FT_HEIGHTMAP, SLO_LOAD);
 
				break;
 
		}
 
	}
 

	
 
	void OnDropdownSelect(WidgetID widget, int index) override
 
	{
src/newgrf_debug_gui.cpp
Show inline comments
 
@@ -400,13 +400,13 @@ struct NewGRFInspectWindow : Window {
 
	}
 

	
 
	/**
 
	 * Helper function to draw the vehicle chain widget.
 
	 * @param r The rectangle to draw within.
 
	 */
 
	void DrawVehicleChainWidget(const Rect& r) const
 
	void DrawVehicleChainWidget(const Rect &r) const
 
	{
 
		const Vehicle *v = Vehicle::Get(this->GetFeatureIndex());
 
		int total_width = 0;
 
		int sel_start = 0;
 
		int sel_end = 0;
 
		for (const Vehicle *u = v->First(); u != nullptr; u = u->Next()) {
 
@@ -441,13 +441,13 @@ struct NewGRFInspectWindow : Window {
 
	}
 

	
 
	/**
 
	 * Helper function to draw the main panel widget.
 
	 * @param r The rectangle to draw within.
 
	 */
 
	void DrawMainPanelWidget(const Rect& r) const
 
	void DrawMainPanelWidget(const Rect &r) const
 
	{
 
		uint index = this->GetFeatureIndex();
 
		const NIFeature *nif  = GetFeature(this->window_number);
 
		const NIHelper *nih   = nif->helper;
 
		const void *base      = nih->GetInstance(index);
 
		const void *base_spec = nih->GetSpec(index);
 
@@ -916,13 +916,13 @@ struct SpriteAlignerWindow : Window {
 
				if (!FillDrawPixelInfo(&new_dpi, ir)) break;
 
				AutoRestoreBackup dpi_backup(_cur_dpi, &new_dpi);
 

	
 
				DrawSprite(this->current_sprite, PAL_NONE, x, y, nullptr, SpriteAlignerWindow::zoom);
 

	
 
				Rect outline = {0, 0, UnScaleByZoom(spr->width, SpriteAlignerWindow::zoom) - 1, UnScaleByZoom(spr->height, SpriteAlignerWindow::zoom) - 1};
 
				outline = outline.Translate(x + UnScaleByZoom(spr->x_offs, SpriteAlignerWindow::zoom),y + UnScaleByZoom(spr->y_offs, SpriteAlignerWindow::zoom));
 
				outline = outline.Translate(x + UnScaleByZoom(spr->x_offs, SpriteAlignerWindow::zoom), y + UnScaleByZoom(spr->y_offs, SpriteAlignerWindow::zoom));
 
				DrawRectOutline(outline.Expand(1), PC_LIGHT_BLUE, 1, 1);
 

	
 
				if (SpriteAlignerWindow::crosshair) {
 
					GfxDrawLine(x, 0, x, ir.Height() - 1, PC_WHITE, 1, 1);
 
					GfxDrawLine(0, y, ir.Width() - 1, y, PC_WHITE, 1, 1);
 
				}
src/newgrf_roadstop.cpp
Show inline comments
 
@@ -224,13 +224,13 @@ RoadStopResolverObject::RoadStopResolver
 

	
 
RoadStopResolverObject::~RoadStopResolverObject()
 
{
 
	delete this->town_scope;
 
}
 

	
 
TownScopeResolver* RoadStopResolverObject::GetTown()
 
TownScopeResolver *RoadStopResolverObject::GetTown()
 
{
 
	if (this->town_scope == nullptr) {
 
		Town *t;
 
		if (this->roadstop_scope.st != nullptr) {
 
			t = this->roadstop_scope.st->town;
 
		} else {
src/newgrf_roadstop.h
Show inline comments
 
@@ -78,13 +78,13 @@ struct RoadStopScopeResolver : public Sc
 
	const struct RoadStopSpec *roadstopspec;    ///< Station (type) specification.
 
	CargoID cargo_type;                         ///< Type of cargo of the station.
 
	StationType type;                           ///< Station type.
 
	uint8_t view;                                 ///< Station axis.
 
	RoadType roadtype;                          ///< Road type (used when no tile)
 

	
 
	RoadStopScopeResolver(ResolverObject& ro, BaseStation* st, const RoadStopSpec *roadstopspec, TileIndex tile, RoadType roadtype, StationType type, uint8_t view = 0)
 
	RoadStopScopeResolver(ResolverObject &ro, BaseStation *st, const RoadStopSpec *roadstopspec, TileIndex tile, RoadType roadtype, StationType type, uint8_t view = 0)
 
		: ScopeResolver(ro), tile(tile), st(st), roadstopspec(roadstopspec), type(type), view(view), roadtype(roadtype)
 
	{
 
	}
 

	
 
	uint32_t GetRandomBits() const override;
 
	uint32_t GetTriggers() const override;
 
@@ -94,16 +94,16 @@ struct RoadStopScopeResolver : public Sc
 

	
 
/** Road stop resolver. */
 
struct RoadStopResolverObject : public ResolverObject {
 
	RoadStopScopeResolver roadstop_scope; ///< The stop scope resolver.
 
	TownScopeResolver *town_scope;        ///< The town scope resolver (created on the first call).
 

	
 
	RoadStopResolverObject(const RoadStopSpec* roadstopspec, BaseStation* st, TileIndex tile, RoadType roadtype, StationType type, uint8_t view, CallbackID callback = CBID_NO_CALLBACK, uint32_t param1 = 0, uint32_t param2 = 0);
 
	RoadStopResolverObject(const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, RoadType roadtype, StationType type, uint8_t view, CallbackID callback = CBID_NO_CALLBACK, uint32_t param1 = 0, uint32_t param2 = 0);
 
	~RoadStopResolverObject();
 

	
 
	ScopeResolver* GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) override
 
	{
 
		switch (scope) {
 
			case VSG_SCOPE_SELF: return &this->roadstop_scope;
 
			case VSG_SCOPE_PARENT: {
 
				TownScopeResolver *tsr = this->GetTown();
 
				if (tsr != nullptr) return tsr;
src/newgrf_spritegroup.cpp
Show inline comments
 
@@ -177,13 +177,13 @@ static U EvalAdjustT(const Deterministic
 
		case DSGA_OP_SAR:  return (int32_t)(S)last_value >> ((U)value & 0x1F);
 
		default:           return value;
 
	}
 
}
 

	
 

	
 
static bool RangeHighComparator(const DeterministicSpriteGroupRange& range, uint32_t value)
 
static bool RangeHighComparator(const DeterministicSpriteGroupRange &range, uint32_t value)
 
{
 
	return range.high < value;
 
}
 

	
 
const SpriteGroup *DeterministicSpriteGroup::Resolve(ResolverObject &object) const
 
{
src/newgrf_townname.cpp
Show inline comments
 
@@ -85,13 +85,13 @@ void InitGRFTownGeneratorNames()
 
		for (const auto &style : t.styles) {
 
			_grf_townname_names.push_back(style.name);
 
		}
 
	}
 
}
 

	
 
const std::vector<StringID>& GetGRFTownNameList()
 
const std::vector<StringID> &GetGRFTownNameList()
 
{
 
	return _grf_townname_names;
 
}
 

	
 
StringID GetGRFTownNameName(uint16_t gen)
 
{
src/newgrf_townname.h
Show inline comments
 
@@ -48,9 +48,9 @@ GRFTownName *GetGRFTownName(uint32_t grf
 
void DelGRFTownName(uint32_t grfid);
 
void CleanUpGRFTownNames();
 
uint32_t GetGRFTownNameId(uint16_t gen);
 
uint16_t GetGRFTownNameType(uint16_t gen);
 
StringID GetGRFTownNameName(uint16_t gen);
 

	
 
const std::vector<StringID>& GetGRFTownNameList();
 
const std::vector<StringID> &GetGRFTownNameList();
 

	
 
#endif /* NEWGRF_TOWNNAME_H */
src/news_gui.cpp
Show inline comments
 
@@ -207,21 +207,21 @@ static WindowDesc _small_news_desc(__FIL
 
	std::begin(_nested_small_news_widgets), std::end(_nested_small_news_widgets)
 
);
 

	
 
/**
 
 * Window layouts for news items.
 
 */
 
static WindowDesc* _news_window_layout[] = {
 
static WindowDesc *_news_window_layout[] = {
 
	&_thin_news_desc,    ///< NF_THIN
 
	&_small_news_desc,   ///< NF_SMALL
 
	&_normal_news_desc,  ///< NF_NORMAL
 
	&_vehicle_news_desc, ///< NF_VEHICLE
 
	&_company_news_desc, ///< NF_COMPANY
 
};
 

	
 
WindowDesc* GetNewsWindowLayout(NewsFlag flags)
 
WindowDesc *GetNewsWindowLayout(NewsFlag flags)
 
{
 
	uint layout = GB(flags, NFB_WINDOW_LAYOUT, NFB_WINDOW_LAYOUT_COUNT);
 
	assert(layout < lengthof(_news_window_layout));
 
	return _news_window_layout[layout];
 
}
 

	
src/os/macosx/crashlog_osx.cpp
Show inline comments
 
@@ -67,13 +67,13 @@ class CrashLogOSX : public CrashLog {
 
			survey.push_back(messages[i]);
 
		}
 
		free(messages);
 
	}
 

	
 
#ifdef WITH_UNOFFICIAL_BREAKPAD
 
	static bool MinidumpCallback(const char* dump_dir, const char* minidump_id, void* context, bool succeeded)
 
	static bool MinidumpCallback(const char *dump_dir, const char *minidump_id, void *context, bool succeeded)
 
	{
 
		CrashLogOSX *crashlog = reinterpret_cast<CrashLogOSX *>(context);
 

	
 
		crashlog->crashdump_filename = crashlog->CreateFileName(".dmp");
 
		std::rename(fmt::format("{}/{}.dmp", dump_dir, minidump_id).c_str(), crashlog->crashdump_filename.c_str());
 
		return succeeded;
src/os/macosx/string_osx.cpp
Show inline comments
 
@@ -21,16 +21,16 @@
 

	
 
/* CTRunDelegateCreate is supported since MacOS X 10.5, but was only included in the SDKs starting with the 10.9 SDK. */
 
#ifndef HAVE_OSX_109_SDK
 
extern "C" {
 
	typedef const struct __CTRunDelegate * CTRunDelegateRef;
 

	
 
	typedef void (*CTRunDelegateDeallocateCallback) (void* refCon);
 
	typedef CGFloat (*CTRunDelegateGetAscentCallback) (void* refCon);
 
	typedef CGFloat (*CTRunDelegateGetDescentCallback) (void* refCon);
 
	typedef CGFloat (*CTRunDelegateGetWidthCallback) (void* refCon);
 
	typedef void (*CTRunDelegateDeallocateCallback) (void *refCon);
 
	typedef CGFloat (*CTRunDelegateGetAscentCallback) (void *refCon);
 
	typedef CGFloat (*CTRunDelegateGetDescentCallback) (void *refCon);
 
	typedef CGFloat (*CTRunDelegateGetWidthCallback) (void *refCon);
 
	typedef struct {
 
		CFIndex                         version;
 
		CTRunDelegateDeallocateCallback dealloc;
 
		CTRunDelegateGetAscentCallback  getAscent;
 
		CTRunDelegateGetDescentCallback getDescent;
 
		CTRunDelegateGetWidthCallback   getWidth;
 
@@ -40,13 +40,13 @@ extern "C" {
 
		kCTRunDelegateVersion1 = 1,
 
		kCTRunDelegateCurrentVersion = kCTRunDelegateVersion1
 
	};
 

	
 
	extern const CFStringRef kCTRunDelegateAttributeName AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
 

	
 
	CTRunDelegateRef CTRunDelegateCreate(const CTRunDelegateCallbacks* callbacks, void* refCon) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
 
	CTRunDelegateRef CTRunDelegateCreate(const CTRunDelegateCallbacks *callbacks, void *refCon) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
 
}
 
#endif /* HAVE_OSX_109_SDK */
 

	
 
/** Cached current locale. */
 
static CFAutoRelease<CFLocaleRef> _osx_locale;
 
/** CoreText cache for font information, cleared when OTTD changes fonts. */
 
@@ -57,13 +57,13 @@ static CFAutoRelease<CTFontRef> _font_ca
 
 * Wrapper for doing layouts with CoreText.
 
 */
 
class CoreTextParagraphLayout : public ParagraphLayouter {
 
private:
 
	const CoreTextParagraphLayoutFactory::CharType *text_buffer;
 
	ptrdiff_t length;
 
	const FontMap& font_map;
 
	const FontMap &font_map;
 

	
 
	CFAutoRelease<CTTypesetterRef> typesetter;
 

	
 
	CFIndex cur_offset = 0; ///< Offset from the start of the current run from where to output.
 

	
 
public:
src/os/unix/crashlog_unix.cpp
Show inline comments
 
@@ -67,13 +67,13 @@ class CrashLogUnix : public CrashLog {
 
		}
 
		free(messages);
 
#endif
 
	}
 

	
 
#ifdef WITH_UNOFFICIAL_BREAKPAD
 
	static bool MinidumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded)
 
	static bool MinidumpCallback(const google_breakpad::MinidumpDescriptor &descriptor, void *context, bool succeeded)
 
	{
 
		CrashLogUnix *crashlog = reinterpret_cast<CrashLogUnix *>(context);
 

	
 
		crashlog->crashdump_filename = crashlog->CreateFileName(".dmp");
 
		std::rename(descriptor.path(), crashlog->crashdump_filename.c_str());
 
		return succeeded;
src/pathfinder/yapf/nodelist.hpp
Show inline comments
 
@@ -113,13 +113,13 @@ public:
 
	{
 
		Titem_ *item = m_open.Find(key);
 
		return item;
 
	}
 

	
 
	/** remove and return the open node specified by a key */
 
	inline Titem_& PopOpenNode(const Key &key)
 
	inline Titem_ &PopOpenNode(const Key &key)
 
	{
 
		Titem_ &item = m_open.Pop(key);
 
		uint idxPop = m_open_queue.FindIndex(item);
 
		m_open_queue.Remove(idxPop);
 
		return item;
 
	}
 
@@ -142,13 +142,13 @@ public:
 
	inline int TotalCount()
 
	{
 
		return m_arr.Length();
 
	}
 

	
 
	/** Get a particular item. */
 
	inline Titem_& ItemAt(int idx)
 
	inline Titem_ &ItemAt(int idx)
 
	{
 
		return m_arr[idx];
 
	}
 

	
 
	/** Helper for creating output of this array. */
 
	template <class D> void Dump(D &dmp) const
src/pathfinder/yapf/yapf_base.hpp
Show inline comments
 
@@ -84,20 +84,20 @@ public:
 

	
 
	/** default destructor */
 
	~CYapfBaseT() {}
 

	
 
protected:
 
	/** to access inherited path finder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	/** return current settings (can be custom - company based - but later) */
 
	inline const YAPFSettings& PfGetSettings() const
 
	inline const YAPFSettings &PfGetSettings() const
 
	{
 
		return *m_settings;
 
	}
 

	
 
	/**
 
	 * Main pathfinder routine:
 
@@ -164,13 +164,13 @@ public:
 
	}
 

	
 
	/**
 
	 * Calls NodeList::CreateNewNode() - allocates new node that can be filled and used
 
	 *  as argument for AddStartupNode() or AddNewNode()
 
	 */
 
	inline Node& CreateNewNode()
 
	inline Node &CreateNewNode()
 
	{
 
		Node &node = *m_nodes.CreateNewNode();
 
		return node;
 
	}
 

	
 
	/** Add new node (created by CreateNewNode and filled with data) into open list */
src/pathfinder/yapf/yapf_common.hpp
Show inline comments
 
@@ -21,13 +21,13 @@ public:
 

	
 
protected:
 
	TileIndex    m_orgTile;                       ///< origin tile
 
	TrackdirBits m_orgTrackdirs;                  ///< origin trackdir mask
 

	
 
	/** to access inherited path finder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	/** Set origin tile / trackdir mask */
 
@@ -65,13 +65,13 @@ protected:
 
	TileIndex   m_revTile;                        ///< second (reversed) origin tile
 
	Trackdir    m_revTd;                          ///< second (reversed) origin trackdir
 
	int         m_reverse_penalty;                ///< penalty to be added for using the reversed origin
 
	bool        m_treat_first_red_two_way_signal_as_eol; ///< in some cases (leaving station) we need to handle first two-way signal differently
 

	
 
	/** to access inherited path finder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	/** set origin (tiles, trackdirs, etc.) */
 
@@ -128,13 +128,13 @@ public:
 
		m_destTile = tile;
 
		m_destTrackdirs = trackdirs;
 
	}
 

	
 
protected:
 
	/** to access inherited path finder */
 
	Tpf& Yapf()
 
	Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	/** Called by YAPF to detect if node ends in the desired destination */
src/pathfinder/yapf/yapf_costcache.hpp
Show inline comments
 
@@ -60,13 +60,13 @@ public:
 
	typedef SmallArray<CachedData> LocalCache;
 

	
 
protected:
 
	LocalCache      m_local_cache;
 

	
 
	/** to access inherited path finder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	/**
 
@@ -135,13 +135,13 @@ struct CSegmentCostCacheT : public CSegm
 
	inline void Flush()
 
	{
 
		m_map.Clear();
 
		m_heap.Clear();
 
	}
 

	
 
	inline Tsegment& Get(Key &key, bool *found)
 
	inline Tsegment &Get(Key &key, bool *found)
 
	{
 
		Tsegment *item = m_map.Find(key);
 
		if (item == nullptr) {
 
			*found = false;
 
			item = new (m_heap.Append()) Tsegment(key);
 
			m_map.Push(*item);
 
@@ -171,18 +171,18 @@ public:
 
protected:
 
	Cache &m_global_cache;
 

	
 
	inline CYapfSegmentCostCacheGlobalT() : m_global_cache(stGetGlobalCache()) {};
 

	
 
	/** to access inherited path finder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
	inline static Cache& stGetGlobalCache()
 
	inline static Cache &stGetGlobalCache()
 
	{
 
		static int last_rail_change_counter = 0;
 
		static Cache C;
 

	
 
		/* delete the cache sometimes... */
 
		if (last_rail_change_counter != Cache::s_rail_change_counter) {
src/pathfinder/yapf/yapf_costrail.hpp
Show inline comments
 
@@ -74,13 +74,13 @@ protected:
 
		for (uint i = 0; i < Yapf().PfGetSettings().rail_look_ahead_max_signals; i++) {
 
			m_sig_look_ahead_costs.push_back(p0 + i * (p1 + i * p2));
 
		}
 
	}
 

	
 
	/** to access inherited path finder */
 
	Tpf& Yapf()
 
	Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	inline int SlopeCost(TileIndex tile, Trackdir td)
src/pathfinder/yapf/yapf_destrail.hpp
Show inline comments
 
@@ -37,13 +37,13 @@ class CYapfDestinationAnyDepotRailT : pu
 
public:
 
	typedef typename Types::Tpf Tpf;              ///< the pathfinder class (derived from THIS class)
 
	typedef typename Types::NodeList::Titem Node; ///< this will be our node type
 
	typedef typename Node::Key Key;               ///< key to hash tables
 

	
 
	/** to access inherited path finder */
 
	Tpf& Yapf()
 
	Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
	/** Called by YAPF to detect if node ends in the desired destination */
 
	inline bool PfDetectDestination(Node &n)
 
@@ -75,13 +75,13 @@ public:
 
	typedef typename Types::Tpf Tpf;              ///< the pathfinder class (derived from THIS class)
 
	typedef typename Types::NodeList::Titem Node; ///< this will be our node type
 
	typedef typename Node::Key Key;               ///< key to hash tables
 
	typedef typename Types::TrackFollower TrackFollower; ///< TrackFollower. Need to typedef for gcc 2.95
 

	
 
	/** to access inherited path finder */
 
	Tpf& Yapf()
 
	Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
	/** Called by YAPF to detect if node ends in the desired destination */
 
	inline bool PfDetectDestination(Node &n)
 
@@ -118,13 +118,13 @@ protected:
 
	TileIndex    m_destTile;
 
	TrackdirBits m_destTrackdirs;
 
	StationID    m_dest_station_id;
 
	bool         m_any_depot;
 

	
 
	/** to access inherited path finder */
 
	Tpf& Yapf()
 
	Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	void SetDestination(const Train *v)
src/pathfinder/yapf/yapf_node.hpp
Show inline comments
 
@@ -94,13 +94,13 @@ struct CYapfNodeT {
 

	
 
	inline Trackdir GetTrackdir() const
 
	{
 
		return m_key.m_td;
 
	}
 

	
 
	inline const Tkey_& GetKey() const
 
	inline const Tkey_ &GetKey() const
 
	{
 
		return m_key;
 
	}
 

	
 
	inline int GetCost() const
 
	{
src/pathfinder/yapf/yapf_node_rail.hpp
Show inline comments
 
@@ -79,13 +79,13 @@ struct CYapfRailSegment
 
		, m_last_signal_tile(INVALID_TILE)
 
		, m_last_signal_td(INVALID_TRACKDIR)
 
		, m_end_segment_reason(ESRB_NONE)
 
		, m_hash_next(nullptr)
 
	{}
 

	
 
	inline const Key& GetKey() const
 
	inline const Key &GetKey() const
 
	{
 
		return m_key;
 
	}
 

	
 
	inline TileIndex GetTile() const
 
	{
src/pathfinder/yapf/yapf_rail.cpp
Show inline comments
 
@@ -41,13 +41,13 @@ public:
 
	typedef typename Types::Tpf Tpf;                     ///< the pathfinder class (derived from THIS class)
 
	typedef typename Types::TrackFollower TrackFollower;
 
	typedef typename Types::NodeList::Titem Node;        ///< this will be our node type
 

	
 
protected:
 
	/** to access inherited pathfinder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
private:
 
	TileIndex m_res_dest;         ///< The reservation target tile
 
@@ -193,13 +193,13 @@ public:
 
	typedef typename Types::TrackFollower TrackFollower;
 
	typedef typename Types::NodeList::Titem Node;        ///< this will be our node type
 
	typedef typename Node::Key Key;                      ///< key to hash tables
 

	
 
protected:
 
	/** to access inherited path finder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	/**
 
@@ -284,13 +284,13 @@ public:
 
	typedef typename Types::TrackFollower TrackFollower;
 
	typedef typename Types::NodeList::Titem Node;        ///< this will be our node type
 
	typedef typename Node::Key Key;                      ///< key to hash tables
 

	
 
protected:
 
	/** to access inherited path finder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	/**
 
@@ -367,13 +367,13 @@ public:
 
	typedef typename Types::TrackFollower TrackFollower;
 
	typedef typename Types::NodeList::Titem Node;        ///< this will be our node type
 
	typedef typename Node::Key Key;                      ///< key to hash tables
 

	
 
protected:
 
	/** to access inherited path finder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	/**
src/pathfinder/yapf/yapf_road.cpp
Show inline comments
 
@@ -27,13 +27,13 @@ public:
 
protected:
 
	int m_max_cost;
 

	
 
	CYapfCostRoadT() : m_max_cost(0) {};
 

	
 
	/** to access inherited path finder */
 
	Tpf& Yapf()
 
	Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
	int SlopeCost(TileIndex tile, TileIndex next_tile, Trackdir)
 
	{
 
@@ -188,13 +188,13 @@ public:
 
	typedef typename Types::Tpf Tpf;                     ///< the pathfinder class (derived from THIS class)
 
	typedef typename Types::TrackFollower TrackFollower;
 
	typedef typename Types::NodeList::Titem Node;        ///< this will be our node type
 
	typedef typename Node::Key Key;                      ///< key to hash tables
 

	
 
	/** to access inherited path finder */
 
	Tpf& Yapf()
 
	Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
	/** Called by YAPF to detect if node ends in the desired destination */
 
	inline bool PfDetectDestination(Node &n)
 
@@ -255,13 +255,13 @@ public:
 
	{
 
		return m_dest_station != INVALID_STATION ? Station::GetIfValid(m_dest_station) : nullptr;
 
	}
 

	
 
protected:
 
	/** to access inherited path finder */
 
	Tpf& Yapf()
 
	Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	/** Called by YAPF to detect if node ends in the desired destination */
 
@@ -322,13 +322,13 @@ public:
 
	typedef typename Types::TrackFollower TrackFollower;
 
	typedef typename Types::NodeList::Titem Node;        ///< this will be our node type
 
	typedef typename Node::Key Key;                      ///< key to hash tables
 

	
 
protected:
 
	/** to access inherited path finder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 

	
src/pathfinder/yapf/yapf_ship.cpp
Show inline comments
 
@@ -44,20 +44,20 @@ public:
 
			m_destTrackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(v->dest_tile, TRANSPORT_WATER, 0));
 
		}
 
	}
 

	
 
protected:
 
	/** to access inherited path finder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf*>(this);
 
	}
 

	
 
public:
 
	/** Called by YAPF to detect if node ends in the desired destination */
 
	inline bool PfDetectDestination(Node& n)
 
	inline bool PfDetectDestination(Node &n)
 
	{
 
		return PfDetectDestinationTile(n.m_segment_last_tile, n.m_segment_last_td);
 
	}
 

	
 
	inline bool PfDetectDestinationTile(TileIndex tile, Trackdir trackdir)
 
	{
 
@@ -69,13 +69,13 @@ public:
 
	}
 

	
 
	/**
 
	 * Called by YAPF to calculate cost estimate. Calculates distance to the destination
 
	 *  adds it to the actual cost from origin and stores the sum to the Node::m_estimate
 
	 */
 
	inline bool PfCalcEstimate(Node& n)
 
	inline bool PfCalcEstimate(Node &n)
 
	{
 
		static const int dg_dir_to_x_offs[] = {-1, 0, 1, 0};
 
		static const int dg_dir_to_y_offs[] = {0, 1, 0, -1};
 
		if (PfDetectDestination(n)) {
 
			n.m_estimate = n.m_cost;
 
			return true;
 
@@ -108,13 +108,13 @@ public:
 
	typedef typename Types::TrackFollower TrackFollower;
 
	typedef typename Types::NodeList::Titem Node;        ///< this will be our node type
 
	typedef typename Node::Key Key;                      ///< key to hash tables
 

	
 
protected:
 
	/** to access inherited path finder */
 
	inline Tpf& Yapf()
 
	inline Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	/**
 
@@ -251,13 +251,13 @@ public:
 
	typedef typename Types::TrackFollower TrackFollower;
 
	typedef typename Types::NodeList::Titem Node; ///< this will be our node type
 
	typedef typename Node::Key Key;               ///< key to hash tables
 

	
 
protected:
 
	/** to access inherited path finder */
 
	Tpf& Yapf()
 
	Tpf &Yapf()
 
	{
 
		return *static_cast<Tpf *>(this);
 
	}
 

	
 
public:
 
	inline int CurveCost(Trackdir td1, Trackdir td2)
src/road_cmd.cpp
Show inline comments
 
@@ -1401,13 +1401,13 @@ void DrawRoadTypeCatenary(const TileInfo
 
				}
 
			}
 
		}
 
		if (CountBits(rb_new) >= 2) rb = rb_new;
 
	}
 

	
 
	const RoadTypeInfo* rti = GetRoadTypeInfo(rt);
 
	const RoadTypeInfo *rti = GetRoadTypeInfo(rt);
 
	SpriteID front = GetCustomRoadSprite(rti, ti->tile, ROTSG_CATENARY_FRONT);
 
	SpriteID back = GetCustomRoadSprite(rti, ti->tile, ROTSG_CATENARY_BACK);
 

	
 
	if (front != 0 || back != 0) {
 
		if (front != 0) front += GetRoadSpriteOffset(ti->tileh, rb);
 
		if (back != 0) back += GetRoadSpriteOffset(ti->tileh, rb);
 
@@ -1846,13 +1846,13 @@ static void DrawTile_Road(TileInfo *ti)
 
 * @param rt  The road type of the depot to draw.
 
 */
 
void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
 
{
 
	PaletteID palette = COMPANY_SPRITE_COLOUR(_local_company);
 

	
 
	const RoadTypeInfo* rti = GetRoadTypeInfo(rt);
 
	const RoadTypeInfo *rti = GetRoadTypeInfo(rt);
 
	int relocation = GetCustomRoadSprite(rti, INVALID_TILE, ROTSG_DEPOT);
 
	bool default_gfx = relocation == 0;
 
	if (default_gfx) {
 
		if (HasBit(rti->flags, ROTF_CATENARY)) {
 
			if (_loaded_newgrf_features.tram == TRAMWAY_REPLACE_DEPOT_WITH_TRACK && RoadTypeIsTram(rt) && !rti->UsesOverlay()) {
 
				/* Sprites with track only work for default tram */
src/road_gui.cpp
Show inline comments
 
@@ -752,13 +752,13 @@ struct BuildRoadToolbarWindow : Window {
 
	 * @param hotkey Hotkey
 
	 * @param last_build Last build road type
 
	 * @return ES_HANDLED if hotkey was accepted.
 
	 */
 
	static EventState RoadTramToolbarGlobalHotkeys(int hotkey, RoadType last_build, RoadTramType rtt)
 
	{
 
		Window* w = nullptr;
 
		Window *w = nullptr;
 
		switch (_game_mode) {
 
			case GM_NORMAL:
 
				w = ShowBuildRoadToolbar(last_build);
 
				break;
 

	
 
			case GM_EDITOR:
src/saveload/afterload.cpp
Show inline comments
 
@@ -1239,13 +1239,13 @@ bool AfterLoadGame()
 

	
 
					t.m5() = 1 << 7 | type << 2 | dir;
 
				}
 
			}
 
		}
 

	
 
		for (Vehicle* v : Vehicle::Iterate()) {
 
		for (Vehicle *v : Vehicle::Iterate()) {
 
			if (!v->IsGroundVehicle()) continue;
 
			if (IsBridgeTile(v->tile)) {
 
				DiagDirection dir = GetTunnelBridgeDirection(v->tile);
 

	
 
				if (dir != DirToDiagDir(v->direction)) continue;
 
				switch (dir) {
 
@@ -2394,13 +2394,13 @@ bool AfterLoadGame()
 

	
 
		/* We need to properly number/name the depots.
 
		 * The first step is making sure none of the depots uses the
 
		 * 'default' names, after that we can assign the names. */
 
		for (Depot *d : Depot::Iterate()) d->town_cn = UINT16_MAX;
 

	
 
		for (Depot* d : Depot::Iterate()) MakeDefaultName(d);
 
		for (Depot *d : Depot::Iterate()) MakeDefaultName(d);
 
	}
 

	
 
	if (IsSavegameVersionBefore(SLV_142)) {
 
		for (Depot *d : Depot::Iterate()) d->build_date = TimerGameCalendar::date;
 
	}
 

	
 
@@ -2479,13 +2479,13 @@ bool AfterLoadGame()
 
		 * highest possible number to get them numbered in the
 
		 * order they have in the pool. */
 
		for (Waypoint *wp : Waypoint::Iterate()) {
 
			if (!wp->name.empty()) wp->town_cn = UINT16_MAX;
 
		}
 

	
 
		for (Waypoint* wp : Waypoint::Iterate()) {
 
		for (Waypoint *wp : Waypoint::Iterate()) {
 
			if (!wp->name.empty()) MakeDefaultName(wp);
 
		}
 
	}
 

	
 
	if (IsSavegameVersionBefore(SLV_152)) {
 
		_industry_builder.Reset(); // Initialize industry build data.
src/saveload/engine_sl.cpp
Show inline comments
 
@@ -45,13 +45,13 @@ static std::vector<Engine*> _temp_engine
 

	
 
/**
 
 * Allocate an Engine structure, but not using the pools.
 
 * The allocated Engine must be freed using FreeEngine;
 
 * @return Allocated engine.
 
 */
 
static Engine* CallocEngine()
 
static Engine *CallocEngine()
 
{
 
	uint8_t *zero = CallocT<uint8_t>(sizeof(Engine));
 
	Engine *engine = new (zero) Engine();
 
	return engine;
 
}
 

	
src/saveload/waypoint_sl.cpp
Show inline comments
 
@@ -83,13 +83,13 @@ void MoveWaypointsToBaseStations()
 
			}
 
		}
 
	} else {
 
		/* As of version 17, we recalculate the custom graphic ID of waypoints
 
		 * from the GRF ID / station index. */
 
		for (OldWaypoint &wp : _old_waypoints) {
 
			StationClass* stclass = StationClass::Get(STAT_CLASS_WAYP);
 
			StationClass *stclass = StationClass::Get(STAT_CLASS_WAYP);
 
			for (uint i = 0; i < stclass->GetSpecCount(); i++) {
 
				const StationSpec *statspec = stclass->GetSpec(i);
 
				if (statspec != nullptr && statspec->grf_prop.grffile->grfid == wp.grfid && statspec->grf_prop.local_id == wp.localidx) {
 
					wp.spec = statspec;
 
					break;
 
				}
src/settings_gui.cpp
Show inline comments
 
@@ -84,16 +84,16 @@ static uint GetCurrentResolutionIndex()
 

	
 
static void ShowCustCurrency();
 

	
 
/** Window for displaying the textfile of a BaseSet. */
 
template <class TBaseSet>
 
struct BaseSetTextfileWindow : public TextfileWindow {
 
	const TBaseSet* baseset; ///< View the textfile of this BaseSet.
 
	const TBaseSet *baseset; ///< View the textfile of this BaseSet.
 
	StringID content_type;   ///< STR_CONTENT_TYPE_xxx for title.
 

	
 
	BaseSetTextfileWindow(TextfileType file_type, const TBaseSet* baseset, StringID content_type) : TextfileWindow(file_type), baseset(baseset), content_type(content_type)
 
	BaseSetTextfileWindow(TextfileType file_type, const TBaseSet *baseset, StringID content_type) : TextfileWindow(file_type), baseset(baseset), content_type(content_type)
 
	{
 
		auto textfile = this->baseset->GetTextfile(file_type);
 
		this->LoadTextfile(textfile.value(), BASESET_DIR);
 
	}
 

	
 
	void SetStringParameters(WidgetID widget) const override
 
@@ -109,13 +109,13 @@ struct BaseSetTextfileWindow : public Te
 
 * Open the BaseSet version of the textfile window.
 
 * @param file_type The type of textfile to display.
 
 * @param baseset The BaseSet to use.
 
 * @param content_type STR_CONTENT_TYPE_xxx for title.
 
 */
 
template <class TBaseSet>
 
void ShowBaseSetTextfileWindow(TextfileType file_type, const TBaseSet* baseset, StringID content_type)
 
void ShowBaseSetTextfileWindow(TextfileType file_type, const TBaseSet *baseset, StringID content_type)
 
{
 
	CloseWindowById(WC_TEXTFILE, file_type);
 
	new BaseSetTextfileWindow<TBaseSet>(file_type, baseset, content_type);
 
}
 

	
 
std::set<int> _refresh_rates = { 30, 60, 75, 90, 100, 120, 144, 240 };
 
@@ -685,22 +685,22 @@ struct GameOptionsWindow : Window {
 
				break;
 
			}
 

	
 
			case WID_GO_BASE_GRF_DROPDOWN:
 
				if (_game_mode == GM_MENU) {
 
					CloseWindowByClass(WC_GRF_PARAMETERS);
 
					auto* set = BaseGraphics::GetSet(index);
 
					auto set = BaseGraphics::GetSet(index);
 
					BaseGraphics::SetSet(set);
 
					this->reload = true;
 
					this->InvalidateData();
 
				}
 
				break;
 

	
 
			case WID_GO_BASE_SFX_DROPDOWN:
 
				if (_game_mode == GM_MENU) {
 
					auto* set = BaseSounds::GetSet(index);
 
					auto set = BaseSounds::GetSet(index);
 
					BaseSounds::ini_set = set->name;
 
					BaseSounds::SetSet(set);
 
					this->reload = true;
 
					this->InvalidateData();
 
				}
 
				break;
src/sortlist_type.h
Show inline comments
 
@@ -93,13 +93,13 @@ public:
 
		resort_timer(1),
 
		params(nullptr)
 
	{};
 

	
 
	/* If sort parameters are used then we require a reference to the params. */
 
	template <typename T_ = T, typename P_ = P, typename _F = F, std::enable_if_t<!std::is_same_v<P_, std::nullptr_t>>* = nullptr>
 
	GUIList(const P& params) :
 
	GUIList(const P &params) :
 
		sort_func_list(nullptr),
 
		filter_func_list(nullptr),
 
		flags(VL_NONE),
 
		sort_type(0),
 
		filter_type(0),
 
		resort_timer(1),
src/sound/xaudio2_s.cpp
Show inline comments
 
@@ -33,13 +33,13 @@
 
using Microsoft::WRL::ComPtr;
 

	
 
#include "../os/windows/win32.h"
 
#include "../safeguards.h"
 

	
 
// Definition of the "XAudio2Create" call used to initialise XAudio2
 
typedef HRESULT(__stdcall *API_XAudio2Create)(_Outptr_ IXAudio2** ppXAudio2, UINT32 Flags, XAUDIO2_PROCESSOR XAudio2Processor);
 
typedef HRESULT(__stdcall *API_XAudio2Create)(_Outptr_ IXAudio2 **ppXAudio2, UINT32 Flags, XAUDIO2_PROCESSOR XAudio2Processor);
 

	
 
static FSoundDriver_XAudio2 iFSoundDriver_XAudio2;
 

	
 
/**
 
 * Implementation of the IXAudio2VoiceCallback interface.
 
 * Provides buffered audio to XAudio2 from the OpenTTD mixer.
 
@@ -48,13 +48,13 @@ class StreamingVoiceContext : public IXA
 
{
 
private:
 
	int bufferLength;
 
	char *buffer;
 

	
 
public:
 
	IXAudio2SourceVoice* SourceVoice;
 
	IXAudio2SourceVoice *SourceVoice;
 

	
 
	StreamingVoiceContext(int bufferLength)
 
	{
 
		this->bufferLength = bufferLength;
 
		this->buffer = MallocT<char>(bufferLength);
 
	}
 
@@ -109,16 +109,16 @@ public:
 
	STDMETHOD_(void, OnVoiceError)(void*, HRESULT) override
 
	{
 
	}
 
};
 

	
 
static HMODULE _xaudio_dll_handle;
 
static IXAudio2SourceVoice* _source_voice = nullptr;
 
static IXAudio2MasteringVoice* _mastering_voice = nullptr;
 
static IXAudio2SourceVoice *_source_voice = nullptr;
 
static IXAudio2MasteringVoice *_mastering_voice = nullptr;
 
static ComPtr<IXAudio2> _xaudio2;
 
static StreamingVoiceContext* _voice_context = nullptr;
 
static StreamingVoiceContext *_voice_context = nullptr;
 

	
 
/** Create XAudio2 context with SEH exception checking. */
 
static HRESULT CreateXAudio(API_XAudio2Create xAudio2Create)
 
{
 
	HRESULT hr;
 
	__try {
src/station_cmd.cpp
Show inline comments
 
@@ -3161,14 +3161,14 @@ draw_default_foundation:
 

	
 
	if (HasStationRail(ti->tile) && HasRailCatenaryDrawn(GetRailType(ti->tile))) DrawRailCatenary(ti);
 

	
 
	if (IsRoadStop(ti->tile)) {
 
		RoadType road_rt = GetRoadTypeRoad(ti->tile);
 
		RoadType tram_rt = GetRoadTypeTram(ti->tile);
 
		const RoadTypeInfo* road_rti = road_rt == INVALID_ROADTYPE ? nullptr : GetRoadTypeInfo(road_rt);
 
		const RoadTypeInfo* tram_rti = tram_rt == INVALID_ROADTYPE ? nullptr : GetRoadTypeInfo(tram_rt);
 
		const RoadTypeInfo *road_rti = road_rt == INVALID_ROADTYPE ? nullptr : GetRoadTypeInfo(road_rt);
 
		const RoadTypeInfo *tram_rti = tram_rt == INVALID_ROADTYPE ? nullptr : GetRoadTypeInfo(tram_rt);
 

	
 
		Axis axis = GetRoadStopDir(ti->tile) == DIAGDIR_NE ? AXIS_X : AXIS_Y;
 
		DiagDirection dir = GetRoadStopDir(ti->tile);
 
		StationType type = GetStationType(ti->tile);
 

	
 
		const RoadStopSpec *stopspec = GetRoadStopSpec(ti->tile);
src/story_gui.cpp
Show inline comments
 
@@ -531,13 +531,13 @@ protected:
 
	}
 

	
 
	/**
 
	 * Internal event handler for when a page element is clicked.
 
	 * @param pe The clicked page element.
 
	 */
 
	void OnPageElementClick(const StoryPageElement& pe)
 
	void OnPageElementClick(const StoryPageElement &pe)
 
	{
 
		switch (pe.type) {
 
			case SPET_TEXT:
 
				/* Do nothing. */
 
				break;
 

	
src/strings_internal.h
Show inline comments
 
@@ -222,13 +222,13 @@ public:
 
		this->next_type = other.next_type;
 
		this->params = std::move(other.params);
 
		this->parameters = span(params.data(), params.size());
 
		return *this;
 
	}
 

	
 
	ArrayStringParameters(const ArrayStringParameters& other) = delete;
 
	ArrayStringParameters(const ArrayStringParameters &other) = delete;
 
	ArrayStringParameters& operator=(const ArrayStringParameters &other) = delete;
 
};
 

	
 
/**
 
 * Helper to create the StringParameters with its own buffer with the given
 
 * parameter values.
src/thread.h
Show inline comments
 
@@ -71,13 +71,13 @@ inline bool StartNewThread(std::thread *
 
			*thr = std::move(t);
 
		} else {
 
			t.detach();
 
		}
 

	
 
		return true;
 
	} catch (const std::system_error& e) {
 
	} catch (const std::system_error &e) {
 
		/* Something went wrong, the system we are running on might not support threads. */
 
		Debug(misc, 1, "Can't create thread '{}': {}", name, e.what());
 
	}
 

	
 
	return false;
 
}
src/tilematrix_type.hpp
Show inline comments
 
@@ -75,13 +75,13 @@ public:
 
	}
 

	
 
	/**
 
	 * Get the total covered area.
 
	 * @return The area covered by the matrix.
 
	 */
 
	const TileArea& GetArea() const
 
	const TileArea &GetArea() const
 
	{
 
		return this->area;
 
	}
 

	
 
	/**
 
	 * Get the area of the matrix square that contains a specific tile.
src/toolbar_gui.cpp
Show inline comments
 
@@ -367,14 +367,14 @@ static CallBackFunction ToolbarScenSaveO
 
static CallBackFunction MenuClickSaveLoad(int index = 0)
 
{
 
	if (_game_mode == GM_EDITOR) {
 
		switch (index) {
 
			case SLEME_SAVE_SCENARIO:  ShowSaveLoadDialog(FT_SCENARIO, SLO_SAVE);  break;
 
			case SLEME_LOAD_SCENARIO:  ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD);  break;
 
			case SLEME_SAVE_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_SAVE); break;
 
			case SLEME_LOAD_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD); break;
 
			case SLEME_SAVE_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP, SLO_SAVE); break;
 
			case SLEME_LOAD_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP, SLO_LOAD); break;
 
			case SLEME_EXIT_TOINTRO:   AskExitToGameMenu();                    break;
 
			case SLEME_EXIT_GAME:      HandleExitGameRequest();                break;
 
		}
 
	} else {
 
		switch (index) {
 
			case SLNME_SAVE_GAME:      ShowSaveLoadDialog(FT_SAVEGAME, SLO_SAVE); break;
src/vehicle.cpp
Show inline comments
 
@@ -3042,13 +3042,13 @@ void GetVehicleSet(VehicleSet &set, Vehi
 
 * @return Weight in tonnes
 
 */
 
uint32_t Vehicle::GetDisplayMaxWeight() const
 
{
 
	uint32_t max_weight = 0;
 

	
 
	for (const Vehicle* u = this; u != nullptr; u = u->Next()) {
 
	for (const Vehicle *u = this; u != nullptr; u = u->Next()) {
 
		max_weight += u->GetMaxWeight();
 
	}
 

	
 
	return max_weight;
 
}
 

	
src/vehicle_base.h
Show inline comments
 
@@ -1014,14 +1014,14 @@ public:
 
	/**
 
	 * Iterator to iterate orders
 
	 * Supports deletion of current order
 
	 */
 
	struct OrderIterator {
 
		typedef Order value_type;
 
		typedef Order* pointer;
 
		typedef Order& reference;
 
		typedef Order *pointer;
 
		typedef Order &reference;
 
		typedef size_t difference_type;
 
		typedef std::forward_iterator_tag iterator_category;
 

	
 
		explicit OrderIterator(OrderList *list) : list(list), prev(nullptr)
 
		{
 
			this->order = (this->list == nullptr) ? nullptr : this->list->GetFirstOrder();
src/video/cocoa/cocoa_ogl.h
Show inline comments
 
@@ -49,13 +49,13 @@ public:
 
protected:
 
	void Paint() override;
 

	
 
	void *GetVideoPointer() override;
 
	void ReleaseVideoPointer() override;
 

	
 
	NSView* AllocateDrawView() override;
 
	NSView *AllocateDrawView() override;
 
};
 

	
 
class FVideoDriver_CocoaOpenGL : public DriverFactoryBase {
 
public:
 
	FVideoDriver_CocoaOpenGL() : DriverFactoryBase(Driver::DT_VIDEO, 9, "cocoa-opengl", "Cocoa OpenGL Video Driver") {}
 
	Driver *CreateInstance() const override { return new VideoDriver_CocoaOpenGL(); }
src/video/cocoa/cocoa_v.h
Show inline comments
 
@@ -75,13 +75,13 @@ protected:
 
	const char *Initialize();
 

	
 
	void UpdateVideoModes();
 

	
 
	bool MakeWindow(int width, int height);
 

	
 
	virtual NSView* AllocateDrawView() = 0;
 
	virtual NSView *AllocateDrawView() = 0;
 

	
 
	/** Get a pointer to the video buffer. */
 
	virtual void *GetVideoPointer() = 0;
 
	/** Hand video buffer back to the drawing backend. */
 
	virtual void ReleaseVideoPointer() {}
 

	
 
@@ -118,13 +118,13 @@ public:
 
	void AllocateBackingStore(bool force = false) override;
 

	
 
protected:
 
	void Paint() override;
 
	void CheckPaletteAnim() override;
 

	
 
	NSView* AllocateDrawView() override;
 
	NSView *AllocateDrawView() override;
 

	
 
	void *GetVideoPointer() override { return this->buffer_depth == 8 ? this->pixel_buffer : this->window_buffer; }
 
};
 

	
 
class FVideoDriver_CocoaQuartz : public DriverFactoryBase {
 
public:
src/video/cocoa/cocoa_v.mm
Show inline comments
 
@@ -397,13 +397,13 @@ bool VideoDriver_Cocoa::MakeWindow(int w
 
	 * with the quartz fullscreen support as found only in 10.7 and later. */
 
	if ([ this->window respondsToSelector:@selector(toggleFullScreen:) ]) {
 
		NSWindowCollectionBehavior behavior = [ this->window collectionBehavior ];
 
		behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
 
		[ this->window setCollectionBehavior:behavior ];
 

	
 
		NSButton* fullscreenButton = [ this->window standardWindowButton:NSWindowZoomButton ];
 
		NSButton *fullscreenButton = [ this->window standardWindowButton:NSWindowZoomButton ];
 
		[ fullscreenButton setAction:@selector(toggleFullScreen:) ];
 
		[ fullscreenButton setTarget:this->window ];
 
	}
 

	
 
	this->delegate = [ [ OTTD_CocoaWindowDelegate alloc ] initWithDriver:this ];
 
	[ this->window setDelegate:this->delegate ];
src/widgets/dropdown_type.h
Show inline comments
 
@@ -114,18 +114,18 @@ public:
 
		bool rtl = TEnd ^ (_current_text_dir == TD_RTL);
 
		DrawStringMultiLine(r.WithWidth(this->dim.width, rtl), this->string, this->GetColour(sel), SA_CENTER, false, TFs);
 
		this->TBase::Draw(full, r.Indent(this->dim.width, rtl), sel, bg_colour);
 
	}
 

	
 
	/**
 
	* Natural sorting comparator function for DropDownList::sort().
 
	* @param first Left side of comparison.
 
	* @param second Right side of comparison.
 
	* @return true if \a first precedes \a second.
 
	* @warning All items in the list need to be derivates of DropDownListStringItem.
 
	*/
 
	 * Natural sorting comparator function for DropDownList::sort().
 
	 * @param first Left side of comparison.
 
	 * @param second Right side of comparison.
 
	 * @return true if \a first precedes \a second.
 
	 * @warning All items in the list need to be derivates of DropDownListStringItem.
 
	 */
 
	static bool NatSortFunc(std::unique_ptr<const DropDownListItem> const &first, std::unique_ptr<const DropDownListItem> const &second)
 
	{
 
		const std::string &str1 = static_cast<const DropDownString*>(first.get())->string;
 
		const std::string &str2 = static_cast<const DropDownString*>(second.get())->string;
 
		return StrNaturalCompare(str1, str2) < 0;
 
	}
src/window.cpp
Show inline comments
 
@@ -163,13 +163,13 @@ void WindowDesc::LoadFromConfig()
 
	}
 
}
 

	
 
/**
 
 * Sort WindowDesc by ini_key.
 
 */
 
static bool DescSorter(WindowDesc* const &a, WindowDesc* const &b)
 
static bool DescSorter(WindowDesc * const &a, WindowDesc * const &b)
 
{
 
	if (a->ini_key != nullptr && b->ini_key != nullptr) return strcmp(a->ini_key, b->ini_key) < 0;
 
	return a->ini_key != nullptr;
 
}
 

	
 
/**
0 comments (0 inline, 0 general)