Codechange: coding style fixes

This commit is contained in:
Rubidium 2024-01-03 22:33:38 +01:00 committed by rubidium42
parent 0075364c89
commit e3f49ee7a0
59 changed files with 121 additions and 121 deletions

View File

@ -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);

View File

@ -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; }

View File

@ -142,8 +142,8 @@ struct Pool : PoolBase {
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;
@ -186,8 +186,8 @@ struct Pool : PoolBase {
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;

View File

@ -39,7 +39,7 @@ 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
>{};
/**

View File

@ -1081,7 +1081,7 @@ static void NewVehicleAvailable(Engine *e)
} 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. */

View File

@ -98,7 +98,7 @@ bool GetFontAAState(FontSize size, bool check_blitter)
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;

View File

@ -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);

View File

@ -1663,7 +1663,7 @@ static CommandCost CheckIfFarEnoughFromConflictingIndustry(TileIndex tile, int t
/* 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) {

View File

@ -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) {

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -37,9 +37,9 @@ 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 {

View File

@ -377,7 +377,7 @@ static bool FixupMidiData(MidiFile &target)
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;

View File

@ -52,7 +52,7 @@ static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // Wi
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 NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast)
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);
}

View File

@ -537,7 +537,7 @@ CommandDataBuffer SanitizeCmdStrings(const CommandDataBuffer &data)
* @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);

View File

@ -1097,7 +1097,7 @@ struct NetworkStartServerWindow : public Window {
case WID_NSS_PLAY_HEIGHTMAP:
if (!CheckServerName()) return;
_is_network_server = true;
ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD);
ShowSaveLoadDialog(FT_HEIGHTMAP, SLO_LOAD);
break;
}
}

View File

@ -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) {

View File

@ -227,7 +227,7 @@ RoadStopResolverObject::~RoadStopResolverObject()
delete this->town_scope;
}
TownScopeResolver* RoadStopResolverObject::GetTown()
TownScopeResolver *RoadStopResolverObject::GetTown()
{
if (this->town_scope == nullptr) {
Town *t;

View File

@ -81,7 +81,7 @@ struct RoadStopScopeResolver : public ScopeResolver {
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 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;

View File

@ -180,7 +180,7 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust &adjust, ScopeResolver
}
static bool RangeHighComparator(const DeterministicSpriteGroupRange& range, uint32_t value)
static bool RangeHighComparator(const DeterministicSpriteGroupRange &range, uint32_t value)
{
return range.high < value;
}

View File

@ -88,7 +88,7 @@ void InitGRFTownGeneratorNames()
}
}
const std::vector<StringID>& GetGRFTownNameList()
const std::vector<StringID> &GetGRFTownNameList()
{
return _grf_townname_names;
}

View File

@ -51,6 +51,6 @@ 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 */

View File

@ -210,7 +210,7 @@ static WindowDesc _small_news_desc(__FILE__, __LINE__,
/**
* 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));

View File

@ -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<CrashLogOSX *>(context);

View File

@ -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 ParagraphLayouter {
private:
const CoreTextParagraphLayoutFactory::CharType *text_buffer;
ptrdiff_t length;
const FontMap& font_map;
const FontMap &font_map;
CFAutoRelease<CTTypesetterRef> typesetter;

View File

@ -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<CrashLogUnix *>(context);

View File

@ -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];
}

View File

@ -87,14 +87,14 @@ public:
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;
}
@ -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;

View File

@ -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<Tpf *>(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<Tpf *>(this);
}
@ -131,7 +131,7 @@ public:
protected:
/** to access inherited path finder */
Tpf& Yapf()
Tpf &Yapf()
{
return *static_cast<Tpf *>(this);
}

View File

@ -63,7 +63,7 @@ protected:
LocalCache m_local_cache;
/** to access inherited path finder */
inline Tpf& Yapf()
inline Tpf &Yapf()
{
return *static_cast<Tpf *>(this);
}
@ -138,7 +138,7 @@ struct CSegmentCostCacheT : public CSegmentCostCacheBase {
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<Tpf *>(this);
}
inline static Cache& stGetGlobalCache()
inline static Cache &stGetGlobalCache()
{
static int last_rail_change_counter = 0;
static Cache C;

View File

@ -77,7 +77,7 @@ protected:
}
/** to access inherited path finder */
Tpf& Yapf()
Tpf &Yapf()
{
return *static_cast<Tpf *>(this);
}

View File

@ -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<Tpf *>(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<Tpf *>(this);
}
@ -121,7 +121,7 @@ protected:
bool m_any_depot;
/** to access inherited path finder */
Tpf& Yapf()
Tpf &Yapf()
{
return *static_cast<Tpf *>(this);
}

View File

@ -97,7 +97,7 @@ struct CYapfNodeT {
return m_key.m_td;
}
inline const Tkey_& GetKey() const
inline const Tkey_ &GetKey() const
{
return m_key;
}

View File

@ -82,7 +82,7 @@ struct CYapfRailSegment
, m_hash_next(nullptr)
{}
inline const Key& GetKey() const
inline const Key &GetKey() const
{
return m_key;
}

View File

@ -44,7 +44,7 @@ public:
protected:
/** to access inherited pathfinder */
inline Tpf& Yapf()
inline Tpf &Yapf()
{
return *static_cast<Tpf *>(this);
}
@ -196,7 +196,7 @@ public:
protected:
/** to access inherited path finder */
inline Tpf& Yapf()
inline Tpf &Yapf()
{
return *static_cast<Tpf *>(this);
}
@ -287,7 +287,7 @@ public:
protected:
/** to access inherited path finder */
inline Tpf& Yapf()
inline Tpf &Yapf()
{
return *static_cast<Tpf *>(this);
}
@ -370,7 +370,7 @@ public:
protected:
/** to access inherited path finder */
inline Tpf& Yapf()
inline Tpf &Yapf()
{
return *static_cast<Tpf *>(this);
}

View File

@ -30,7 +30,7 @@ protected:
CYapfCostRoadT() : m_max_cost(0) {};
/** to access inherited path finder */
Tpf& Yapf()
Tpf &Yapf()
{
return *static_cast<Tpf *>(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<Tpf *>(this);
}
@ -258,7 +258,7 @@ public:
protected:
/** to access inherited path finder */
Tpf& Yapf()
Tpf &Yapf()
{
return *static_cast<Tpf *>(this);
}
@ -325,7 +325,7 @@ public:
protected:
/** to access inherited path finder */
inline Tpf& Yapf()
inline Tpf &Yapf()
{
return *static_cast<Tpf *>(this);
}

View File

@ -47,14 +47,14 @@ public:
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);
}
@ -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<Tpf *>(this);
}
@ -254,7 +254,7 @@ public:
protected:
/** to access inherited path finder */
Tpf& Yapf()
Tpf &Yapf()
{
return *static_cast<Tpf *>(this);
}

View File

@ -1404,7 +1404,7 @@ void DrawRoadTypeCatenary(const TileInfo *ti, RoadType rt, RoadBits rb)
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, 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) {

View File

@ -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);

View File

@ -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);
}
}

View File

@ -48,7 +48,7 @@ static std::vector<Engine*> _temp_engine;
* 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();

View File

@ -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) {

View File

@ -87,10 +87,10 @@ 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);
@ -112,7 +112,7 @@ struct BaseSetTextfileWindow : public TextfileWindow {
* @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);
@ -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;

View File

@ -96,7 +96,7 @@ public:
/* 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),

View File

@ -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<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)

View File

@ -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);

View File

@ -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:

View File

@ -225,7 +225,7 @@ public:
return *this;
}
ArrayStringParameters(const ArrayStringParameters& other) = delete;
ArrayStringParameters(const ArrayStringParameters &other) = delete;
ArrayStringParameters& operator=(const ArrayStringParameters &other) = delete;
};

View File

@ -74,7 +74,7 @@ inline bool StartNewThread(std::thread *thr, const char *name, TFn&& _Fx, TArgs&
}
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());
}

View File

@ -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;
}

View File

@ -370,8 +370,8 @@ static CallBackFunction MenuClickSaveLoad(int index = 0)
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;
}

View File

@ -3045,7 +3045,7 @@ 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();
}

View File

@ -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;

View File

@ -52,7 +52,7 @@ protected:
void *GetVideoPointer() override;
void ReleaseVideoPointer() override;
NSView* AllocateDrawView() override;
NSView *AllocateDrawView() override;
};
class FVideoDriver_CocoaOpenGL : public DriverFactoryBase {

View File

@ -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; }
};

View File

@ -400,7 +400,7 @@ bool VideoDriver_Cocoa::MakeWindow(int width, int height)
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 ];
}

View File

@ -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 DropDownListItem> const &first, std::unique_ptr<const DropDownListItem> const &second)
{
const std::string &str1 = static_cast<const DropDownString*>(first.get())->string;

View File

@ -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;