diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-04-09 15:49:18 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-04-09 15:49:18 +0200 |
commit | 95932749a53f46ae5901798a17e1f0c4c33ac6b2 (patch) | |
tree | 327d85f6f634edfacc01dc587492d96f9200344d /src/universe.cpp | |
parent | 98ff4191c2cd215c7d6a429e9ddd66f7a6a30316 (diff) | |
download | lanes-95932749a53f46ae5901798a17e1f0c4c33ac6b2.tar.gz lanes-95932749a53f46ae5901798a17e1f0c4c33ac6b2.tar.bz2 lanes-95932749a53f46ae5901798a17e1f0c4c33ac6b2.zip |
C++ migration: use strong type safety for source and destination states in transfer functions
Diffstat (limited to 'src/universe.cpp')
-rw-r--r-- | src/universe.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/universe.cpp b/src/universe.cpp index 290e547..4c53987 100644 --- a/src/universe.cpp +++ b/src/universe.cpp | |||
@@ -80,7 +80,7 @@ Universe* universe_create(lua_State* L) | |||
80 | U->Universe::Universe(); | 80 | U->Universe::Universe(); |
81 | STACK_CHECK_START_REL(L, 1); | 81 | STACK_CHECK_START_REL(L, 1); |
82 | UNIVERSE_FULL_REGKEY.setValue(L, [](lua_State* L) { lua_pushvalue(L, -2); }); | 82 | UNIVERSE_FULL_REGKEY.setValue(L, [](lua_State* L) { lua_pushvalue(L, -2); }); |
83 | UNIVERSE_LIGHT_REGKEY.setValue(L, [U](lua_State* L) { lua_pushlightuserdata( L, U); }); | 83 | UNIVERSE_LIGHT_REGKEY.setValue(L, [U](lua_State* L) { lua_pushlightuserdata(L, U); }); |
84 | STACK_CHECK(L, 1); | 84 | STACK_CHECK(L, 1); |
85 | return U; | 85 | return U; |
86 | } | 86 | } |
@@ -91,8 +91,8 @@ void universe_store(lua_State* L, Universe* U) | |||
91 | { | 91 | { |
92 | ASSERT_L(!U || universe_get(L) == nullptr); | 92 | ASSERT_L(!U || universe_get(L) == nullptr); |
93 | STACK_CHECK_START_REL(L, 0); | 93 | STACK_CHECK_START_REL(L, 0); |
94 | UNIVERSE_LIGHT_REGKEY.setValue(L, [U](lua_State* L) { U ? lua_pushlightuserdata( L, U) : lua_pushnil( L); }); | 94 | UNIVERSE_LIGHT_REGKEY.setValue(L, [U](lua_State* L) { U ? lua_pushlightuserdata(L, U) : lua_pushnil(L); }); |
95 | STACK_CHECK( L, 0); | 95 | STACK_CHECK(L, 0); |
96 | } | 96 | } |
97 | 97 | ||
98 | // ################################################################################################ | 98 | // ################################################################################################ |
@@ -101,6 +101,6 @@ Universe* universe_get(lua_State* L) | |||
101 | { | 101 | { |
102 | STACK_CHECK_START_REL(L, 0); | 102 | STACK_CHECK_START_REL(L, 0); |
103 | Universe* const universe{ UNIVERSE_LIGHT_REGKEY.readLightUserDataValue<Universe>(L) }; | 103 | Universe* const universe{ UNIVERSE_LIGHT_REGKEY.readLightUserDataValue<Universe>(L) }; |
104 | STACK_CHECK( L, 0); | 104 | STACK_CHECK(L, 0); |
105 | return universe; | 105 | return universe; |
106 | } | 106 | } |