Implement LuaImpl* for Vector[2|3]<int> (#170)

* Implement LuaImplQueryArg for Vector[2|3]i

* Implement LuaImplReplyVal for Vector[2|3]i

* Edit changelog

* Fix previous commit crash

* Network/ENetPeer: Fix reliable sequence number wrap error

* Edit changelog

* what have I done to changelog
This commit is contained in:
S6066 2018-07-10 14:48:23 +02:00 committed by Jérôme Leclercq
parent a870954762
commit 49d33bea55
2 changed files with 31 additions and 0 deletions

View File

@ -125,6 +125,7 @@ Nazara Engine:
- ⚠️ Removed Vector[2|3]::Distancef method and made Distance method templated - ⚠️ Removed Vector[2|3]::Distancef method and made Distance method templated
- Added Vector2::Distance static method - Added Vector2::Distance static method
- ⚠️ Fixed compilation errors on MSVC with flag /permissive- on CullingList class - ⚠️ Fixed compilation errors on MSVC with flag /permissive- on CullingList class
- Added LuaImplQueryArg & LuaImplReplyVal functions for Vector[2|3]<int>
- Fixed bug in ENet implementation causing legit reliable packets to be dropped on sequence number overflow - Fixed bug in ENet implementation causing legit reliable packets to be dropped on sequence number overflow
Nazara Development Kit: Nazara Development Kit:

View File

@ -269,6 +269,15 @@ namespace Nz
return ret; return ret;
} }
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Vector2i* vec, TypeTag<Vector2i>)
{
Vector2d vecDouble;
unsigned int ret = LuaImplQueryArg(state, index, &vecDouble, TypeTag<Vector2d>());
vec->Set(vecDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Vector3d* vec, TypeTag<Vector3d>) inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Vector3d* vec, TypeTag<Vector3d>)
{ {
switch (state.GetType(index)) switch (state.GetType(index))
@ -308,6 +317,15 @@ namespace Nz
return ret; return ret;
} }
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Vector3i* vec, TypeTag<Vector3i>)
{
Vector3d vecDouble;
unsigned int ret = LuaImplQueryArg(state, index, &vecDouble, TypeTag<Vector3d>());
vec->Set(vecDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Ndk::Entity** handle, TypeTag<Ndk::Entity*>) inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Ndk::Entity** handle, TypeTag<Ndk::Entity*>)
{ {
if (!state.IsOfType(index, LuaType_Nil)) if (!state.IsOfType(index, LuaType_Nil))
@ -538,6 +556,12 @@ namespace Nz
return 1; return 1;
} }
inline int LuaImplReplyVal(const LuaState& state, Vector2i&& val, TypeTag<Vector2i>)
{
state.PushInstance<Vector2d>("Vector2", val);
return 1;
}
inline int LuaImplReplyVal(const LuaState& state, Vector3d&& val, TypeTag<Vector3d>) inline int LuaImplReplyVal(const LuaState& state, Vector3d&& val, TypeTag<Vector3d>)
{ {
state.PushInstance<Vector3d>("Vector3", val); state.PushInstance<Vector3d>("Vector3", val);
@ -556,6 +580,12 @@ namespace Nz
return 1; return 1;
} }
inline int LuaImplReplyVal(const LuaState& state, Vector3i&& val, TypeTag<Vector3i>)
{
state.PushInstance<Vector3d>("Vector3", val);
return 1;
}
inline int LuaImplReplyVal(const LuaState& state, Ndk::Entity* ptr, TypeTag<Ndk::Entity*>) inline int LuaImplReplyVal(const LuaState& state, Ndk::Entity* ptr, TypeTag<Ndk::Entity*>)
{ {
state.PushInstance<Ndk::EntityHandle>("Entity", ptr); state.PushInstance<Ndk::EntityHandle>("Entity", ptr);