mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Ensure function opening `{` is on new line.
This commit is contained in:
parent
1de1af08b9
commit
d4008850e3
|
@ -18,11 +18,13 @@ struct fmt::formatter<E, Char, std::enable_if_t<std::is_enum<E>::value>> : fmt::
|
|||
using underlying_type = typename std::underlying_type<E>::type;
|
||||
using parent = typename fmt::formatter<underlying_type>;
|
||||
|
||||
constexpr fmt::format_parse_context::iterator parse(fmt::format_parse_context &ctx) {
|
||||
constexpr fmt::format_parse_context::iterator parse(fmt::format_parse_context &ctx)
|
||||
{
|
||||
return parent::parse(ctx);
|
||||
}
|
||||
|
||||
fmt::format_context::iterator format(const E &e, format_context &ctx) const {
|
||||
fmt::format_context::iterator format(const E &e, format_context &ctx) const
|
||||
{
|
||||
return parent::format(underlying_type(e), ctx);
|
||||
}
|
||||
};
|
||||
|
@ -32,11 +34,13 @@ struct fmt::formatter<T, Char, std::enable_if_t<std::is_base_of<StrongTypedefBas
|
|||
using underlying_type = typename T::BaseType;
|
||||
using parent = typename fmt::formatter<underlying_type>;
|
||||
|
||||
constexpr fmt::format_parse_context::iterator parse(fmt::format_parse_context &ctx) {
|
||||
constexpr fmt::format_parse_context::iterator parse(fmt::format_parse_context &ctx)
|
||||
{
|
||||
return parent::parse(ctx);
|
||||
}
|
||||
|
||||
fmt::format_context::iterator format(const T &t, format_context &ctx) const {
|
||||
fmt::format_context::iterator format(const T &t, format_context &ctx) const
|
||||
{
|
||||
return parent::format(t.base(), ctx);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -444,7 +444,8 @@ void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel
|
|||
* Close active error message window
|
||||
* @return true if a window was closed.
|
||||
*/
|
||||
bool HideActiveErrorMessage() {
|
||||
bool HideActiveErrorMessage()
|
||||
{
|
||||
ErrmsgWindow *w = (ErrmsgWindow*)FindWindowById(WC_ERRMSG, 0);
|
||||
if (w == nullptr) return false;
|
||||
w->Close();
|
||||
|
|
|
@ -154,7 +154,8 @@ ICUParagraphLayout::ICUVisualRun::ICUVisualRun(const ICURun &run, int x) :
|
|||
* @param buff The buffer of which a partial (depending on start/length of the run) will be shaped.
|
||||
* @param length The length of the buffer.
|
||||
*/
|
||||
void ICURun::Shape(UChar *buff, size_t buff_length) {
|
||||
void ICURun::Shape(UChar *buff, size_t buff_length)
|
||||
{
|
||||
auto hbfont = hb_ft_font_create_referenced(*(static_cast<const FT_Face *>(font->fc->GetOSHandle())));
|
||||
hb_font_set_scale(hbfont, this->font->fc->GetFontSize() * FONT_SCALE, this->font->fc->GetFontSize() * FONT_SCALE);
|
||||
|
||||
|
|
|
@ -569,7 +569,8 @@ LinkGraphLegendWindow::LinkGraphLegendWindow(WindowDesc *desc, int window_number
|
|||
* Set the overlay belonging to this menu and import its company/cargo settings.
|
||||
* @param overlay New overlay for this menu.
|
||||
*/
|
||||
void LinkGraphLegendWindow::SetOverlay(std::shared_ptr<LinkGraphOverlay> overlay) {
|
||||
void LinkGraphLegendWindow::SetOverlay(std::shared_ptr<LinkGraphOverlay> overlay)
|
||||
{
|
||||
this->overlay = overlay;
|
||||
CompanyMask companies = this->overlay->GetCompanyMask();
|
||||
for (uint c = 0; c < MAX_COMPANIES; c++) {
|
||||
|
|
|
@ -72,7 +72,8 @@ public:
|
|||
private:
|
||||
/** Helper function to write a tuple to the buffer. */
|
||||
template<class Ttuple, size_t... Tindices>
|
||||
void WriteTuple(const Ttuple &values, std::index_sequence<Tindices...>) {
|
||||
void WriteTuple(const Ttuple &values, std::index_sequence<Tindices...>)
|
||||
{
|
||||
((*this << std::get<Tindices>(values)), ...);
|
||||
}
|
||||
|
||||
|
@ -165,7 +166,8 @@ public:
|
|||
private:
|
||||
/** Helper function to read a tuple from the buffer. */
|
||||
template<class Ttuple, size_t... Tindices>
|
||||
void ReadTuple(Ttuple &values, std::index_sequence<Tindices...>) {
|
||||
void ReadTuple(Ttuple &values, std::index_sequence<Tindices...>)
|
||||
{
|
||||
((*this >> std::get<Tindices>(values)), ...);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,8 @@ struct DLSFile {
|
|||
WSMPL wave_sample;
|
||||
std::vector<WLOOP> wave_loops;
|
||||
|
||||
bool operator ==(long offset) const {
|
||||
bool operator ==(long offset) const
|
||||
{
|
||||
return this->file_offset == offset;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -43,7 +43,8 @@ public:
|
|||
/**
|
||||
* Get the currently active instance of the music driver.
|
||||
*/
|
||||
static MusicDriver *GetInstance() {
|
||||
static MusicDriver *GetInstance()
|
||||
{
|
||||
return static_cast<MusicDriver*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_MUSIC));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1043,7 +1043,8 @@ static void ShowNewsMessage(const NewsItem *ni)
|
|||
* Close active news message window
|
||||
* @return true if a window was closed.
|
||||
*/
|
||||
bool HideActiveNewsMessage() {
|
||||
bool HideActiveNewsMessage()
|
||||
{
|
||||
NewsWindow *w = (NewsWindow*)FindWindowById(WC_NEWS_WINDOW, 0);
|
||||
if (w == nullptr) return false;
|
||||
w->Close();
|
||||
|
|
|
@ -251,7 +251,8 @@ void OSOpenBrowser(const char *url)
|
|||
}
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
void SetCurrentThreadName([[maybe_unused]] const char *threadName) {
|
||||
void SetCurrentThreadName([[maybe_unused]] const char *threadName)
|
||||
{
|
||||
#if defined(__GLIBC__)
|
||||
if (threadName) pthread_setname_np(pthread_self(), threadName);
|
||||
#endif /* defined(__GLIBC__) */
|
||||
|
|
|
@ -38,7 +38,8 @@ struct EFCParam {
|
|||
MissingGlyphSearcher *callback;
|
||||
std::vector<std::wstring> fonts;
|
||||
|
||||
bool Add(const std::wstring_view &font) {
|
||||
bool Add(const std::wstring_view &font)
|
||||
{
|
||||
for (const auto &entry : this->fonts) {
|
||||
if (font.compare(entry) == 0) return false;
|
||||
}
|
||||
|
|
|
@ -1395,7 +1395,8 @@ public:
|
|||
/**
|
||||
* Simply to have a easier way to get the StationType for bus, truck and trams from the WindowClass.
|
||||
*/
|
||||
StationType GetRoadStationTypeByWindowClass(WindowClass window_class) const {
|
||||
StationType GetRoadStationTypeByWindowClass(WindowClass window_class) const
|
||||
{
|
||||
switch (window_class) {
|
||||
case WC_BUS_STATION: return STATION_BUS;
|
||||
case WC_TRUCK_STATION: return STATION_TRUCK;
|
||||
|
@ -1475,13 +1476,15 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void OnResize() override {
|
||||
void OnResize() override
|
||||
{
|
||||
if (this->vscrollList != nullptr) {
|
||||
this->vscrollList->SetCapacityFromWidget(this, WID_BROS_NEWST_LIST);
|
||||
}
|
||||
}
|
||||
|
||||
void SetStringParameters(int widget) const override {
|
||||
void SetStringParameters(int widget) const override
|
||||
{
|
||||
if (widget == WID_BROS_SHOW_NEWST_TYPE) {
|
||||
const RoadStopSpec *roadstopspec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type);
|
||||
SetDParam(0, (roadstopspec != nullptr && roadstopspec->name != 0) ? roadstopspec->name : STR_STATION_CLASS_DFLT_ROADSTOP);
|
||||
|
|
|
@ -45,7 +45,8 @@ namespace SQConvert {
|
|||
template <> struct Return<HSQOBJECT> { static inline int Set(HSQUIRRELVM vm, HSQOBJECT res) { sq_pushobject(vm, res); return 1; } };
|
||||
|
||||
template <> struct Return<std::optional<std::string>> {
|
||||
static inline int Set(HSQUIRRELVM vm, std::optional<std::string> res) {
|
||||
static inline int Set(HSQUIRRELVM vm, std::optional<std::string> res)
|
||||
{
|
||||
if (res.has_value()) {
|
||||
sq_pushstring(vm, res.value(), -1);
|
||||
} else {
|
||||
|
|
|
@ -563,7 +563,8 @@ struct LinkGraphSettings {
|
|||
uint8_t demand_distance; ///< influence of distance between stations on the demand function
|
||||
uint8_t short_path_saturation; ///< percentage up to which short paths are saturated before saturating most capacious paths
|
||||
|
||||
inline DistributionType GetDistributionType(CargoID cargo) const {
|
||||
inline DistributionType GetDistributionType(CargoID cargo) const
|
||||
{
|
||||
if (IsCargoInClass(cargo, CC_PASSENGERS)) return this->distribution_pax;
|
||||
if (IsCargoInClass(cargo, CC_MAIL)) return this->distribution_mail;
|
||||
if (IsCargoInClass(cargo, CC_ARMOURED)) return this->distribution_armoured;
|
||||
|
|
|
@ -32,7 +32,8 @@ public:
|
|||
/**
|
||||
* Get the currently active instance of the sound driver.
|
||||
*/
|
||||
static SoundDriver *GetInstance() {
|
||||
static SoundDriver *GetInstance()
|
||||
{
|
||||
return static_cast<SoundDriver*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_SOUND));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -64,7 +64,8 @@ SpriteCache *AllocateSpriteCache(uint index)
|
|||
* @param filename The name of the file at the disk.
|
||||
* @return The SpriteFile or \c null.
|
||||
*/
|
||||
static SpriteFile *GetCachedSpriteFileByName(const std::string &filename) {
|
||||
static SpriteFile *GetCachedSpriteFileByName(const std::string &filename)
|
||||
{
|
||||
for (auto &f : _sprite_files) {
|
||||
if (f->GetFilename() == filename) {
|
||||
return f.get();
|
||||
|
|
|
@ -413,7 +413,8 @@ void Station::AddIndustryToDeliver(Industry *ind, TileIndex tile)
|
|||
* Remove nearby industry from station's industries_near list.
|
||||
* @param ind Industry
|
||||
*/
|
||||
void Station::RemoveIndustryToDeliver(Industry *ind) {
|
||||
void Station::RemoveIndustryToDeliver(Industry *ind)
|
||||
{
|
||||
auto pos = std::find_if(this->industries_near.begin(), this->industries_near.end(), [&](const IndustryListEntry &e) { return e.industry->index == ind->index; });
|
||||
if (pos != this->industries_near.end()) {
|
||||
this->industries_near.erase(pos);
|
||||
|
|
|
@ -38,7 +38,8 @@ public:
|
|||
*
|
||||
* @param timer The timer to register.
|
||||
*/
|
||||
static void RegisterTimer(BaseTimer<TTimerType> &timer) {
|
||||
static void RegisterTimer(BaseTimer<TTimerType> &timer)
|
||||
{
|
||||
#ifdef WITH_ASSERT
|
||||
Validate(timer.period);
|
||||
#endif /* WITH_ASSERT */
|
||||
|
@ -50,7 +51,8 @@ public:
|
|||
*
|
||||
* @param timer The timer to unregister.
|
||||
*/
|
||||
static void UnregisterTimer(BaseTimer<TTimerType> &timer) {
|
||||
static void UnregisterTimer(BaseTimer<TTimerType> &timer)
|
||||
{
|
||||
GetTimers().erase(&timer);
|
||||
}
|
||||
|
||||
|
@ -87,14 +89,16 @@ private:
|
|||
* same, it will sort based on the pointer value.
|
||||
*/
|
||||
struct base_timer_sorter {
|
||||
bool operator() (BaseTimer<TTimerType> *a, BaseTimer<TTimerType> *b) const {
|
||||
bool operator() (BaseTimer<TTimerType> *a, BaseTimer<TTimerType> *b) const
|
||||
{
|
||||
if (a->period == b->period) return a < b;
|
||||
return a->period < b->period;
|
||||
}
|
||||
};
|
||||
|
||||
/** Singleton list, to store all the active timers. */
|
||||
static std::set<BaseTimer<TTimerType> *, base_timer_sorter> &GetTimers() {
|
||||
static std::set<BaseTimer<TTimerType> *, base_timer_sorter> &GetTimers()
|
||||
{
|
||||
static std::set<BaseTimer<TTimerType> *, base_timer_sorter> timers;
|
||||
return timers;
|
||||
}
|
||||
|
|
|
@ -690,7 +690,8 @@ static const int LTMN_PERFORMANCE_LEAGUE = -7; ///< Show default league t
|
|||
static const int LTMN_PERFORMANCE_RATING = -8; ///< Show detailed performance rating
|
||||
static const int LTMN_HIGHSCORE = -9; ///< Show highscrore table
|
||||
|
||||
static void AddDropDownLeagueTableOptions(DropDownList &list) {
|
||||
static void AddDropDownLeagueTableOptions(DropDownList &list)
|
||||
{
|
||||
if (LeagueTable::GetNumItems() > 0) {
|
||||
for (LeagueTable *lt : LeagueTable::Iterate()) {
|
||||
list.push_back(std::make_unique<DropDownListStringItem>(lt->title, lt->index, false));
|
||||
|
|
|
@ -304,7 +304,8 @@ void MakeDefaultName(T *obj)
|
|||
* Converts original town ticks counters to plain game ticks. Note that
|
||||
* tick 0 is a valid tick so actual amount is one more than the counter value.
|
||||
*/
|
||||
static inline uint16_t TownTicksToGameTicks(uint16_t ticks) {
|
||||
static inline uint16_t TownTicksToGameTicks(uint16_t ticks)
|
||||
{
|
||||
return (std::min(ticks, MAX_TOWN_GROWTH_TICKS) + 1) * Ticks::TOWN_GROWTH_TICKS - 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,8 @@ public:
|
|||
/**
|
||||
* Get the currently active instance of the video driver.
|
||||
*/
|
||||
static VideoDriver *GetInstance() {
|
||||
static VideoDriver *GetInstance()
|
||||
{
|
||||
return static_cast<VideoDriver*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_VIDEO));
|
||||
}
|
||||
|
||||
|
@ -260,7 +261,8 @@ protected:
|
|||
* Make sure the video buffer is ready for drawing.
|
||||
* @returns True if the video buffer has to be unlocked.
|
||||
*/
|
||||
virtual bool LockVideoBuffer() {
|
||||
virtual bool LockVideoBuffer()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -434,7 +434,8 @@ bool RiverModifyDesertZone(TileIndex tile, void *)
|
|||
* Make a river tile and remove desert directly around it.
|
||||
* @param tile The tile to change into river and create non-desert around
|
||||
*/
|
||||
void MakeRiverAndModifyDesertZoneAround(TileIndex tile) {
|
||||
void MakeRiverAndModifyDesertZoneAround(TileIndex tile)
|
||||
{
|
||||
MakeRiver(tile, Random());
|
||||
MarkTileDirtyByTile(tile);
|
||||
|
||||
|
|
|
@ -483,7 +483,8 @@ public:
|
|||
* @param widgets list of widgets
|
||||
*/
|
||||
template<typename... Args>
|
||||
void RaiseWidgetsWhenLowered(Args... widgets) {
|
||||
void RaiseWidgetsWhenLowered(Args... widgets)
|
||||
{
|
||||
(this->RaiseWidgetWhenLowered(widgets), ...);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue