1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-21 20:27:13 +01:00

Implement null instance in algorithms.

This commit is contained in:
Sandu Liviu Catalin 2016-08-19 04:07:43 +03:00
parent 4d3561d048
commit d08e57f69a

View File

@ -453,6 +453,14 @@ template <> struct InstSpec< CBlip >
{ {
return Core::Get().GetBlips().cend(); 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(); 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(); 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(); 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(); 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(); 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(); 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. * Default constructor.
*/ */
RecvElemFunc() RecvElemFunc()
: mObj() : mObj(InstSpec< T >::Null())
{ {
/* ... */ /* ... */
} }