aboutsummaryrefslogtreecommitdiff
path: root/src/linda.cpp
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-10-24 11:30:18 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-10-24 11:30:18 +0200
commiteba98e4e1adcf3ce11e5934e2dce54f29aef1e0a (patch)
treed51d51eb2d48208df1cfdf6eb0bd40a928d6243c /src/linda.cpp
parent8745a54f88f31cd51dc86c96039ebe0b3e98f5ea (diff)
downloadlanes-eba98e4e1adcf3ce11e5934e2dce54f29aef1e0a.tar.gz
lanes-eba98e4e1adcf3ce11e5934e2dce54f29aef1e0a.tar.bz2
lanes-eba98e4e1adcf3ce11e5934e2dce54f29aef1e0a.zip
Make Unique even stronger
Diffstat (limited to 'src/linda.cpp')
-rw-r--r--src/linda.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/linda.cpp b/src/linda.cpp
index 6655ae4..15e7a2c 100644
--- a/src/linda.cpp
+++ b/src/linda.cpp
@@ -196,7 +196,7 @@ int Linda::ProtectedCall(lua_State* const L_, lua_CFunction const f_)
196 196
197 // acquire the keeper 197 // acquire the keeper
198 Keeper* const _keeper{ _linda->acquireKeeper() }; 198 Keeper* const _keeper{ _linda->acquireKeeper() };
199 KeeperState const _K{ _keeper ? _keeper->K : KeeperState{ nullptr } }; 199 KeeperState const _K{ _keeper ? _keeper->K : KeeperState{ static_cast<lua_State*>(nullptr) } };
200 if (_K == nullptr) 200 if (_K == nullptr)
201 return 0; 201 return 0;
202 202
@@ -469,7 +469,7 @@ LUAG_FUNC(linda_limit)
469 luaL_argcheck(L_, _nargs == 2 || _nargs == 3, 2, "wrong number of arguments"); 469 luaL_argcheck(L_, _nargs == 2 || _nargs == 3, 2, "wrong number of arguments");
470 // make sure we got a numeric limit, or "unlimited", (or nothing) 470 // make sure we got a numeric limit, or "unlimited", (or nothing)
471 bool const _unlimited{ luaG_tostring(L_, StackIndex{ 3 }) == "unlimited" }; 471 bool const _unlimited{ luaG_tostring(L_, StackIndex{ 3 }) == "unlimited" };
472 LindaLimit const _val{ _unlimited ? std::numeric_limits<LindaLimit::type>::max() : LindaLimit{ static_cast<LindaLimit::type>(luaL_optinteger(L_, 3, 0)) } }; 472 LindaLimit const _val{ _unlimited ? std::numeric_limits<LindaLimit::type>::max() : static_cast<LindaLimit::type>(luaL_optinteger(L_, 3, 0)) };
473 if (_val < 0) { 473 if (_val < 0) {
474 raise_luaL_argerror(L_, StackIndex{ 3 }, "limit must be >= 0"); 474 raise_luaL_argerror(L_, StackIndex{ 3 }, "limit must be >= 0");
475 } 475 }
@@ -575,7 +575,7 @@ LUAG_FUNC(linda_receive)
575 575
576 Lane* const _lane{ kLanePointerRegKey.readLightUserDataValue<Lane>(L_) }; 576 Lane* const _lane{ kLanePointerRegKey.readLightUserDataValue<Lane>(L_) };
577 Keeper* const _keeper{ _linda->whichKeeper() }; 577 Keeper* const _keeper{ _linda->whichKeeper() };
578 KeeperState const _K{ _keeper ? _keeper->K : KeeperState{ nullptr } }; 578 KeeperState const _K{ _keeper ? _keeper->K : KeeperState{ static_cast<lua_State*>(nullptr) } };
579 if (_K == nullptr) 579 if (_K == nullptr)
580 return 0; 580 return 0;
581 581
@@ -714,7 +714,7 @@ LUAG_FUNC(linda_send)
714 { 714 {
715 Lane* const _lane{ kLanePointerRegKey.readLightUserDataValue<Lane>(L_) }; 715 Lane* const _lane{ kLanePointerRegKey.readLightUserDataValue<Lane>(L_) };
716 Keeper* const _keeper{ _linda->whichKeeper() }; 716 Keeper* const _keeper{ _linda->whichKeeper() };
717 KeeperState const _K{ _keeper ? _keeper->K : KeeperState{ nullptr } }; 717 KeeperState const _K{ _keeper ? _keeper->K : KeeperState{ static_cast<lua_State*>(nullptr) } };
718 if (_K == nullptr) 718 if (_K == nullptr)
719 return 0; 719 return 0;
720 720