Codechange: Space between template and < (#13278)

Make it all consistent so it matches CODINGSTYLE.
This commit is contained in:
Peter Nelson 2025-01-04 17:56:14 +00:00 committed by GitHub
parent 80be5115fe
commit b653f875b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
39 changed files with 112 additions and 112 deletions

View File

@ -20,7 +20,7 @@
* @return Either new packet if splitting was necessary or the given one
* otherwise.
*/
template<class Tsource, class Tdest>
template <class Tsource, class Tdest>
CargoPacket *CargoMovement<Tsource, Tdest>::Preprocess(CargoPacket *cp)
{
if (this->max_move < cp->Count()) {
@ -38,7 +38,7 @@ CargoPacket *CargoMovement<Tsource, Tdest>::Preprocess(CargoPacket *cp)
* @param cp Packet to be removed completely or partially.
* @return Amount of cargo to be removed.
*/
template<class Tsource>
template <class Tsource>
uint CargoRemoval<Tsource>::Preprocess(CargoPacket *cp)
{
if (this->max_move >= cp->Count()) {
@ -57,7 +57,7 @@ uint CargoRemoval<Tsource>::Preprocess(CargoPacket *cp)
* @param remove Amount of cargo to be removed.
* @return True if the packet was deleted, False if it was reduced.
*/
template<class Tsource>
template <class Tsource>
bool CargoRemoval<Tsource>::Postprocess(CargoPacket *cp, uint remove)
{
if (remove == cp->Count()) {
@ -75,7 +75,7 @@ bool CargoRemoval<Tsource>::Postprocess(CargoPacket *cp, uint remove)
* @return True if the packet was completely delivered, false if only part of
* it was.
*/
template<>
template <>
bool CargoRemoval<StationCargoList>::operator()(CargoPacket *cp)
{
uint remove = this->Preprocess(cp);
@ -89,7 +89,7 @@ bool CargoRemoval<StationCargoList>::operator()(CargoPacket *cp)
* @return True if the packet was completely delivered, false if only part of
* it was.
*/
template<>
template <>
bool CargoRemoval<VehicleCargoList>::operator()(CargoPacket *cp)
{
uint remove = this->Preprocess(cp);

View File

@ -16,7 +16,7 @@
* Abstract action of removing cargo from a vehicle or a station.
* @tparam Tsource CargoList subclass to remove cargo from.
*/
template<class Tsource>
template <class Tsource>
class CargoRemoval {
protected:
Tsource *source; ///< Source of the cargo.
@ -52,7 +52,7 @@ public:
* @tparam Tsource CargoList subclass to remove cargo from.
* @tparam Tdest CargoList subclass to add cargo to.
*/
template<class Tsource, class Tdest>
template <class Tsource, class Tdest>
class CargoMovement {
protected:
Tsource *source; ///< Source of the cargo.
@ -117,7 +117,7 @@ public:
};
/** Action of rerouting cargo between different cargo lists and/or next hops. */
template<class Tlist>
template <class Tlist>
class CargoReroute : public CargoMovement<Tlist, Tlist> {
protected:
StationID avoid;

View File

@ -291,7 +291,7 @@ void VehicleCargoList::Append(CargoPacket *cp, MoveToAction action)
* will be kept and the loop will be aborted.
* @param action Action instance to be applied.
*/
template<class Taction>
template <class Taction>
void VehicleCargoList::ShiftCargo(Taction action)
{
Iterator it(this->packets.begin());
@ -313,7 +313,7 @@ void VehicleCargoList::ShiftCargo(Taction action)
* will be kept and the loop will be aborted.
* @param action Action instance to be applied.
*/
template<class Taction>
template <class Taction>
void VehicleCargoList::PopCargo(Taction action)
{
if (this->packets.empty()) return;
@ -550,7 +550,7 @@ void VehicleCargoList::InvalidateCache()
* @param max_move Maximum amount of cargo to reassign.
* @return Amount of cargo actually reassigned.
*/
template<VehicleCargoList::MoveToAction Tfrom, VehicleCargoList::MoveToAction Tto>
template <VehicleCargoList::MoveToAction Tfrom, VehicleCargoList::MoveToAction Tto>
uint VehicleCargoList::Reassign(uint max_move)
{
static_assert(Tfrom != MTA_TRANSFER && Tto != MTA_TRANSFER);
@ -567,7 +567,7 @@ uint VehicleCargoList::Reassign(uint max_move)
* @param max_move Maximum amount of cargo to reassign.
* @return Amount of cargo actually reassigned.
*/
template<>
template <>
uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER>(uint max_move)
{
max_move = std::min(this->action_counts[MTA_DELIVER], max_move);

View File

@ -356,10 +356,10 @@ protected:
Money feeder_share; ///< Cache for the feeder share.
uint action_counts[NUM_MOVE_TO_ACTION]; ///< Counts of cargo to be transferred, delivered, kept and loaded.
template<class Taction>
template <class Taction>
void ShiftCargo(Taction action);
template<class Taction>
template <class Taction>
void PopCargo(Taction action);
/**
@ -393,7 +393,7 @@ public:
friend class CargoShift;
friend class CargoTransfer;
friend class CargoDelivery;
template<class Tsource>
template <class Tsource>
friend class CargoRemoval;
friend class CargoReturn;
friend class VehicleCargoReroute;
@ -495,7 +495,7 @@ public:
* amount of cargo to be moved. Second parameter is destination (if
* applicable), return value is amount of cargo actually moved. */
template<MoveToAction Tfrom, MoveToAction Tto>
template <MoveToAction Tfrom, MoveToAction Tto>
uint Reassign(uint max_move);
uint Return(uint max_move, StationCargoList *dest, StationID next_station, TileIndex current_tile);
uint Unload(uint max_move, StationCargoList *dest, CargoID cargo, CargoPayment *payment, TileIndex current_tile);
@ -541,7 +541,7 @@ public:
friend class CargoLoad;
friend class CargoTransfer;
template<class Tsource>
template <class Tsource>
friend class CargoRemoval;
friend class CargoReservation;
friend class CargoReturn;
@ -549,10 +549,10 @@ public:
static void InvalidateAllFrom(SourceType src_type, SourceID src);
template<class Taction>
template <class Taction>
bool ShiftCargo(Taction &action, StationID next);
template<class Taction>
template <class Taction>
uint ShiftCargo(Taction action, StationIDStack next, bool include_invalid);
void Append(CargoPacket *cp, StationID next);

View File

@ -82,7 +82,7 @@ struct CommandInfo {
template <typename T>
inline constexpr CommandInfo CommandFromTrait() noexcept { return { T::name, T::flags, T::type }; };
template<typename T, T... i>
template <typename T, T... i>
inline constexpr auto MakeCommandsFromTraits(std::integer_sequence<T, i...>) noexcept {
return std::array<CommandInfo, sizeof...(i)>{{ CommandFromTrait<CommandTraits<static_cast<Commands>(i)>>()... }};
}

View File

@ -80,7 +80,7 @@ private:
# define SILENCE_GCC_FUNCTION_POINTER_CAST
#endif
template<Commands TCmd, typename T, bool THasTile> struct CommandHelper;
template <Commands TCmd, typename T, bool THasTile> struct CommandHelper;
class CommandHelperBase {
protected:
@ -254,7 +254,7 @@ protected:
}
/** Set all invalid ClientID's to the proper value. */
template<class Ttuple, size_t... Tindices>
template <class Ttuple, size_t... Tindices>
static inline void SetClientIds(Ttuple &values, std::index_sequence<Tindices...>)
{
((SetClientIdHelper(std::get<Tindices>(values))), ...);
@ -332,13 +332,13 @@ protected:
}
/** Check if all ClientID arguments are set to valid values. */
template<class Ttuple, size_t... Tindices>
template <class Ttuple, size_t... Tindices>
static inline bool AllClientIdsSet(Ttuple &values, std::index_sequence<Tindices...>)
{
return (ClientIdIsSet(std::get<Tindices>(values)) && ...);
}
template<class Ttuple>
template <class Ttuple>
static inline Money ExtractAdditionalMoney([[maybe_unused]] Ttuple &values)
{
if constexpr (std::is_same_v<std::tuple_element_t<1, Tret>, Money>) {

View File

@ -453,7 +453,7 @@ struct CommandFunctionTraitHelper<Tret<CommandCost, Tretargs...>(*)(DoCommandFla
template <Commands Tcmd> struct CommandTraits;
#define DEF_CMD_TRAIT(cmd_, proc_, flags_, type_) \
template<> struct CommandTraits<cmd_> { \
template <> struct CommandTraits<cmd_> { \
using ProcType = decltype(&proc_); \
using Args = typename CommandFunctionTraitHelper<ProcType>::Args; \
using RetTypes = typename CommandFunctionTraitHelper<ProcType>::RetTypes; \

View File

@ -10,7 +10,7 @@
#ifndef MULTIMAP_HPP
#define MULTIMAP_HPP
template<typename Tkey, typename Tvalue, typename Tcompare>
template <typename Tkey, typename Tvalue, typename Tcompare>
class MultiMap;
/**
@ -21,7 +21,7 @@ class MultiMap;
* @tparam Tvalue Value type of the MultMap.
* @tparam Tcompare Comparator type for keys of the MultiMap.
*/
template<class Tmap_iter, class Tlist_iter, class Tkey, class Tvalue, class Tcompare>
template <class Tmap_iter, class Tlist_iter, class Tkey, class Tvalue, class Tcompare>
class MultiMapIterator {
protected:
friend class MultiMap<Tkey, Tvalue, Tcompare>;
@ -53,7 +53,7 @@ public:
* @tparam Tnon_const Iterator type assignable to Tmap_iter (which might be const).
* @param mi One such iterator.
*/
template<class Tnon_const>
template <class Tnon_const>
MultiMapIterator(Tnon_const mi) : map_iter(mi), list_valid(false) {}
/**
@ -74,7 +74,7 @@ public:
* @param mi One such iterator.
* @return This iterator.
*/
template<class Tnon_const>
template <class Tnon_const>
Self &operator=(Tnon_const mi)
{
this->map_iter = mi;
@ -196,7 +196,7 @@ public:
* @param iter2 Second iterator to compare.
* @return If iter1 and iter2 are equal.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tlist_iter2, class Tkey, class Tvalue1, class Tvalue2, class Tcompare>
template <class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tlist_iter2, class Tkey, class Tvalue1, class Tvalue2, class Tcompare>
bool operator==(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue1, Tcompare> &iter1, const MultiMapIterator<Tmap_iter2, Tlist_iter2, Tkey, Tvalue2, Tcompare> &iter2)
{
if (iter1.GetMapIter() != iter2.GetMapIter()) return false;
@ -213,7 +213,7 @@ bool operator==(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue1, T
* @param iter2 Second iterator to compare.
* @return If iter1 and iter2 are not equal.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tlist_iter2, class Tkey, class Tvalue1, class Tvalue2, class Tcompare>
template <class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tlist_iter2, class Tkey, class Tvalue1, class Tvalue2, class Tcompare>
bool operator!=(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue1, Tcompare> &iter1, const MultiMapIterator<Tmap_iter2, Tlist_iter2, Tkey, Tvalue2, Tcompare> &iter2)
{
return !(iter1 == iter2);
@ -227,7 +227,7 @@ bool operator!=(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue1, T
* @param iter2 Map iterator.
* @return If iter1 points to the begin of the list pointed to by iter2.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
template <class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
bool operator==(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue, Tcompare> &iter1, const Tmap_iter2 &iter2)
{
return !iter1.ListValid() && iter1.GetMapIter() == iter2;
@ -239,7 +239,7 @@ bool operator==(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue, Tc
* @param iter2 Map iterator.
* @return If iter1 doesn't point to the begin of the list pointed to by iter2.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
template <class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
bool operator!=(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue, Tcompare> &iter1, const Tmap_iter2 &iter2)
{
return iter1.ListValid() || iter1.GetMapIter() != iter2;
@ -251,7 +251,7 @@ bool operator!=(const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue, Tc
* @param iter1 MultiMap iterator.
* @return If iter1 points to the begin of the list pointed to by iter2.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
template <class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
bool operator==(const Tmap_iter2 &iter2, const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue, Tcompare> &iter1)
{
return !iter1.ListValid() && iter1.GetMapIter() == iter2;
@ -263,7 +263,7 @@ bool operator==(const Tmap_iter2 &iter2, const MultiMapIterator<Tmap_iter1, Tlis
* @param iter1 MultiMap iterator.
* @return If iter1 doesn't point to the begin of the list pointed to by iter2.
*/
template<class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
template <class Tmap_iter1, class Tlist_iter1, class Tmap_iter2, class Tkey, class Tvalue, class Tcompare >
bool operator!=(const Tmap_iter2 &iter2, const MultiMapIterator<Tmap_iter1, Tlist_iter1, Tkey, Tvalue, Tcompare> &iter1)
{
return iter1.ListValid() || iter1.GetMapIter() != iter2;
@ -277,7 +277,7 @@ bool operator!=(const Tmap_iter2 &iter2, const MultiMapIterator<Tmap_iter1, Tlis
* STL-compatible members are named in STL style, all others are named in OpenTTD
* style.
*/
template<typename Tkey, typename Tvalue, typename Tcompare = std::less<Tkey> >
template <typename Tkey, typename Tvalue, typename Tcompare = std::less<Tkey> >
class MultiMap : public std::map<Tkey, std::list<Tvalue>, Tcompare > {
public:
typedef typename std::list<Tvalue> List;

View File

@ -17,7 +17,7 @@
* redefine operator new/delete. It also never zeroes memory and always reuses
* it.
*/
template<typename Titem, typename Tindex, Tindex Tgrowth_step, Tindex Tmax_size>
template <typename Titem, typename Tindex, Tindex Tgrowth_step, Tindex Tmax_size>
class SimplePool {
public:
inline SimplePool() : first_unused(0), first_free(0) {}

View File

@ -1361,7 +1361,7 @@ static uint GetLoadAmount(Vehicle *v)
* @param action Instance of Taction.
* @return false if any of the action invocations returned false, true otherwise.
*/
template<class Taction>
template <class Taction>
bool IterateVehicleParts(Vehicle *v, Taction action)
{
for (Vehicle *w = v; w != nullptr;

View File

@ -889,7 +889,7 @@ struct FrametimeGraphWindow : Window {
}
/** Scale and interpolate a value from a source range into a destination range */
template<typename T>
template <typename T>
static inline T Scinterlate(T dst_min, T dst_max, T src_min, T src_max, T value)
{
T dst_diff = dst_max - dst_min;

View File

@ -154,7 +154,7 @@ class Layouter : public std::vector<std::unique_ptr<const ParagraphLayouter::Lin
using is_transparent = void; ///< Enable map queries with various key types
/** Comparison operator for LineCacheKey and LineCacheQuery */
template<typename Key1, typename Key2>
template <typename Key1, typename Key2>
bool operator()(const Key1 &lhs, const Key2 &rhs) const
{
if (lhs.state_before.fontsize != rhs.state_before.fontsize) return lhs.state_before.fontsize < rhs.state_before.fontsize;

View File

@ -161,7 +161,7 @@ inline void Scaler::SetDemands(LinkGraphJob &job, NodeID from_id, NodeID to_id,
* @param job Job to calculate the demands for.
* @tparam Tscaler Scaler to be used for scaling demands.
*/
template<class Tscaler>
template <class Tscaler>
void DemandCalculator::CalcDemand(LinkGraphJob &job, Tscaler scaler)
{
NodeList supplies;

View File

@ -18,7 +18,7 @@ private:
int32_t mod_dist; ///< Distance modifier, determines how much demands decrease with distance.
int32_t accuracy; ///< Accuracy of the calculation.
template<class Tscaler>
template <class Tscaler>
void CalcDemand(LinkGraphJob &job, Tscaler scaler);
};

View File

@ -253,7 +253,7 @@ bool CapacityAnnotation::IsBetter(const CapacityAnnotation *base, uint cap,
* @param source_node Node where the algorithm starts.
* @param paths Container for the paths to be calculated.
*/
template<class Tannotation, class Tedge_iterator>
template <class Tannotation, class Tedge_iterator>
void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
{
typedef std::set<Tannotation *, typename Tannotation::Comparator> AnnoSet;

View File

@ -20,7 +20,7 @@ protected:
max_saturation(job.Settings().short_path_saturation)
{}
template<class Tannotation, class Tedge_iterator>
template <class Tannotation, class Tedge_iterator>
void Dijkstra(NodeID from, PathVector &paths);
uint PushFlow(Node &node, NodeID to, Path *path, uint accuracy, uint max_saturation);
@ -72,7 +72,7 @@ public:
* Link graph handler for MCF. Creates MultiCommodityFlow instance according to
* the template parameter.
*/
template<class Tpass>
template <class Tpass>
class MCFHandler : public ComponentHandler {
public:

View File

@ -70,7 +70,7 @@ public:
private:
/** Helper function to write a tuple to the buffer. */
template<class Ttuple, size_t... Tindices>
template <class Ttuple, size_t... Tindices>
void WriteTuple(const Ttuple &values, std::index_sequence<Tindices...>)
{
((*this << std::get<Tindices>(values)), ...);
@ -164,7 +164,7 @@ public:
private:
/** Helper function to read a tuple from the buffer. */
template<class Ttuple, size_t... Tindices>
template <class Ttuple, size_t... Tindices>
void ReadTuple(Ttuple &values, std::index_sequence<Tindices...>)
{
((*this >> std::get<Tindices>(values)), ...);

View File

@ -333,7 +333,7 @@ static bool ReadTrackChunk(FileHandle &file, MidiFile &target)
NOT_REACHED();
}
template<typename T>
template <typename T>
bool TicktimeAscending(const T &a, const T &b)
{
return a.ticktime < b.ticktime;

View File

@ -406,7 +406,7 @@ static inline void SetClientIdHelper(T &data, [[maybe_unused]] ClientID client_i
}
/** Set all invalid ClientID's to the proper value. */
template<class Ttuple, size_t... Tindices>
template <class Ttuple, size_t... Tindices>
static inline void SetClientIds(Ttuple &values, ClientID client_id, std::index_sequence<Tindices...>)
{
((SetClientIdHelper(std::get<Tindices>(values), client_id)), ...);
@ -446,7 +446,7 @@ static inline void SanitizeSingleStringHelper([[maybe_unused]] CommandFlags cmd_
}
/** Helper function to perform validation on command data strings. */
template<class Ttuple, size_t... Tindices>
template <class Ttuple, size_t... Tindices>
static inline void SanitizeStringsHelper(CommandFlags cmd_flags, Ttuple &values, std::index_sequence<Tindices...>)
{
((SanitizeSingleStringHelper(cmd_flags, std::get<Tindices>(values))), ...);

View File

@ -1387,7 +1387,7 @@ public:
/**
* Template version of Button, with callback support.
*/
template<typename T>
template <typename T>
class Button : public ButtonCommon {
private:
typedef void (*ButtonCallback)(struct NetworkClientListWindow *w, Point pt, T id); ///< Callback function to call on click.

View File

@ -1235,7 +1235,7 @@ void SlSaveLoadRef(void *ptr, VarType conv)
/**
* Template class to help with list-like types.
*/
template <template<typename, typename> typename Tstorage, typename Tvar, typename Tallocator = std::allocator<Tvar>>
template <template <typename, typename> typename Tstorage, typename Tvar, typename Tallocator = std::allocator<Tvar>>
class SlStorageHelper {
typedef Tstorage<Tvar, Tallocator> SlStorageT;
public:

View File

@ -43,7 +43,7 @@ private:
int modifications; ///< Number of modification that has been done. To prevent changing data while valuating.
protected:
template<typename T, class ItemValid, class ItemFilter>
template <typename T, class ItemValid, class ItemFilter>
static void FillList(ScriptList *list, ItemValid item_valid, ItemFilter item_filter)
{
for (const T *item : T::Iterate()) {
@ -53,19 +53,19 @@ protected:
}
}
template<typename T, class ItemValid>
template <typename T, class ItemValid>
static void FillList(ScriptList *list, ItemValid item_valid)
{
ScriptList::FillList<T>(list, item_valid, [](const T *) { return true; });
}
template<typename T>
template <typename T>
static void FillList(ScriptList *list)
{
ScriptList::FillList<T>(list, [](const T *) { return true; });
}
template<typename T, class ItemValid>
template <typename T, class ItemValid>
static void FillList(HSQUIRRELVM vm, ScriptList *list, ItemValid item_valid)
{
int nparam = sq_gettop(vm) - 1;
@ -137,7 +137,7 @@ protected:
ScriptObject::SetAllowDoCommand(backup_allow);
}
template<typename T>
template <typename T>
static void FillList(HSQUIRRELVM vm, ScriptList *list)
{
ScriptList::FillList<T>(vm, list, [](const T *) { return true; });

View File

@ -116,7 +116,7 @@ public:
static void InitializeRandomizers();
protected:
template<Commands TCmd, typename T> struct ScriptDoCommandHelper;
template <Commands TCmd, typename T> struct ScriptDoCommandHelper;
/**
* Templated wrapper that exposes the command parameter arguments
@ -346,7 +346,7 @@ namespace ScriptObjectInternal {
}
/** Helper function to perform validation on command data strings. */
template<class Ttuple, size_t... Tindices>
template <class Ttuple, size_t... Tindices>
static inline void SanitizeStringsHelper(Ttuple &values, std::index_sequence<Tindices...>)
{
((SanitizeSingleStringHelper(std::get<Tindices>(values))), ...);
@ -362,7 +362,7 @@ namespace ScriptObjectInternal {
}
/** Set all invalid ClientID's to the proper value. */
template<class Ttuple, size_t... Tindices>
template <class Ttuple, size_t... Tindices>
static inline void SetClientIds(Ttuple &values, std::index_sequence<Tindices...>)
{
((SetClientIdHelper(std::get<Tindices>(values))), ...);

View File

@ -39,7 +39,7 @@
return ::GetStationIndex(tile);
}
template<bool Tfrom, bool Tvia>
template <bool Tfrom, bool Tvia>
/* static */ bool ScriptStation::IsCargoRequestValid(StationID station_id,
StationID from_station_id, StationID via_station_id, CargoID cargo_id)
{
@ -50,7 +50,7 @@ template<bool Tfrom, bool Tvia>
return true;
}
template<bool Tfrom, bool Tvia>
template <bool Tfrom, bool Tvia>
/* static */ SQInteger ScriptStation::CountCargoWaiting(StationID station_id,
StationID from_station_id, StationID via_station_id, CargoID cargo_id)
{
@ -101,7 +101,7 @@ template<bool Tfrom, bool Tvia>
return CountCargoWaiting<true, true>(station_id, from_station_id, via_station_id, cargo_id);
}
template<bool Tfrom, bool Tvia>
template <bool Tfrom, bool Tvia>
/* static */ SQInteger ScriptStation::CountCargoPlanned(StationID station_id,
StationID from_station_id, StationID via_station_id, CargoID cargo_id)
{

View File

@ -297,15 +297,15 @@ public:
static bool OpenCloseAirport(StationID station_id);
private:
template<bool Tfrom, bool Tvia>
template <bool Tfrom, bool Tvia>
static bool IsCargoRequestValid(StationID station_id, StationID from_station_id,
StationID via_station_id, CargoID cargo_id);
template<bool Tfrom, bool Tvia>
template <bool Tfrom, bool Tvia>
static SQInteger CountCargoWaiting(StationID station_id, StationID from_station_id,
StationID via_station_id, CargoID cargo_id);
template<bool Tfrom, bool Tvia>
template <bool Tfrom, bool Tvia>
static SQInteger CountCargoPlanned(StationID station_id, StationID from_station_id,
StationID via_station_id, CargoID cargo_id);

View File

@ -105,7 +105,7 @@ public:
StationID other);
~CargoCollector() ;
template<ScriptStationList_Cargo::CargoSelector Tselector>
template <ScriptStationList_Cargo::CargoSelector Tselector>
void Update(StationID from, StationID via, uint amount);
const GoodsEntry *GE() const { return ge; }
@ -146,7 +146,7 @@ void CargoCollector::SetValue()
}
}
template<ScriptStationList_Cargo::CargoSelector Tselector>
template <ScriptStationList_Cargo::CargoSelector Tselector>
void CargoCollector::Update(StationID from, StationID via, uint amount)
{
StationID key = INVALID_STATION;
@ -174,7 +174,7 @@ void CargoCollector::Update(StationID from, StationID via, uint amount)
}
template<ScriptStationList_Cargo::CargoSelector Tselector>
template <ScriptStationList_Cargo::CargoSelector Tselector>
void ScriptStationList_CargoWaiting::Add(StationID station_id, CargoID cargo, StationID other_station)
{
CargoCollector collector(this, station_id, cargo, other_station);
@ -189,7 +189,7 @@ void ScriptStationList_CargoWaiting::Add(StationID station_id, CargoID cargo, St
}
template<ScriptStationList_Cargo::CargoSelector Tselector>
template <ScriptStationList_Cargo::CargoSelector Tselector>
void ScriptStationList_CargoPlanned::Add(StationID station_id, CargoID cargo, StationID other_station)
{
CargoCollector collector(this, station_id, cargo, other_station);

View File

@ -92,7 +92,7 @@ protected:
* @param cargo Cargo type to query for.
* @param other_station Other station to restrict the query with.
*/
template<CargoSelector Tselector>
template <CargoSelector Tselector>
void Add(StationID station_id, CargoID cargo, StationID other_station = INVALID_STATION);
public:
@ -129,7 +129,7 @@ protected:
* @param cargo Cargo type to query for.
* @param other_station Other station to restrict the query with.
*/
template<CargoSelector Tselector>
template <CargoSelector Tselector>
void Add(StationID station_id, CargoID cargo, StationID other_station = INVALID_STATION);
public:

View File

@ -1304,7 +1304,7 @@ struct SettingsContainer {
typedef std::vector<BaseSettingEntry*> EntryVector;
EntryVector entries; ///< Settings on this page
template<typename T>
template <typename T>
T *Add(T *item)
{
this->entries.push_back(item);

View File

@ -617,7 +617,7 @@ void RebuildStationKdtree();
* @param func The function to call, must take two parameters: Station* and TileIndex and return true
* if coverage of that tile is acceptable for a given station or false if search should continue
*/
template<typename Func>
template <typename Func>
void ForAllStationsAroundTiles(const TileArea &ta, Func func)
{
/* There are no stations, so we will never find anything. */

View File

@ -904,7 +904,7 @@ private:
CargoSortType type;
SortOrder order;
template<class Tid>
template <class Tid>
bool SortId(Tid st1, Tid st2) const;
bool SortCount(const CargoDataEntry *cd1, const CargoDataEntry *cd2) const;
bool SortStation (StationID st1, StationID st2) const;
@ -1043,7 +1043,7 @@ private:
CargoDataEntry *Retrieve(CargoDataSet::iterator i) const;
template<class Tid>
template <class Tid>
CargoDataEntry *InsertOrRetrieve(Tid s);
void Remove(CargoDataEntry *comp);
@ -1146,7 +1146,7 @@ void CargoDataEntry::Remove(CargoDataEntry *child)
* @param child_id ID of the child to be inserted or retrieved.
* @return the new or retrieved subentry
*/
template<class Tid>
template <class Tid>
CargoDataEntry *CargoDataEntry::InsertOrRetrieve(Tid child_id)
{
CargoDataEntry tmp(child_id);
@ -1214,7 +1214,7 @@ bool CargoSorter::operator()(const CargoDataEntry *cd1, const CargoDataEntry *cd
}
}
template<class Tid>
template <class Tid>
bool CargoSorter::SortId(Tid st1, Tid st2) const
{
return (this->order == SO_ASCENDING) ? st1 < st2 : st2 < st1;
@ -1939,7 +1939,7 @@ struct StationViewWindow : public Window {
* @param filter Parent of the row.
* @param next ID pointing to the row.
*/
template<class Tid>
template <class Tid>
void HandleCargoWaitingClick(CargoDataEntry *filter, Tid next)
{
if (filter->Retrieve(next) != nullptr) {

View File

@ -43,7 +43,7 @@ void SetCurrentThreadName(const char *name);
* @param _Ax Arguments for the thread function.
* @return True if the thread was successfully started, false otherwise.
*/
template<class TFn, class... TArgs>
template <class TFn, class... TArgs>
inline bool StartNewThread(std::thread *thr, const char *name, TFn&& _Fx, TArgs&&... _Ax)
{
try {

View File

@ -74,7 +74,7 @@ uint16_t TimerGameCalendar::sub_date_fract = {};
TimerGameCalendar::month = ymd.month;
}
template<>
template <>
void IntervalTimer<TimerGameCalendar>::Elapsed(TimerGameCalendar::TElapsed trigger)
{
if (trigger == this->period.trigger) {
@ -82,7 +82,7 @@ void IntervalTimer<TimerGameCalendar>::Elapsed(TimerGameCalendar::TElapsed trigg
}
}
template<>
template <>
void TimeoutTimer<TimerGameCalendar>::Elapsed(TimerGameCalendar::TElapsed trigger)
{
if (this->fired) return;
@ -93,7 +93,7 @@ void TimeoutTimer<TimerGameCalendar>::Elapsed(TimerGameCalendar::TElapsed trigge
}
}
template<>
template <>
bool TimerManager<TimerGameCalendar>::Elapsed([[maybe_unused]] TimerGameCalendar::TElapsed delta)
{
assert(delta == 1);
@ -166,7 +166,7 @@ bool TimerManager<TimerGameCalendar>::Elapsed([[maybe_unused]] TimerGameCalendar
}
#ifdef WITH_ASSERT
template<>
template <>
void TimerManager<TimerGameCalendar>::Validate(TimerGameCalendar::TPeriod period)
{
if (period.priority == TimerGameCalendar::Priority::NONE) return;

View File

@ -101,7 +101,7 @@ TimerGameEconomy::DateFract TimerGameEconomy::date_fract = {};
return (_settings_game.economy.timekeeping_units == TKU_WALLCLOCK);
}
template<>
template <>
void IntervalTimer<TimerGameEconomy>::Elapsed(TimerGameEconomy::TElapsed trigger)
{
if (trigger == this->period.trigger) {
@ -109,7 +109,7 @@ void IntervalTimer<TimerGameEconomy>::Elapsed(TimerGameEconomy::TElapsed trigger
}
}
template<>
template <>
void TimeoutTimer<TimerGameEconomy>::Elapsed(TimerGameEconomy::TElapsed trigger)
{
if (this->fired) return;
@ -120,7 +120,7 @@ void TimeoutTimer<TimerGameEconomy>::Elapsed(TimerGameEconomy::TElapsed trigger)
}
}
template<>
template <>
bool TimerManager<TimerGameEconomy>::Elapsed([[maybe_unused]] TimerGameEconomy::TElapsed delta)
{
assert(delta == 1);
@ -190,7 +190,7 @@ bool TimerManager<TimerGameEconomy>::Elapsed([[maybe_unused]] TimerGameEconomy::
}
#ifdef WITH_ASSERT
template<>
template <>
void TimerManager<TimerGameEconomy>::Validate(TimerGameEconomy::TPeriod period)
{
if (period.priority == TimerGameEconomy::Priority::NONE) return;

View File

@ -17,7 +17,7 @@
#include "../safeguards.h"
template<>
template <>
void IntervalTimer<TimerGameRealtime>::Elapsed(TimerGameRealtime::TElapsed delta)
{
if (this->period.period == std::chrono::milliseconds::zero()) return;
@ -37,7 +37,7 @@ void IntervalTimer<TimerGameRealtime>::Elapsed(TimerGameRealtime::TElapsed delta
}
}
template<>
template <>
void TimeoutTimer<TimerGameRealtime>::Elapsed(TimerGameRealtime::TElapsed delta)
{
if (this->fired) return;
@ -53,7 +53,7 @@ void TimeoutTimer<TimerGameRealtime>::Elapsed(TimerGameRealtime::TElapsed delta)
}
}
template<>
template <>
bool TimerManager<TimerGameRealtime>::Elapsed(TimerGameRealtime::TElapsed delta)
{
for (auto timer : TimerManager<TimerGameRealtime>::GetTimers()) {
@ -64,7 +64,7 @@ bool TimerManager<TimerGameRealtime>::Elapsed(TimerGameRealtime::TElapsed delta)
}
#ifdef WITH_ASSERT
template<>
template <>
void TimerManager<TimerGameRealtime>::Validate(TimerGameRealtime::TPeriod)
{
}

View File

@ -18,7 +18,7 @@
TimerGameTick::TickCounter TimerGameTick::counter = 0;
template<>
template <>
void IntervalTimer<TimerGameTick>::Elapsed(TimerGameTick::TElapsed delta)
{
if (this->period.value == 0) return;
@ -36,7 +36,7 @@ void IntervalTimer<TimerGameTick>::Elapsed(TimerGameTick::TElapsed delta)
}
}
template<>
template <>
void TimeoutTimer<TimerGameTick>::Elapsed(TimerGameTick::TElapsed delta)
{
if (this->fired) return;
@ -50,7 +50,7 @@ void TimeoutTimer<TimerGameTick>::Elapsed(TimerGameTick::TElapsed delta)
}
}
template<>
template <>
bool TimerManager<TimerGameTick>::Elapsed(TimerGameTick::TElapsed delta)
{
TimerGameTick::counter++;
@ -63,7 +63,7 @@ bool TimerManager<TimerGameTick>::Elapsed(TimerGameTick::TElapsed delta)
}
#ifdef WITH_ASSERT
template<>
template <>
void TimerManager<TimerGameTick>::Validate(TimerGameTick::TPeriod period)
{
if (period.priority == TimerGameTick::Priority::NONE) return;

View File

@ -16,7 +16,7 @@
#include "../safeguards.h"
template<>
template <>
void IntervalTimer<TimerWindow>::Elapsed(TimerWindow::TElapsed delta)
{
if (this->period == std::chrono::milliseconds::zero()) return;
@ -34,7 +34,7 @@ void IntervalTimer<TimerWindow>::Elapsed(TimerWindow::TElapsed delta)
}
}
template<>
template <>
void TimeoutTimer<TimerWindow>::Elapsed(TimerWindow::TElapsed delta)
{
if (this->fired) return;
@ -48,7 +48,7 @@ void TimeoutTimer<TimerWindow>::Elapsed(TimerWindow::TElapsed delta)
}
}
template<>
template <>
bool TimerManager<TimerWindow>::Elapsed(TimerWindow::TElapsed delta)
{
/* Make a temporary copy of the timers, as a timer's callback might add/remove other timers. */
@ -62,7 +62,7 @@ bool TimerManager<TimerWindow>::Elapsed(TimerWindow::TElapsed delta)
}
#ifdef WITH_ASSERT
template<>
template <>
void TimerManager<TimerWindow>::Validate(TimerWindow::TPeriod)
{
}

View File

@ -104,16 +104,16 @@ void SetViewportCatchmentWaypoint(const Waypoint *wp, bool sel);
void SetViewportCatchmentTown(const Town *t, bool sel);
void MarkCatchmentTilesDirty();
template<class T>
template <class T>
void SetViewportCatchmentSpecializedStation(const T *st, bool sel);
template<>
template <>
inline void SetViewportCatchmentSpecializedStation(const Station *st, bool sel)
{
SetViewportCatchmentStation(st, sel);
}
template<>
template <>
inline void SetViewportCatchmentSpecializedStation(const Waypoint *st, bool sel)
{
SetViewportCatchmentWaypoint(st, sel);

View File

@ -20,7 +20,7 @@ Window *FindWindowByClass(WindowClass cls);
Window *GetMainWindow();
void ChangeWindowOwner(Owner old_owner, Owner new_owner);
template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
template <typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
Window *FindWindowById(WindowClass cls, T number)
{
return FindWindowById(cls, number.base());
@ -44,7 +44,7 @@ void InputLoop();
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data = 0, bool gui_scope = false);
void InvalidateWindowClassesData(WindowClass cls, int data = 0, bool gui_scope = false);
template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
template <typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
void InvalidateWindowData(WindowClass cls, T number, int data = 0, bool gui_scope = false)
{
InvalidateWindowData(cls, number.base(), data, gui_scope);
@ -67,7 +67,7 @@ void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, WidgetID widget_
void SetWindowDirty(WindowClass cls, WindowNumber number);
void SetWindowClassesDirty(WindowClass cls);
template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
template <typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
void SetWindowDirty(WindowClass cls, T number)
{
SetWindowDirty(cls, number.base());
@ -76,7 +76,7 @@ void SetWindowDirty(WindowClass cls, T number)
void CloseWindowById(WindowClass cls, WindowNumber number, bool force = true, int data = 0);
void CloseWindowByClass(WindowClass cls, int data = 0);
template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
template <typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
void CloseWindowById(WindowClass cls, T number, bool force = true, int data = 0)
{
CloseWindowById(cls, number.base(), force, data);

View File

@ -349,7 +349,7 @@ public:
void CreateNestedTree();
void FinishInitNested(WindowNumber window_number = 0);
template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
template <typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
void FinishInitNested(T number)
{
this->FinishInitNested(number.base());
@ -517,7 +517,7 @@ public:
* @param disab_stat status to use ie: disabled = true, enabled = false
* @param widgets list of widgets
*/
template<typename... Args>
template <typename... Args>
void SetWidgetsDisabledState(bool disab_stat, Args... widgets)
{
(SetWidgetDisabledState(widgets, disab_stat), ...);
@ -528,7 +528,7 @@ public:
* @param lowered_stat status to use ie: lowered = true, raised = false
* @param widgets list of widgets
*/
template<typename... Args>
template <typename... Args>
void SetWidgetsLoweredState(bool lowered_stat, Args... widgets)
{
(SetWidgetLoweredState(widgets, lowered_stat), ...);
@ -538,7 +538,7 @@ public:
* Raises the widgets and sets widgets dirty that are lowered.
* @param widgets list of widgets
*/
template<typename... Args>
template <typename... Args>
void RaiseWidgetsWhenLowered(Args... widgets)
{
(this->RaiseWidgetWhenLowered(widgets), ...);
@ -997,7 +997,7 @@ public:
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
Window *FindWindowFromPt(int x, int y);
template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
template <typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
Window *BringWindowToFrontById(WindowClass cls, T number)
{
return BringWindowToFrontById(cls, number.base());