mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: coding style fixes
This commit is contained in:
parent
0075364c89
commit
e3f49ee7a0
|
@ -27,8 +27,8 @@ void UpdateLandscapingLimits();
|
||||||
void UpdateCompanyLiveries(Company *c);
|
void UpdateCompanyLiveries(Company *c);
|
||||||
|
|
||||||
bool CheckCompanyHasMoney(CommandCost &cost);
|
bool CheckCompanyHasMoney(CommandCost &cost);
|
||||||
void SubtractMoneyFromCompany(const CommandCost& cost);
|
void SubtractMoneyFromCompany(const CommandCost &cost);
|
||||||
void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost& cost);
|
void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost &cost);
|
||||||
CommandCost CheckOwnership(Owner owner, TileIndex tile = 0U);
|
CommandCost CheckOwnership(Owner owner, TileIndex tile = 0U);
|
||||||
CommandCost CheckTileOwnership(TileIndex tile);
|
CommandCost CheckTileOwnership(TileIndex tile);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ private:
|
||||||
public:
|
public:
|
||||||
constexpr OverflowSafeInt() : m_value(0) { }
|
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_) { }
|
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 = (const OverflowSafeInt& other) { this->m_value = other.m_value; return *this; }
|
||||||
|
|
|
@ -142,8 +142,8 @@ struct Pool : PoolBase {
|
||||||
template <class T>
|
template <class T>
|
||||||
struct PoolIterator {
|
struct PoolIterator {
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
typedef T* pointer;
|
typedef T *pointer;
|
||||||
typedef T& reference;
|
typedef T &reference;
|
||||||
typedef size_t difference_type;
|
typedef size_t difference_type;
|
||||||
typedef std::forward_iterator_tag iterator_category;
|
typedef std::forward_iterator_tag iterator_category;
|
||||||
|
|
||||||
|
@ -186,8 +186,8 @@ struct Pool : PoolBase {
|
||||||
template <class T, class F>
|
template <class T, class F>
|
||||||
struct PoolIteratorFiltered {
|
struct PoolIteratorFiltered {
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
typedef T* pointer;
|
typedef T *pointer;
|
||||||
typedef T& reference;
|
typedef T &reference;
|
||||||
typedef size_t difference_type;
|
typedef size_t difference_type;
|
||||||
typedef std::forward_iterator_tag iterator_category;
|
typedef std::forward_iterator_tag iterator_category;
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ template <class C, class E>
|
||||||
struct is_compatible_container : std::bool_constant
|
struct is_compatible_container : std::bool_constant
|
||||||
<
|
<
|
||||||
has_size_and_data<C>::value
|
has_size_and_data<C>::value
|
||||||
&& is_compatible_element<C,E>::value
|
&& is_compatible_element<C, E>::value
|
||||||
>{};
|
>{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1081,7 +1081,7 @@ static void NewVehicleAvailable(Engine *e)
|
||||||
} else if (e->type == VEH_ROAD) {
|
} else if (e->type == VEH_ROAD) {
|
||||||
/* maybe make another road type available */
|
/* maybe make another road type available */
|
||||||
assert(e->u.road.roadtype < ROADTYPE_END);
|
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. */
|
/* Only broadcast event if AIs are able to build this vehicle type. */
|
||||||
|
|
|
@ -98,7 +98,7 @@ bool GetFontAAState(FontSize size, bool check_blitter)
|
||||||
return GetFontCacheSubSetting(size)->aa;
|
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);
|
FontCacheSubSetting *setting = GetFontCacheSubSetting(fontsize);
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
|
@ -901,7 +901,7 @@ public:
|
||||||
|
|
||||||
case GB_SHARED_ORDERS: {
|
case GB_SHARED_ORDERS: {
|
||||||
if (!VehicleClicked(vehgroup)) {
|
if (!VehicleClicked(vehgroup)) {
|
||||||
const Vehicle* v = vehgroup.vehicles_begin[0];
|
const Vehicle *v = vehgroup.vehicles_begin[0];
|
||||||
if (vindex == v->index) {
|
if (vindex == v->index) {
|
||||||
if (vehgroup.NumVehicles() == 1) {
|
if (vehgroup.NumVehicles() == 1) {
|
||||||
ShowVehicleViewWindow(v);
|
ShowVehicleViewWindow(v);
|
||||||
|
|
|
@ -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. */
|
/* On a large map with many industries, it may be faster to check an area. */
|
||||||
static const int dmax = 14;
|
static const int dmax = 14;
|
||||||
if (Industry::GetNumItems() > (size_t) (dmax * dmax * 2)) {
|
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);
|
TileArea tile_area = TileArea(tile, 1, 1).Expand(dmax);
|
||||||
for (TileIndex atile : tile_area) {
|
for (TileIndex atile : tile_area) {
|
||||||
if (GetTileType(atile) == MP_INDUSTRY) {
|
if (GetTileType(atile) == MP_INDUSTRY) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ protected:
|
||||||
SuperArray data; ///< array of arrays of items
|
SuperArray data; ///< array of arrays of items
|
||||||
|
|
||||||
/** return first sub-array with free space for new item */
|
/** return first sub-array with free space for new item */
|
||||||
inline SubArray& FirstFreeSubArray()
|
inline SubArray &FirstFreeSubArray()
|
||||||
{
|
{
|
||||||
uint super_size = data.Length();
|
uint super_size = data.Length();
|
||||||
if (super_size > 0) {
|
if (super_size > 0) {
|
||||||
|
|
|
@ -124,7 +124,7 @@ struct DumpTarget {
|
||||||
: m_indent(0)
|
: m_indent(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
static size_t& LastTypeId();
|
static size_t &LastTypeId();
|
||||||
std::string GetCurrentStructName();
|
std::string GetCurrentStructName();
|
||||||
bool FindKnownName(size_t type_id, const void *ptr, std::string &name);
|
bool FindKnownName(size_t type_id, const void *ptr, std::string &name);
|
||||||
|
|
||||||
|
|
|
@ -39,25 +39,25 @@ protected:
|
||||||
T *data;
|
T *data;
|
||||||
|
|
||||||
/** return reference to the array header (non-const) */
|
/** return reference to the array header (non-const) */
|
||||||
inline ArrayHeader& Hdr()
|
inline ArrayHeader &Hdr()
|
||||||
{
|
{
|
||||||
return *(ArrayHeader*)(((byte*)data) - HeaderSize);
|
return *(ArrayHeader*)(((byte*)data) - HeaderSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** return reference to the array header (const) */
|
/** return reference to the array header (const) */
|
||||||
inline const ArrayHeader& Hdr() const
|
inline const ArrayHeader &Hdr() const
|
||||||
{
|
{
|
||||||
return *(ArrayHeader*)(((byte*)data) - HeaderSize);
|
return *(ArrayHeader*)(((byte*)data) - HeaderSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** return reference to the block reference counter */
|
/** return reference to the block reference counter */
|
||||||
inline uint& RefCnt()
|
inline uint &RefCnt()
|
||||||
{
|
{
|
||||||
return Hdr().reference_count;
|
return Hdr().reference_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** return reference to number of used items */
|
/** return reference to number of used items */
|
||||||
inline uint& SizeRef()
|
inline uint &SizeRef()
|
||||||
{
|
{
|
||||||
return Hdr().items;
|
return Hdr().items;
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** non-const item search & removal */
|
/** non-const item search & removal */
|
||||||
Titem_& Pop(const Tkey &key)
|
Titem_ &Pop(const Tkey &key)
|
||||||
{
|
{
|
||||||
Titem_ *item = TryPop(key);
|
Titem_ *item = TryPop(key);
|
||||||
assert(item != nullptr);
|
assert(item != nullptr);
|
||||||
|
|
|
@ -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.
|
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_INFO mmioFOURCC('I', 'N', 'F', 'O')
|
||||||
#define FOURCC_fmt mmioFOURCC('f','m','t',' ')
|
#define FOURCC_fmt mmioFOURCC('f', 'm', 't', ' ')
|
||||||
#define FOURCC_data mmioFOURCC('d','a','t','a')
|
#define FOURCC_data mmioFOURCC('d', 'a', 't', 'a')
|
||||||
|
|
||||||
/** A DLS file. */
|
/** A DLS file. */
|
||||||
struct DLSFile {
|
struct DLSFile {
|
||||||
|
|
|
@ -377,7 +377,7 @@ static bool FixupMidiData(MidiFile &target)
|
||||||
while (cur_block < target.blocks.size()) {
|
while (cur_block < target.blocks.size()) {
|
||||||
MidiFile::DataBlock &block = target.blocks[cur_block];
|
MidiFile::DataBlock &block = target.blocks[cur_block];
|
||||||
MidiFile::TempoChange &tempo = target.tempos[cur_tempo];
|
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) {
|
if (block.ticktime <= next_tempo.ticktime) {
|
||||||
/* block is within the current tempo */
|
/* block is within the current tempo */
|
||||||
int64_t tickdiff = block.ticktime - last_ticktime;
|
int64_t tickdiff = block.ticktime - last_ticktime;
|
||||||
|
@ -792,12 +792,12 @@ struct MpsMachine {
|
||||||
|
|
||||||
/* Always reset percussion channel to program 0 */
|
/* Always reset percussion channel to program 0 */
|
||||||
this->target.blocks.push_back(MidiFile::DataBlock());
|
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
|
/* Technically should be an endless loop, but having
|
||||||
* a maximum (about 10 minutes) avoids getting stuck,
|
* a maximum (about 10 minutes) avoids getting stuck,
|
||||||
* in case of corrupted data. */
|
* 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());
|
this->target.blocks.push_back(MidiFile::DataBlock());
|
||||||
auto &block = this->target.blocks.back();
|
auto &block = this->target.blocks.back();
|
||||||
block.ticktime = tick;
|
block.ticktime = tick;
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // Wi
|
||||||
memcpy(&address, &ifo[j].iiAddress.Address, sizeof(sockaddr));
|
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;
|
((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));
|
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);
|
free(ifo);
|
||||||
|
@ -72,7 +72,7 @@ static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast)
|
||||||
if (ifa->ifa_broadaddr->sa_family != AF_INET) continue;
|
if (ifa->ifa_broadaddr->sa_family != AF_INET) continue;
|
||||||
|
|
||||||
NetworkAddress addr(ifa->ifa_broadaddr, sizeof(sockaddr));
|
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);
|
freeifaddrs(ifap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -537,7 +537,7 @@ CommandDataBuffer SanitizeCmdStrings(const CommandDataBuffer &data)
|
||||||
* @param cp Command packet to unpack.
|
* @param cp Command packet to unpack.
|
||||||
*/
|
*/
|
||||||
template <Commands Tcmd, size_t Tcb>
|
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);
|
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);
|
Command<Tcmd>::PostFromNet(cp->err_msg, std::get<Tcb>(_callback_tuple), cp->my_cmd, args);
|
||||||
|
|
|
@ -1097,7 +1097,7 @@ struct NetworkStartServerWindow : public Window {
|
||||||
case WID_NSS_PLAY_HEIGHTMAP:
|
case WID_NSS_PLAY_HEIGHTMAP:
|
||||||
if (!CheckServerName()) return;
|
if (!CheckServerName()) return;
|
||||||
_is_network_server = true;
|
_is_network_server = true;
|
||||||
ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD);
|
ShowSaveLoadDialog(FT_HEIGHTMAP, SLO_LOAD);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -403,7 +403,7 @@ struct NewGRFInspectWindow : Window {
|
||||||
* Helper function to draw the vehicle chain widget.
|
* Helper function to draw the vehicle chain widget.
|
||||||
* @param r The rectangle to draw within.
|
* @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());
|
const Vehicle *v = Vehicle::Get(this->GetFeatureIndex());
|
||||||
int total_width = 0;
|
int total_width = 0;
|
||||||
|
@ -444,7 +444,7 @@ struct NewGRFInspectWindow : Window {
|
||||||
* Helper function to draw the main panel widget.
|
* Helper function to draw the main panel widget.
|
||||||
* @param r The rectangle to draw within.
|
* @param r The rectangle to draw within.
|
||||||
*/
|
*/
|
||||||
void DrawMainPanelWidget(const Rect& r) const
|
void DrawMainPanelWidget(const Rect &r) const
|
||||||
{
|
{
|
||||||
uint index = this->GetFeatureIndex();
|
uint index = this->GetFeatureIndex();
|
||||||
const NIFeature *nif = GetFeature(this->window_number);
|
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);
|
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};
|
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);
|
DrawRectOutline(outline.Expand(1), PC_LIGHT_BLUE, 1, 1);
|
||||||
|
|
||||||
if (SpriteAlignerWindow::crosshair) {
|
if (SpriteAlignerWindow::crosshair) {
|
||||||
|
|
|
@ -227,7 +227,7 @@ RoadStopResolverObject::~RoadStopResolverObject()
|
||||||
delete this->town_scope;
|
delete this->town_scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
TownScopeResolver* RoadStopResolverObject::GetTown()
|
TownScopeResolver *RoadStopResolverObject::GetTown()
|
||||||
{
|
{
|
||||||
if (this->town_scope == nullptr) {
|
if (this->town_scope == nullptr) {
|
||||||
Town *t;
|
Town *t;
|
||||||
|
|
|
@ -81,7 +81,7 @@ struct RoadStopScopeResolver : public ScopeResolver {
|
||||||
uint8_t view; ///< Station axis.
|
uint8_t view; ///< Station axis.
|
||||||
RoadType roadtype; ///< Road type (used when no tile)
|
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)
|
: 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.
|
RoadStopScopeResolver roadstop_scope; ///< The stop scope resolver.
|
||||||
TownScopeResolver *town_scope; ///< The town scope resolver (created on the first call).
|
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();
|
~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) {
|
switch (scope) {
|
||||||
case VSG_SCOPE_SELF: return &this->roadstop_scope;
|
case VSG_SCOPE_SELF: return &this->roadstop_scope;
|
||||||
|
|
|
@ -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;
|
return range.high < value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ void InitGRFTownGeneratorNames()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<StringID>& GetGRFTownNameList()
|
const std::vector<StringID> &GetGRFTownNameList()
|
||||||
{
|
{
|
||||||
return _grf_townname_names;
|
return _grf_townname_names;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,6 @@ uint32_t GetGRFTownNameId(uint16_t gen);
|
||||||
uint16_t GetGRFTownNameType(uint16_t gen);
|
uint16_t GetGRFTownNameType(uint16_t gen);
|
||||||
StringID GetGRFTownNameName(uint16_t gen);
|
StringID GetGRFTownNameName(uint16_t gen);
|
||||||
|
|
||||||
const std::vector<StringID>& GetGRFTownNameList();
|
const std::vector<StringID> &GetGRFTownNameList();
|
||||||
|
|
||||||
#endif /* NEWGRF_TOWNNAME_H */
|
#endif /* NEWGRF_TOWNNAME_H */
|
||||||
|
|
|
@ -210,7 +210,7 @@ static WindowDesc _small_news_desc(__FILE__, __LINE__,
|
||||||
/**
|
/**
|
||||||
* Window layouts for news items.
|
* Window layouts for news items.
|
||||||
*/
|
*/
|
||||||
static WindowDesc* _news_window_layout[] = {
|
static WindowDesc *_news_window_layout[] = {
|
||||||
&_thin_news_desc, ///< NF_THIN
|
&_thin_news_desc, ///< NF_THIN
|
||||||
&_small_news_desc, ///< NF_SMALL
|
&_small_news_desc, ///< NF_SMALL
|
||||||
&_normal_news_desc, ///< NF_NORMAL
|
&_normal_news_desc, ///< NF_NORMAL
|
||||||
|
@ -218,7 +218,7 @@ static WindowDesc* _news_window_layout[] = {
|
||||||
&_company_news_desc, ///< NF_COMPANY
|
&_company_news_desc, ///< NF_COMPANY
|
||||||
};
|
};
|
||||||
|
|
||||||
WindowDesc* GetNewsWindowLayout(NewsFlag flags)
|
WindowDesc *GetNewsWindowLayout(NewsFlag flags)
|
||||||
{
|
{
|
||||||
uint layout = GB(flags, NFB_WINDOW_LAYOUT, NFB_WINDOW_LAYOUT_COUNT);
|
uint layout = GB(flags, NFB_WINDOW_LAYOUT, NFB_WINDOW_LAYOUT_COUNT);
|
||||||
assert(layout < lengthof(_news_window_layout));
|
assert(layout < lengthof(_news_window_layout));
|
||||||
|
|
|
@ -70,7 +70,7 @@ class CrashLogOSX : public CrashLog {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_UNOFFICIAL_BREAKPAD
|
#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);
|
CrashLogOSX *crashlog = reinterpret_cast<CrashLogOSX *>(context);
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
typedef const struct __CTRunDelegate * CTRunDelegateRef;
|
typedef const struct __CTRunDelegate * CTRunDelegateRef;
|
||||||
|
|
||||||
typedef void (*CTRunDelegateDeallocateCallback) (void* refCon);
|
typedef void (*CTRunDelegateDeallocateCallback) (void *refCon);
|
||||||
typedef CGFloat (*CTRunDelegateGetAscentCallback) (void* refCon);
|
typedef CGFloat (*CTRunDelegateGetAscentCallback) (void *refCon);
|
||||||
typedef CGFloat (*CTRunDelegateGetDescentCallback) (void* refCon);
|
typedef CGFloat (*CTRunDelegateGetDescentCallback) (void *refCon);
|
||||||
typedef CGFloat (*CTRunDelegateGetWidthCallback) (void* refCon);
|
typedef CGFloat (*CTRunDelegateGetWidthCallback) (void *refCon);
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CFIndex version;
|
CFIndex version;
|
||||||
CTRunDelegateDeallocateCallback dealloc;
|
CTRunDelegateDeallocateCallback dealloc;
|
||||||
|
@ -43,7 +43,7 @@ extern "C" {
|
||||||
|
|
||||||
extern const CFStringRef kCTRunDelegateAttributeName AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
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 */
|
#endif /* HAVE_OSX_109_SDK */
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class CoreTextParagraphLayout : public ParagraphLayouter {
|
||||||
private:
|
private:
|
||||||
const CoreTextParagraphLayoutFactory::CharType *text_buffer;
|
const CoreTextParagraphLayoutFactory::CharType *text_buffer;
|
||||||
ptrdiff_t length;
|
ptrdiff_t length;
|
||||||
const FontMap& font_map;
|
const FontMap &font_map;
|
||||||
|
|
||||||
CFAutoRelease<CTTypesetterRef> typesetter;
|
CFAutoRelease<CTTypesetterRef> typesetter;
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ class CrashLogUnix : public CrashLog {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_UNOFFICIAL_BREAKPAD
|
#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);
|
CrashLogUnix *crashlog = reinterpret_cast<CrashLogUnix *>(context);
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** remove and return the open node specified by a key */
|
/** 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);
|
Titem_ &item = m_open.Pop(key);
|
||||||
uint idxPop = m_open_queue.FindIndex(item);
|
uint idxPop = m_open_queue.FindIndex(item);
|
||||||
|
@ -145,7 +145,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get a particular item. */
|
/** Get a particular item. */
|
||||||
inline Titem_& ItemAt(int idx)
|
inline Titem_ &ItemAt(int idx)
|
||||||
{
|
{
|
||||||
return m_arr[idx];
|
return m_arr[idx];
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,14 +87,14 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** return current settings (can be custom - company based - but later) */
|
/** return current settings (can be custom - company based - but later) */
|
||||||
inline const YAPFSettings& PfGetSettings() const
|
inline const YAPFSettings &PfGetSettings() const
|
||||||
{
|
{
|
||||||
return *m_settings;
|
return *m_settings;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ public:
|
||||||
* Calls NodeList::CreateNewNode() - allocates new node that can be filled and used
|
* Calls NodeList::CreateNewNode() - allocates new node that can be filled and used
|
||||||
* as argument for AddStartupNode() or AddNewNode()
|
* as argument for AddStartupNode() or AddNewNode()
|
||||||
*/
|
*/
|
||||||
inline Node& CreateNewNode()
|
inline Node &CreateNewNode()
|
||||||
{
|
{
|
||||||
Node &node = *m_nodes.CreateNewNode();
|
Node &node = *m_nodes.CreateNewNode();
|
||||||
return node;
|
return node;
|
||||||
|
|
|
@ -24,7 +24,7 @@ protected:
|
||||||
TrackdirBits m_orgTrackdirs; ///< origin trackdir mask
|
TrackdirBits m_orgTrackdirs; ///< origin trackdir mask
|
||||||
|
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
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
|
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 */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
Tpf& Yapf()
|
Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ protected:
|
||||||
LocalCache m_local_cache;
|
LocalCache m_local_cache;
|
||||||
|
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ struct CSegmentCostCacheT : public CSegmentCostCacheBase {
|
||||||
m_heap.Clear();
|
m_heap.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Tsegment& Get(Key &key, bool *found)
|
inline Tsegment &Get(Key &key, bool *found)
|
||||||
{
|
{
|
||||||
Tsegment *item = m_map.Find(key);
|
Tsegment *item = m_map.Find(key);
|
||||||
if (item == nullptr) {
|
if (item == nullptr) {
|
||||||
|
@ -174,12 +174,12 @@ protected:
|
||||||
inline CYapfSegmentCostCacheGlobalT() : m_global_cache(stGetGlobalCache()) {};
|
inline CYapfSegmentCostCacheGlobalT() : m_global_cache(stGetGlobalCache()) {};
|
||||||
|
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static Cache& stGetGlobalCache()
|
inline static Cache &stGetGlobalCache()
|
||||||
{
|
{
|
||||||
static int last_rail_change_counter = 0;
|
static int last_rail_change_counter = 0;
|
||||||
static Cache C;
|
static Cache C;
|
||||||
|
|
|
@ -77,7 +77,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
Tpf& Yapf()
|
Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
typedef typename Node::Key Key; ///< key to hash tables
|
typedef typename Node::Key Key; ///< key to hash tables
|
||||||
|
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
Tpf& Yapf()
|
Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public:
|
||||||
typedef typename Types::TrackFollower TrackFollower; ///< TrackFollower. Need to typedef for gcc 2.95
|
typedef typename Types::TrackFollower TrackFollower; ///< TrackFollower. Need to typedef for gcc 2.95
|
||||||
|
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
Tpf& Yapf()
|
Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ protected:
|
||||||
bool m_any_depot;
|
bool m_any_depot;
|
||||||
|
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
Tpf& Yapf()
|
Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ struct CYapfNodeT {
|
||||||
return m_key.m_td;
|
return m_key.m_td;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Tkey_& GetKey() const
|
inline const Tkey_ &GetKey() const
|
||||||
{
|
{
|
||||||
return m_key;
|
return m_key;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ struct CYapfRailSegment
|
||||||
, m_hash_next(nullptr)
|
, m_hash_next(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
inline const Key& GetKey() const
|
inline const Key &GetKey() const
|
||||||
{
|
{
|
||||||
return m_key;
|
return m_key;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** to access inherited pathfinder */
|
/** to access inherited pathfinder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ protected:
|
||||||
CYapfCostRoadT() : m_max_cost(0) {};
|
CYapfCostRoadT() : m_max_cost(0) {};
|
||||||
|
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
Tpf& Yapf()
|
Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ public:
|
||||||
typedef typename Node::Key Key; ///< key to hash tables
|
typedef typename Node::Key Key; ///< key to hash tables
|
||||||
|
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
Tpf& Yapf()
|
Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
Tpf& Yapf()
|
Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,14 +47,14 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf*>(this);
|
return *static_cast<Tpf*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Called by YAPF to detect if node ends in the desired destination */
|
/** 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);
|
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
|
* 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
|
* 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_x_offs[] = {-1, 0, 1, 0};
|
||||||
static const int dg_dir_to_y_offs[] = {0, 1, 0, -1};
|
static const int dg_dir_to_y_offs[] = {0, 1, 0, -1};
|
||||||
|
@ -111,7 +111,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
Tpf& Yapf()
|
Tpf &Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
return *static_cast<Tpf *>(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1404,7 +1404,7 @@ void DrawRoadTypeCatenary(const TileInfo *ti, RoadType rt, RoadBits rb)
|
||||||
if (CountBits(rb_new) >= 2) rb = rb_new;
|
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 front = GetCustomRoadSprite(rti, ti->tile, ROTSG_CATENARY_FRONT);
|
||||||
SpriteID back = GetCustomRoadSprite(rti, ti->tile, ROTSG_CATENARY_BACK);
|
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);
|
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);
|
int relocation = GetCustomRoadSprite(rti, INVALID_TILE, ROTSG_DEPOT);
|
||||||
bool default_gfx = relocation == 0;
|
bool default_gfx = relocation == 0;
|
||||||
if (default_gfx) {
|
if (default_gfx) {
|
||||||
|
|
|
@ -755,7 +755,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
*/
|
*/
|
||||||
static EventState RoadTramToolbarGlobalHotkeys(int hotkey, RoadType last_build, RoadTramType rtt)
|
static EventState RoadTramToolbarGlobalHotkeys(int hotkey, RoadType last_build, RoadTramType rtt)
|
||||||
{
|
{
|
||||||
Window* w = nullptr;
|
Window *w = nullptr;
|
||||||
switch (_game_mode) {
|
switch (_game_mode) {
|
||||||
case GM_NORMAL:
|
case GM_NORMAL:
|
||||||
w = ShowBuildRoadToolbar(last_build);
|
w = ShowBuildRoadToolbar(last_build);
|
||||||
|
|
|
@ -1242,7 +1242,7 @@ bool AfterLoadGame()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Vehicle* v : Vehicle::Iterate()) {
|
for (Vehicle *v : Vehicle::Iterate()) {
|
||||||
if (!v->IsGroundVehicle()) continue;
|
if (!v->IsGroundVehicle()) continue;
|
||||||
if (IsBridgeTile(v->tile)) {
|
if (IsBridgeTile(v->tile)) {
|
||||||
DiagDirection dir = GetTunnelBridgeDirection(v->tile);
|
DiagDirection dir = GetTunnelBridgeDirection(v->tile);
|
||||||
|
@ -2397,7 +2397,7 @@ bool AfterLoadGame()
|
||||||
* 'default' names, after that we can assign the names. */
|
* 'default' names, after that we can assign the names. */
|
||||||
for (Depot *d : Depot::Iterate()) d->town_cn = UINT16_MAX;
|
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)) {
|
if (IsSavegameVersionBefore(SLV_142)) {
|
||||||
|
@ -2482,7 +2482,7 @@ bool AfterLoadGame()
|
||||||
if (!wp->name.empty()) wp->town_cn = UINT16_MAX;
|
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 (!wp->name.empty()) MakeDefaultName(wp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ static std::vector<Engine*> _temp_engine;
|
||||||
* The allocated Engine must be freed using FreeEngine;
|
* The allocated Engine must be freed using FreeEngine;
|
||||||
* @return Allocated engine.
|
* @return Allocated engine.
|
||||||
*/
|
*/
|
||||||
static Engine* CallocEngine()
|
static Engine *CallocEngine()
|
||||||
{
|
{
|
||||||
uint8_t *zero = CallocT<uint8_t>(sizeof(Engine));
|
uint8_t *zero = CallocT<uint8_t>(sizeof(Engine));
|
||||||
Engine *engine = new (zero) Engine();
|
Engine *engine = new (zero) Engine();
|
||||||
|
|
|
@ -86,7 +86,7 @@ void MoveWaypointsToBaseStations()
|
||||||
/* As of version 17, we recalculate the custom graphic ID of waypoints
|
/* As of version 17, we recalculate the custom graphic ID of waypoints
|
||||||
* from the GRF ID / station index. */
|
* from the GRF ID / station index. */
|
||||||
for (OldWaypoint &wp : _old_waypoints) {
|
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++) {
|
for (uint i = 0; i < stclass->GetSpecCount(); i++) {
|
||||||
const StationSpec *statspec = stclass->GetSpec(i);
|
const StationSpec *statspec = stclass->GetSpec(i);
|
||||||
if (statspec != nullptr && statspec->grf_prop.grffile->grfid == wp.grfid && statspec->grf_prop.local_id == wp.localidx) {
|
if (statspec != nullptr && statspec->grf_prop.grffile->grfid == wp.grfid && statspec->grf_prop.local_id == wp.localidx) {
|
||||||
|
|
|
@ -87,10 +87,10 @@ static void ShowCustCurrency();
|
||||||
/** Window for displaying the textfile of a BaseSet. */
|
/** Window for displaying the textfile of a BaseSet. */
|
||||||
template <class TBaseSet>
|
template <class TBaseSet>
|
||||||
struct BaseSetTextfileWindow : public TextfileWindow {
|
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.
|
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);
|
auto textfile = this->baseset->GetTextfile(file_type);
|
||||||
this->LoadTextfile(textfile.value(), BASESET_DIR);
|
this->LoadTextfile(textfile.value(), BASESET_DIR);
|
||||||
|
@ -112,7 +112,7 @@ struct BaseSetTextfileWindow : public TextfileWindow {
|
||||||
* @param content_type STR_CONTENT_TYPE_xxx for title.
|
* @param content_type STR_CONTENT_TYPE_xxx for title.
|
||||||
*/
|
*/
|
||||||
template <class TBaseSet>
|
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);
|
CloseWindowById(WC_TEXTFILE, file_type);
|
||||||
new BaseSetTextfileWindow<TBaseSet>(file_type, baseset, content_type);
|
new BaseSetTextfileWindow<TBaseSet>(file_type, baseset, content_type);
|
||||||
|
@ -688,7 +688,7 @@ struct GameOptionsWindow : Window {
|
||||||
case WID_GO_BASE_GRF_DROPDOWN:
|
case WID_GO_BASE_GRF_DROPDOWN:
|
||||||
if (_game_mode == GM_MENU) {
|
if (_game_mode == GM_MENU) {
|
||||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||||
auto* set = BaseGraphics::GetSet(index);
|
auto set = BaseGraphics::GetSet(index);
|
||||||
BaseGraphics::SetSet(set);
|
BaseGraphics::SetSet(set);
|
||||||
this->reload = true;
|
this->reload = true;
|
||||||
this->InvalidateData();
|
this->InvalidateData();
|
||||||
|
@ -697,7 +697,7 @@ struct GameOptionsWindow : Window {
|
||||||
|
|
||||||
case WID_GO_BASE_SFX_DROPDOWN:
|
case WID_GO_BASE_SFX_DROPDOWN:
|
||||||
if (_game_mode == GM_MENU) {
|
if (_game_mode == GM_MENU) {
|
||||||
auto* set = BaseSounds::GetSet(index);
|
auto set = BaseSounds::GetSet(index);
|
||||||
BaseSounds::ini_set = set->name;
|
BaseSounds::ini_set = set->name;
|
||||||
BaseSounds::SetSet(set);
|
BaseSounds::SetSet(set);
|
||||||
this->reload = true;
|
this->reload = true;
|
||||||
|
|
|
@ -96,7 +96,7 @@ public:
|
||||||
|
|
||||||
/* If sort parameters are used then we require a reference to the params. */
|
/* 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>
|
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 ¶ms) :
|
||||||
sort_func_list(nullptr),
|
sort_func_list(nullptr),
|
||||||
filter_func_list(nullptr),
|
filter_func_list(nullptr),
|
||||||
flags(VL_NONE),
|
flags(VL_NONE),
|
||||||
|
|
|
@ -36,7 +36,7 @@ using Microsoft::WRL::ComPtr;
|
||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
|
|
||||||
// Definition of the "XAudio2Create" call used to initialise XAudio2
|
// 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;
|
static FSoundDriver_XAudio2 iFSoundDriver_XAudio2;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ private:
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IXAudio2SourceVoice* SourceVoice;
|
IXAudio2SourceVoice *SourceVoice;
|
||||||
|
|
||||||
StreamingVoiceContext(int bufferLength)
|
StreamingVoiceContext(int bufferLength)
|
||||||
{
|
{
|
||||||
|
@ -112,10 +112,10 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
static HMODULE _xaudio_dll_handle;
|
static HMODULE _xaudio_dll_handle;
|
||||||
static IXAudio2SourceVoice* _source_voice = nullptr;
|
static IXAudio2SourceVoice *_source_voice = nullptr;
|
||||||
static IXAudio2MasteringVoice* _mastering_voice = nullptr;
|
static IXAudio2MasteringVoice *_mastering_voice = nullptr;
|
||||||
static ComPtr<IXAudio2> _xaudio2;
|
static ComPtr<IXAudio2> _xaudio2;
|
||||||
static StreamingVoiceContext* _voice_context = nullptr;
|
static StreamingVoiceContext *_voice_context = nullptr;
|
||||||
|
|
||||||
/** Create XAudio2 context with SEH exception checking. */
|
/** Create XAudio2 context with SEH exception checking. */
|
||||||
static HRESULT CreateXAudio(API_XAudio2Create xAudio2Create)
|
static HRESULT CreateXAudio(API_XAudio2Create xAudio2Create)
|
||||||
|
|
|
@ -3164,8 +3164,8 @@ draw_default_foundation:
|
||||||
if (IsRoadStop(ti->tile)) {
|
if (IsRoadStop(ti->tile)) {
|
||||||
RoadType road_rt = GetRoadTypeRoad(ti->tile);
|
RoadType road_rt = GetRoadTypeRoad(ti->tile);
|
||||||
RoadType tram_rt = GetRoadTypeTram(ti->tile);
|
RoadType tram_rt = GetRoadTypeTram(ti->tile);
|
||||||
const RoadTypeInfo* road_rti = road_rt == INVALID_ROADTYPE ? nullptr : GetRoadTypeInfo(road_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);
|
const RoadTypeInfo *tram_rti = tram_rt == INVALID_ROADTYPE ? nullptr : GetRoadTypeInfo(tram_rt);
|
||||||
|
|
||||||
Axis axis = GetRoadStopDir(ti->tile) == DIAGDIR_NE ? AXIS_X : AXIS_Y;
|
Axis axis = GetRoadStopDir(ti->tile) == DIAGDIR_NE ? AXIS_X : AXIS_Y;
|
||||||
DiagDirection dir = GetRoadStopDir(ti->tile);
|
DiagDirection dir = GetRoadStopDir(ti->tile);
|
||||||
|
|
|
@ -534,7 +534,7 @@ protected:
|
||||||
* Internal event handler for when a page element is clicked.
|
* Internal event handler for when a page element is clicked.
|
||||||
* @param pe The clicked page element.
|
* @param pe The clicked page element.
|
||||||
*/
|
*/
|
||||||
void OnPageElementClick(const StoryPageElement& pe)
|
void OnPageElementClick(const StoryPageElement &pe)
|
||||||
{
|
{
|
||||||
switch (pe.type) {
|
switch (pe.type) {
|
||||||
case SPET_TEXT:
|
case SPET_TEXT:
|
||||||
|
|
|
@ -225,7 +225,7 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayStringParameters(const ArrayStringParameters& other) = delete;
|
ArrayStringParameters(const ArrayStringParameters &other) = delete;
|
||||||
ArrayStringParameters& operator=(const ArrayStringParameters &other) = delete;
|
ArrayStringParameters& operator=(const ArrayStringParameters &other) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ inline bool StartNewThread(std::thread *thr, const char *name, TFn&& _Fx, TArgs&
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
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. */
|
/* Something went wrong, the system we are running on might not support threads. */
|
||||||
Debug(misc, 1, "Can't create thread '{}': {}", name, e.what());
|
Debug(misc, 1, "Can't create thread '{}': {}", name, e.what());
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
* Get the total covered area.
|
* Get the total covered area.
|
||||||
* @return The area covered by the matrix.
|
* @return The area covered by the matrix.
|
||||||
*/
|
*/
|
||||||
const TileArea& GetArea() const
|
const TileArea &GetArea() const
|
||||||
{
|
{
|
||||||
return this->area;
|
return this->area;
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,8 +370,8 @@ static CallBackFunction MenuClickSaveLoad(int index = 0)
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case SLEME_SAVE_SCENARIO: ShowSaveLoadDialog(FT_SCENARIO, SLO_SAVE); break;
|
case SLEME_SAVE_SCENARIO: ShowSaveLoadDialog(FT_SCENARIO, SLO_SAVE); break;
|
||||||
case SLEME_LOAD_SCENARIO: ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD); break;
|
case SLEME_LOAD_SCENARIO: ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD); break;
|
||||||
case SLEME_SAVE_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_SAVE); break;
|
case SLEME_SAVE_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP, SLO_SAVE); break;
|
||||||
case SLEME_LOAD_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD); break;
|
case SLEME_LOAD_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP, SLO_LOAD); break;
|
||||||
case SLEME_EXIT_TOINTRO: AskExitToGameMenu(); break;
|
case SLEME_EXIT_TOINTRO: AskExitToGameMenu(); break;
|
||||||
case SLEME_EXIT_GAME: HandleExitGameRequest(); break;
|
case SLEME_EXIT_GAME: HandleExitGameRequest(); break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3045,7 +3045,7 @@ uint32_t Vehicle::GetDisplayMaxWeight() const
|
||||||
{
|
{
|
||||||
uint32_t max_weight = 0;
|
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();
|
max_weight += u->GetMaxWeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1017,8 +1017,8 @@ public:
|
||||||
*/
|
*/
|
||||||
struct OrderIterator {
|
struct OrderIterator {
|
||||||
typedef Order value_type;
|
typedef Order value_type;
|
||||||
typedef Order* pointer;
|
typedef Order *pointer;
|
||||||
typedef Order& reference;
|
typedef Order &reference;
|
||||||
typedef size_t difference_type;
|
typedef size_t difference_type;
|
||||||
typedef std::forward_iterator_tag iterator_category;
|
typedef std::forward_iterator_tag iterator_category;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ protected:
|
||||||
void *GetVideoPointer() override;
|
void *GetVideoPointer() override;
|
||||||
void ReleaseVideoPointer() override;
|
void ReleaseVideoPointer() override;
|
||||||
|
|
||||||
NSView* AllocateDrawView() override;
|
NSView *AllocateDrawView() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FVideoDriver_CocoaOpenGL : public DriverFactoryBase {
|
class FVideoDriver_CocoaOpenGL : public DriverFactoryBase {
|
||||||
|
|
|
@ -78,7 +78,7 @@ protected:
|
||||||
|
|
||||||
bool MakeWindow(int width, int height);
|
bool MakeWindow(int width, int height);
|
||||||
|
|
||||||
virtual NSView* AllocateDrawView() = 0;
|
virtual NSView *AllocateDrawView() = 0;
|
||||||
|
|
||||||
/** Get a pointer to the video buffer. */
|
/** Get a pointer to the video buffer. */
|
||||||
virtual void *GetVideoPointer() = 0;
|
virtual void *GetVideoPointer() = 0;
|
||||||
|
@ -121,7 +121,7 @@ protected:
|
||||||
void Paint() override;
|
void Paint() override;
|
||||||
void CheckPaletteAnim() override;
|
void CheckPaletteAnim() override;
|
||||||
|
|
||||||
NSView* AllocateDrawView() override;
|
NSView *AllocateDrawView() override;
|
||||||
|
|
||||||
void *GetVideoPointer() override { return this->buffer_depth == 8 ? this->pixel_buffer : this->window_buffer; }
|
void *GetVideoPointer() override { return this->buffer_depth == 8 ? this->pixel_buffer : this->window_buffer; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -400,7 +400,7 @@ bool VideoDriver_Cocoa::MakeWindow(int width, int height)
|
||||||
behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
|
behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
|
||||||
[ this->window setCollectionBehavior:behavior ];
|
[ this->window setCollectionBehavior:behavior ];
|
||||||
|
|
||||||
NSButton* fullscreenButton = [ this->window standardWindowButton:NSWindowZoomButton ];
|
NSButton *fullscreenButton = [ this->window standardWindowButton:NSWindowZoomButton ];
|
||||||
[ fullscreenButton setAction:@selector(toggleFullScreen:) ];
|
[ fullscreenButton setAction:@selector(toggleFullScreen:) ];
|
||||||
[ fullscreenButton setTarget:this->window ];
|
[ fullscreenButton setTarget:this->window ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,12 +117,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Natural sorting comparator function for DropDownList::sort().
|
* Natural sorting comparator function for DropDownList::sort().
|
||||||
* @param first Left side of comparison.
|
* @param first Left side of comparison.
|
||||||
* @param second Right side of comparison.
|
* @param second Right side of comparison.
|
||||||
* @return true if \a first precedes \a second.
|
* @return true if \a first precedes \a second.
|
||||||
* @warning All items in the list need to be derivates of DropDownListStringItem.
|
* @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)
|
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 &str1 = static_cast<const DropDownString*>(first.get())->string;
|
||||||
|
|
|
@ -166,7 +166,7 @@ void WindowDesc::LoadFromConfig()
|
||||||
/**
|
/**
|
||||||
* Sort WindowDesc by ini_key.
|
* 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;
|
if (a->ini_key != nullptr && b->ini_key != nullptr) return strcmp(a->ini_key, b->ini_key) < 0;
|
||||||
return a->ini_key != nullptr;
|
return a->ini_key != nullptr;
|
||||||
|
|
Loading…
Reference in New Issue