Skip to content

Commit

Permalink
Don't require a 3rd parameter for ShareResources(teamID, 'unit'). (#1837
Browse files Browse the repository at this point in the history
)
  • Loading branch information
saurtron authored Jan 8, 2025
1 parent e55de21 commit 71a2a4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rts/Lua/LuaUnsyncedCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3710,7 +3710,7 @@ int LuaUnsyncedCtrl::ShareResources(lua_State* L)
return 0;

const int args = lua_gettop(L); // number of arguments
if ((args < 2) || !lua_isnumber(L, 1) || !lua_isstring(L, 2) || ((args >= 3) && !lua_isnumber(L, 3)))
if ((args < 2) || !lua_isnumber(L, 1) || !lua_isstring(L, 2))
luaL_error(L, "Incorrect arguments to ShareResources()");

const int teamID = lua_toint(L, 1);
Expand All @@ -3729,8 +3729,8 @@ int LuaUnsyncedCtrl::ShareResources(lua_State* L)
return 0;
}

if (args < 3)
return 0;
if (!lua_isnumber(L, 3))
luaL_error(L, "Incorrect third argument to ShareResources() for the specified resource");

if (type[0] == 'm') {
clientNet->Send(CBaseNetProtocol::Get().SendShare(gu->myPlayerNum, teamID, 0, lua_tofloat(L, 3), 0.0f));
Expand Down

0 comments on commit 71a2a4d

Please sign in to comment.