diff --git a/src/company_func.h b/src/company_func.h --- a/src/company_func.h +++ b/src/company_func.h @@ -27,8 +27,8 @@ 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); diff --git a/src/core/overflowsafe_type.hpp b/src/core/overflowsafe_type.hpp --- a/src/core/overflowsafe_type.hpp +++ b/src/core/overflowsafe_type.hpp @@ -37,7 +37,7 @@ private: 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; } diff --git a/src/core/pool_type.hpp b/src/core/pool_type.hpp --- a/src/core/pool_type.hpp +++ b/src/core/pool_type.hpp @@ -142,8 +142,8 @@ struct Pool : PoolBase { template 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; @@ -186,8 +186,8 @@ struct Pool : PoolBase { template 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; diff --git a/src/core/span_type.hpp b/src/core/span_type.hpp --- a/src/core/span_type.hpp +++ b/src/core/span_type.hpp @@ -39,7 +39,7 @@ template struct is_compatible_container : std::bool_constant < has_size_and_data::value - && is_compatible_element::value + && is_compatible_element::value >{}; /** diff --git a/src/engine.cpp b/src/engine.cpp --- a/src/engine.cpp +++ b/src/engine.cpp @@ -1081,7 +1081,7 @@ static void NewVehicleAvailable(Engine * } 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. */ diff --git a/src/fontcache.cpp b/src/fontcache.cpp --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -98,7 +98,7 @@ bool GetFontAAState(FontSize size, bool 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; diff --git a/src/group_gui.cpp b/src/group_gui.cpp --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -901,7 +901,7 @@ public: 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); diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1663,7 +1663,7 @@ static CommandCost CheckIfFarEnoughFromC /* 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) { diff --git a/src/misc/array.hpp b/src/misc/array.hpp --- a/src/misc/array.hpp +++ b/src/misc/array.hpp @@ -28,7 +28,7 @@ protected: 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) { diff --git a/src/misc/dbg_helpers.h b/src/misc/dbg_helpers.h --- a/src/misc/dbg_helpers.h +++ b/src/misc/dbg_helpers.h @@ -124,7 +124,7 @@ struct 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); diff --git a/src/misc/fixedsizearray.hpp b/src/misc/fixedsizearray.hpp --- a/src/misc/fixedsizearray.hpp +++ b/src/misc/fixedsizearray.hpp @@ -39,25 +39,25 @@ protected: 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; } diff --git a/src/misc/hashtable.hpp b/src/misc/hashtable.hpp --- a/src/misc/hashtable.hpp +++ b/src/misc/hashtable.hpp @@ -216,7 +216,7 @@ public: } /** non-const item search & removal */ - Titem_& Pop(const Tkey &key) + Titem_ &Pop(const Tkey &key) { Titem_ *item = TryPop(key); assert(item != nullptr); diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -37,9 +37,9 @@ static const int MS_TO_REFTIME = 1000 * 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 { diff --git a/src/music/midifile.cpp b/src/music/midifile.cpp --- a/src/music/midifile.cpp +++ b/src/music/midifile.cpp @@ -377,7 +377,7 @@ static bool FixupMidiData(MidiFile &targ 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; @@ -792,12 +792,12 @@ struct MpsMachine { /* 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; diff --git a/src/network/core/host.cpp b/src/network/core/host.cpp --- a/src/network/core/host.cpp +++ b/src/network/core/host.cpp @@ -52,7 +52,7 @@ static void NetworkFindBroadcastIPsInter 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); @@ -72,7 +72,7 @@ static void NetworkFindBroadcastIPsInter 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); } diff --git a/src/network/network_command.cpp b/src/network/network_command.cpp --- a/src/network/network_command.cpp +++ b/src/network/network_command.cpp @@ -537,7 +537,7 @@ CommandDataBuffer SanitizeCmdStrings(con * @param cp Command packet to unpack. */ template -void UnpackNetworkCommand(const CommandPacket* cp) +void UnpackNetworkCommand(const CommandPacket *cp) { auto args = EndianBufferReader::ToValue::Args>(cp->data); Command::PostFromNet(cp->err_msg, std::get(_callback_tuple), cp->my_cmd, args); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -1097,7 +1097,7 @@ struct NetworkStartServerWindow : public case WID_NSS_PLAY_HEIGHTMAP: if (!CheckServerName()) return; _is_network_server = true; - ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD); + ShowSaveLoadDialog(FT_HEIGHTMAP, SLO_LOAD); break; } } diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -403,7 +403,7 @@ 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; @@ -444,7 +444,7 @@ 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); @@ -919,7 +919,7 @@ struct SpriteAlignerWindow : Window { 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) { diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp --- a/src/newgrf_roadstop.cpp +++ b/src/newgrf_roadstop.cpp @@ -227,7 +227,7 @@ RoadStopResolverObject::~RoadStopResolve delete this->town_scope; } -TownScopeResolver* RoadStopResolverObject::GetTown() +TownScopeResolver *RoadStopResolverObject::GetTown() { if (this->town_scope == nullptr) { Town *t; diff --git a/src/newgrf_roadstop.h b/src/newgrf_roadstop.h --- a/src/newgrf_roadstop.h +++ b/src/newgrf_roadstop.h @@ -81,7 +81,7 @@ struct RoadStopScopeResolver : public Sc 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) { } @@ -97,10 +97,10 @@ struct RoadStopResolverObject : public R 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; diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -180,7 +180,7 @@ static U EvalAdjustT(const Deterministic } -static bool RangeHighComparator(const DeterministicSpriteGroupRange& range, uint32_t value) +static bool RangeHighComparator(const DeterministicSpriteGroupRange &range, uint32_t value) { return range.high < value; } diff --git a/src/newgrf_townname.cpp b/src/newgrf_townname.cpp --- a/src/newgrf_townname.cpp +++ b/src/newgrf_townname.cpp @@ -88,7 +88,7 @@ void InitGRFTownGeneratorNames() } } -const std::vector& GetGRFTownNameList() +const std::vector &GetGRFTownNameList() { return _grf_townname_names; } diff --git a/src/newgrf_townname.h b/src/newgrf_townname.h --- a/src/newgrf_townname.h +++ b/src/newgrf_townname.h @@ -51,6 +51,6 @@ uint32_t GetGRFTownNameId(uint16_t gen); uint16_t GetGRFTownNameType(uint16_t gen); StringID GetGRFTownNameName(uint16_t gen); -const std::vector& GetGRFTownNameList(); +const std::vector &GetGRFTownNameList(); #endif /* NEWGRF_TOWNNAME_H */ diff --git a/src/news_gui.cpp b/src/news_gui.cpp --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -210,7 +210,7 @@ static WindowDesc _small_news_desc(__FIL /** * 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 @@ -218,7 +218,7 @@ static WindowDesc* _news_window_layout[] &_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)); diff --git a/src/os/macosx/crashlog_osx.cpp b/src/os/macosx/crashlog_osx.cpp --- a/src/os/macosx/crashlog_osx.cpp +++ b/src/os/macosx/crashlog_osx.cpp @@ -70,7 +70,7 @@ class CrashLogOSX : public CrashLog { } #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(context); diff --git a/src/os/macosx/string_osx.cpp b/src/os/macosx/string_osx.cpp --- a/src/os/macosx/string_osx.cpp +++ b/src/os/macosx/string_osx.cpp @@ -24,10 +24,10 @@ 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; @@ -43,7 +43,7 @@ extern "C" { 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 */ @@ -60,7 +60,7 @@ class CoreTextParagraphLayout : public P private: const CoreTextParagraphLayoutFactory::CharType *text_buffer; ptrdiff_t length; - const FontMap& font_map; + const FontMap &font_map; CFAutoRelease typesetter; diff --git a/src/os/unix/crashlog_unix.cpp b/src/os/unix/crashlog_unix.cpp --- a/src/os/unix/crashlog_unix.cpp +++ b/src/os/unix/crashlog_unix.cpp @@ -70,7 +70,7 @@ class CrashLogUnix : public CrashLog { } #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(context); diff --git a/src/pathfinder/yapf/nodelist.hpp b/src/pathfinder/yapf/nodelist.hpp --- a/src/pathfinder/yapf/nodelist.hpp +++ b/src/pathfinder/yapf/nodelist.hpp @@ -116,7 +116,7 @@ public: } /** 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); @@ -145,7 +145,7 @@ public: } /** Get a particular item. */ - inline Titem_& ItemAt(int idx) + inline Titem_ &ItemAt(int idx) { return m_arr[idx]; } diff --git a/src/pathfinder/yapf/yapf_base.hpp b/src/pathfinder/yapf/yapf_base.hpp --- a/src/pathfinder/yapf/yapf_base.hpp +++ b/src/pathfinder/yapf/yapf_base.hpp @@ -87,14 +87,14 @@ public: protected: /** to access inherited path finder */ - inline Tpf& Yapf() + inline Tpf &Yapf() { return *static_cast(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; } @@ -167,7 +167,7 @@ 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; diff --git a/src/pathfinder/yapf/yapf_common.hpp b/src/pathfinder/yapf/yapf_common.hpp --- a/src/pathfinder/yapf/yapf_common.hpp +++ b/src/pathfinder/yapf/yapf_common.hpp @@ -24,7 +24,7 @@ protected: TrackdirBits m_orgTrackdirs; ///< origin trackdir mask /** to access inherited path finder */ - inline Tpf& Yapf() + inline Tpf &Yapf() { return *static_cast(this); } @@ -68,7 +68,7 @@ protected: 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(this); } @@ -131,7 +131,7 @@ public: protected: /** to access inherited path finder */ - Tpf& Yapf() + Tpf &Yapf() { return *static_cast(this); } diff --git a/src/pathfinder/yapf/yapf_costcache.hpp b/src/pathfinder/yapf/yapf_costcache.hpp --- a/src/pathfinder/yapf/yapf_costcache.hpp +++ b/src/pathfinder/yapf/yapf_costcache.hpp @@ -63,7 +63,7 @@ protected: LocalCache m_local_cache; /** to access inherited path finder */ - inline Tpf& Yapf() + inline Tpf &Yapf() { return *static_cast(this); } @@ -138,7 +138,7 @@ struct CSegmentCostCacheT : public CSegm 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) { @@ -174,12 +174,12 @@ protected: inline CYapfSegmentCostCacheGlobalT() : m_global_cache(stGetGlobalCache()) {}; /** to access inherited path finder */ - inline Tpf& Yapf() + inline Tpf &Yapf() { return *static_cast(this); } - inline static Cache& stGetGlobalCache() + inline static Cache &stGetGlobalCache() { static int last_rail_change_counter = 0; static Cache C; diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp --- a/src/pathfinder/yapf/yapf_costrail.hpp +++ b/src/pathfinder/yapf/yapf_costrail.hpp @@ -77,7 +77,7 @@ protected: } /** to access inherited path finder */ - Tpf& Yapf() + Tpf &Yapf() { return *static_cast(this); } diff --git a/src/pathfinder/yapf/yapf_destrail.hpp b/src/pathfinder/yapf/yapf_destrail.hpp --- a/src/pathfinder/yapf/yapf_destrail.hpp +++ b/src/pathfinder/yapf/yapf_destrail.hpp @@ -40,7 +40,7 @@ public: typedef typename Node::Key Key; ///< key to hash tables /** to access inherited path finder */ - Tpf& Yapf() + Tpf &Yapf() { return *static_cast(this); } @@ -78,7 +78,7 @@ public: 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(this); } @@ -121,7 +121,7 @@ protected: bool m_any_depot; /** to access inherited path finder */ - Tpf& Yapf() + Tpf &Yapf() { return *static_cast(this); } diff --git a/src/pathfinder/yapf/yapf_node.hpp b/src/pathfinder/yapf/yapf_node.hpp --- a/src/pathfinder/yapf/yapf_node.hpp +++ b/src/pathfinder/yapf/yapf_node.hpp @@ -97,7 +97,7 @@ struct CYapfNodeT { return m_key.m_td; } - inline const Tkey_& GetKey() const + inline const Tkey_ &GetKey() const { return m_key; } diff --git a/src/pathfinder/yapf/yapf_node_rail.hpp b/src/pathfinder/yapf/yapf_node_rail.hpp --- a/src/pathfinder/yapf/yapf_node_rail.hpp +++ b/src/pathfinder/yapf/yapf_node_rail.hpp @@ -82,7 +82,7 @@ struct CYapfRailSegment , m_hash_next(nullptr) {} - inline const Key& GetKey() const + inline const Key &GetKey() const { return m_key; } diff --git a/src/pathfinder/yapf/yapf_rail.cpp b/src/pathfinder/yapf/yapf_rail.cpp --- a/src/pathfinder/yapf/yapf_rail.cpp +++ b/src/pathfinder/yapf/yapf_rail.cpp @@ -44,7 +44,7 @@ public: protected: /** to access inherited pathfinder */ - inline Tpf& Yapf() + inline Tpf &Yapf() { return *static_cast(this); } @@ -196,7 +196,7 @@ public: protected: /** to access inherited path finder */ - inline Tpf& Yapf() + inline Tpf &Yapf() { return *static_cast(this); } @@ -287,7 +287,7 @@ public: protected: /** to access inherited path finder */ - inline Tpf& Yapf() + inline Tpf &Yapf() { return *static_cast(this); } @@ -370,7 +370,7 @@ public: protected: /** to access inherited path finder */ - inline Tpf& Yapf() + inline Tpf &Yapf() { return *static_cast(this); } diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp --- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -30,7 +30,7 @@ protected: CYapfCostRoadT() : m_max_cost(0) {}; /** to access inherited path finder */ - Tpf& Yapf() + Tpf &Yapf() { return *static_cast(this); } @@ -191,7 +191,7 @@ public: typedef typename Node::Key Key; ///< key to hash tables /** to access inherited path finder */ - Tpf& Yapf() + Tpf &Yapf() { return *static_cast(this); } @@ -258,7 +258,7 @@ public: protected: /** to access inherited path finder */ - Tpf& Yapf() + Tpf &Yapf() { return *static_cast(this); } @@ -325,7 +325,7 @@ public: protected: /** to access inherited path finder */ - inline Tpf& Yapf() + inline Tpf &Yapf() { return *static_cast(this); } diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp --- a/src/pathfinder/yapf/yapf_ship.cpp +++ b/src/pathfinder/yapf/yapf_ship.cpp @@ -47,14 +47,14 @@ public: protected: /** to access inherited path finder */ - inline Tpf& Yapf() + inline Tpf &Yapf() { return *static_cast(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); } @@ -72,7 +72,7 @@ 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}; @@ -111,7 +111,7 @@ public: protected: /** to access inherited path finder */ - inline Tpf& Yapf() + inline Tpf &Yapf() { return *static_cast(this); } @@ -254,7 +254,7 @@ public: protected: /** to access inherited path finder */ - Tpf& Yapf() + Tpf &Yapf() { return *static_cast(this); } diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1404,7 +1404,7 @@ 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); @@ -1849,7 +1849,7 @@ void DrawRoadDepotSprite(int x, int y, D { 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) { diff --git a/src/road_gui.cpp b/src/road_gui.cpp --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -755,7 +755,7 @@ struct BuildRoadToolbarWindow : Window { */ 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); diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -1242,7 +1242,7 @@ bool AfterLoadGame() } } - for (Vehicle* v : Vehicle::Iterate()) { + for (Vehicle *v : Vehicle::Iterate()) { if (!v->IsGroundVehicle()) continue; if (IsBridgeTile(v->tile)) { DiagDirection dir = GetTunnelBridgeDirection(v->tile); @@ -2397,7 +2397,7 @@ bool AfterLoadGame() * '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)) { @@ -2482,7 +2482,7 @@ bool AfterLoadGame() 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); } } diff --git a/src/saveload/engine_sl.cpp b/src/saveload/engine_sl.cpp --- a/src/saveload/engine_sl.cpp +++ b/src/saveload/engine_sl.cpp @@ -48,7 +48,7 @@ static std::vector _temp_engine * The allocated Engine must be freed using FreeEngine; * @return Allocated engine. */ -static Engine* CallocEngine() +static Engine *CallocEngine() { uint8_t *zero = CallocT(sizeof(Engine)); Engine *engine = new (zero) Engine(); diff --git a/src/saveload/waypoint_sl.cpp b/src/saveload/waypoint_sl.cpp --- a/src/saveload/waypoint_sl.cpp +++ b/src/saveload/waypoint_sl.cpp @@ -86,7 +86,7 @@ void MoveWaypointsToBaseStations() /* 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) { diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -87,10 +87,10 @@ static void ShowCustCurrency(); /** Window for displaying the textfile of a BaseSet. */ template 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); @@ -112,7 +112,7 @@ struct BaseSetTextfileWindow : public Te * @param content_type STR_CONTENT_TYPE_xxx for title. */ template -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(file_type, baseset, content_type); @@ -688,7 +688,7 @@ struct GameOptionsWindow : Window { 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(); @@ -697,7 +697,7 @@ struct GameOptionsWindow : Window { 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; diff --git a/src/sortlist_type.h b/src/sortlist_type.h --- a/src/sortlist_type.h +++ b/src/sortlist_type.h @@ -96,7 +96,7 @@ public: /* If sort parameters are used then we require a reference to the params. */ template >* = nullptr> - GUIList(const P& params) : + GUIList(const P ¶ms) : sort_func_list(nullptr), filter_func_list(nullptr), flags(VL_NONE), diff --git a/src/sound/xaudio2_s.cpp b/src/sound/xaudio2_s.cpp --- a/src/sound/xaudio2_s.cpp +++ b/src/sound/xaudio2_s.cpp @@ -36,7 +36,7 @@ using Microsoft::WRL::ComPtr; #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; @@ -51,7 +51,7 @@ private: char *buffer; public: - IXAudio2SourceVoice* SourceVoice; + IXAudio2SourceVoice *SourceVoice; StreamingVoiceContext(int bufferLength) { @@ -112,10 +112,10 @@ public: }; 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 _xaudio2; -static StreamingVoiceContext* _voice_context = nullptr; +static StreamingVoiceContext *_voice_context = nullptr; /** Create XAudio2 context with SEH exception checking. */ static HRESULT CreateXAudio(API_XAudio2Create xAudio2Create) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3164,8 +3164,8 @@ draw_default_foundation: 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); diff --git a/src/story_gui.cpp b/src/story_gui.cpp --- a/src/story_gui.cpp +++ b/src/story_gui.cpp @@ -534,7 +534,7 @@ 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: diff --git a/src/strings_internal.h b/src/strings_internal.h --- a/src/strings_internal.h +++ b/src/strings_internal.h @@ -225,7 +225,7 @@ public: return *this; } - ArrayStringParameters(const ArrayStringParameters& other) = delete; + ArrayStringParameters(const ArrayStringParameters &other) = delete; ArrayStringParameters& operator=(const ArrayStringParameters &other) = delete; }; diff --git a/src/thread.h b/src/thread.h --- a/src/thread.h +++ b/src/thread.h @@ -74,7 +74,7 @@ inline bool StartNewThread(std::thread * } 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()); } diff --git a/src/tilematrix_type.hpp b/src/tilematrix_type.hpp --- a/src/tilematrix_type.hpp +++ b/src/tilematrix_type.hpp @@ -78,7 +78,7 @@ public: * Get the total covered area. * @return The area covered by the matrix. */ - const TileArea& GetArea() const + const TileArea &GetArea() const { return this->area; } diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -370,8 +370,8 @@ static CallBackFunction MenuClickSaveLoa 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; } diff --git a/src/vehicle.cpp b/src/vehicle.cpp --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -3045,7 +3045,7 @@ uint32_t Vehicle::GetDisplayMaxWeight() { 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(); } diff --git a/src/vehicle_base.h b/src/vehicle_base.h --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -1017,8 +1017,8 @@ public: */ 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; diff --git a/src/video/cocoa/cocoa_ogl.h b/src/video/cocoa/cocoa_ogl.h --- a/src/video/cocoa/cocoa_ogl.h +++ b/src/video/cocoa/cocoa_ogl.h @@ -52,7 +52,7 @@ protected: void *GetVideoPointer() override; void ReleaseVideoPointer() override; - NSView* AllocateDrawView() override; + NSView *AllocateDrawView() override; }; class FVideoDriver_CocoaOpenGL : public DriverFactoryBase { diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h --- a/src/video/cocoa/cocoa_v.h +++ b/src/video/cocoa/cocoa_v.h @@ -78,7 +78,7 @@ protected: 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; @@ -121,7 +121,7 @@ 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; } }; diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -400,7 +400,7 @@ bool VideoDriver_Cocoa::MakeWindow(int w 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 ]; } diff --git a/src/widgets/dropdown_type.h b/src/widgets/dropdown_type.h --- a/src/widgets/dropdown_type.h +++ b/src/widgets/dropdown_type.h @@ -117,12 +117,12 @@ public: } /** - * 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 &first, std::unique_ptr const &second) { const std::string &str1 = static_cast(first.get())->string; diff --git a/src/window.cpp b/src/window.cpp --- a/src/window.cpp +++ b/src/window.cpp @@ -166,7 +166,7 @@ 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;