nosoop / rcbot2

A Metamod:Source plugin that provides customizable bot players.
http://rcbot.bots-united.com
GNU Affero General Public License v3.0
5 stars 0 forks source link

Flawed failsafe on running non-dedicated commands #9

Closed nosoop closed 4 years ago

nosoop commented 4 years ago

https://github.com/nosoop/rcbot2/blob/3bc6243518221ec683a849b0342134b06f416be4/utils/RCBot2_meta/bot_commands.cpp#L2507-L2511

tl;dr missed a pCommand->, and that is why my changes will use explicit this

canbeUsedDedicated() erroneously calls the function for this (CBotCommandContainer) instead of pCommand (CBotCommand). That check always passes for the container, so the subcommand always gets fired, which leads to bad things.

It should be changed to the following:

if (!pClient && !pCommand->canbeUsedDedicated()) {
    // ...
}

Marking this issue down for reference to other forks, as a refactoring commit ends up fixing this anyways.