Skip to content

Commit

Permalink
Add Spring.SetUnitIconDraw
Browse files Browse the repository at this point in the history
  • Loading branch information
saurtron authored and sprunk committed Dec 16, 2024
1 parent e41b715 commit eae2809
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
24 changes: 23 additions & 1 deletion rts/Lua/LuaUnsyncedCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ bool LuaUnsyncedCtrl::PushEntries(lua_State* L)

REGISTER_LUA_CFUNC(AddUnitIcon);
REGISTER_LUA_CFUNC(FreeUnitIcon);
REGISTER_LUA_CFUNC(UnitIconSetDraw);
REGISTER_LUA_CFUNC(UnitIconSetDraw); // deprecated
REGISTER_LUA_CFUNC(SetUnitIconDraw);


REGISTER_LUA_CFUNC(ExtractModArchiveFile);

Expand Down Expand Up @@ -2425,11 +2427,31 @@ int LuaUnsyncedCtrl::FreeUnitIcon(lua_State* L)
/***
*
* @function Spring.UnitIconSetDraw
* Deprecated: use Spring.SetUnitIconDraw instead.
* @see Spring.SetUnitIconDraw
* @number unitID
* @bool drawIcon
* @treturn nil
*/
int LuaUnsyncedCtrl::UnitIconSetDraw(lua_State* L)
{
static bool deprecatedMsgDone = false;
if (!deprecatedMsgDone) {
LOG_L(L_WARNING, "Spring.UnitIconSetDraw is deprecated. Please use Spring.SetUnitIconDraw instead.");
deprecatedMsgDone = true;
}
return LuaUnsyncedCtrl::SetUnitIconDraw(L);
}


/***
*
* @function Spring.SetUnitIconDraw
* @number unitID
* @bool drawIcon
* @treturn nil
*/
int LuaUnsyncedCtrl::SetUnitIconDraw(lua_State* L)
{
CUnit* unit = ParseCtrlUnit(L, __func__, 1);

Expand Down
1 change: 1 addition & 0 deletions rts/Lua/LuaUnsyncedCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class LuaUnsyncedCtrl {

static int AddUnitIcon(lua_State* L);
static int FreeUnitIcon(lua_State* L);
static int SetUnitIconDraw(lua_State* L);
static int UnitIconSetDraw(lua_State* L);

static int ExtractModArchiveFile(lua_State* L);
Expand Down

0 comments on commit eae2809

Please sign in to comment.