mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Implement null instance in algorithms.
This commit is contained in:
parent
4d3561d048
commit
d08e57f69a
@ -453,6 +453,14 @@ template <> struct InstSpec< CBlip >
|
||||
{
|
||||
return Core::Get().GetBlips().cend();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Reference to the NULL instance.
|
||||
*/
|
||||
static inline Object & Null()
|
||||
{
|
||||
return Core::Get().GetNullBlip();
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -486,6 +494,14 @@ template <> struct InstSpec< CCheckpoint >
|
||||
{
|
||||
return Core::Get().GetCheckpoints().cend();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Reference to the NULL instance.
|
||||
*/
|
||||
static inline Object & Null()
|
||||
{
|
||||
return Core::Get().GetNullCheckpoint();
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -519,6 +535,14 @@ template <> struct InstSpec< CKeybind >
|
||||
{
|
||||
return Core::Get().GetKeybinds().cend();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Reference to the NULL instance.
|
||||
*/
|
||||
static inline Object & Null()
|
||||
{
|
||||
return Core::Get().GetNullKeybind();
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -552,6 +576,14 @@ template <> struct InstSpec< CObject >
|
||||
{
|
||||
return Core::Get().GetObjects().cend();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Reference to the NULL instance.
|
||||
*/
|
||||
static inline Object & Null()
|
||||
{
|
||||
return Core::Get().GetNullObject();
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -585,6 +617,14 @@ template <> struct InstSpec< CPickup >
|
||||
{
|
||||
return Core::Get().GetPickups().cend();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Reference to the NULL instance.
|
||||
*/
|
||||
static inline Object & Null()
|
||||
{
|
||||
return Core::Get().GetNullPickup();
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -618,6 +658,14 @@ template <> struct InstSpec< CPlayer >
|
||||
{
|
||||
return Core::Get().GetPlayers().cend();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Reference to the NULL instance.
|
||||
*/
|
||||
static inline Object & Null()
|
||||
{
|
||||
return Core::Get().GetNullPlayer();
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -651,6 +699,14 @@ template <> struct InstSpec< CVehicle >
|
||||
{
|
||||
return Core::Get().GetVehicles().cend();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Reference to the NULL instance.
|
||||
*/
|
||||
static inline Object & Null()
|
||||
{
|
||||
return Core::Get().GetNullVehicle();
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -726,7 +782,7 @@ template < typename T > struct RecvElemFunc
|
||||
* Default constructor.
|
||||
*/
|
||||
RecvElemFunc()
|
||||
: mObj()
|
||||
: mObj(InstSpec< T >::Null())
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user