fix commas in free binds

This commit is contained in:
Vaxry 2022-10-03 16:38:05 +01:00
parent 174b593438
commit 85eea70be4
2 changed files with 3 additions and 3 deletions

View file

@ -637,7 +637,7 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v
return;
}
const auto ARGS = CVarList(value);
const auto ARGS = CVarList(value, 4);
if ((ARGS.size() < 4 && !mouse) || (ARGS.size() < 3 && mouse)) {
parseError = "bind: too few args";

View file

@ -72,12 +72,12 @@ struct SAnimationPropertyConfig {
class CVarList {
public:
CVarList(const std::string& in) {
CVarList(const std::string& in, long unsigned int lastArgNo = 0) {
std::string curitem = "";
std::string argZ = in;
auto nextItem = [&]() {
auto idx = argZ.find_first_of(',');
auto idx = lastArgNo != 0 && m_vArgs.size() >= lastArgNo - 1 ? std::string::npos : argZ.find_first_of(',');
if (idx != std::string::npos) {
curitem = argZ.substr(0, idx);