Skip to content

Commit

Permalink
Fix spawn and spawnu (#6594)
Browse files Browse the repository at this point in the history
  • Loading branch information
DakkJaniels authored Sep 11, 2023
1 parent 6c51496 commit aba9d79
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Source/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,15 +697,15 @@ std::string DebugCmdSpawnUniqueMonster(const std::string_view parameter)
int count = 1;
for (std::string_view arg : SplitByChar(parameter, ' ')) {
const ParseIntResult<int> parsedArg = ParseInt<int>(arg);
if (!parsedArg.has_value())
return "Failed to parse argument as integer";
if (!parsedArg.has_value()) {
name.append(arg);
name += ' ';
}
const int num = parsedArg.value();
if (num > 0) {
count = num;
break;
}
name.append(arg);
name += ' ';
}
if (name.empty())
return "Monster name cannot be empty. Duh.";
Expand Down Expand Up @@ -787,15 +787,17 @@ std::string DebugCmdSpawnMonster(const std::string_view parameter)
int count = 1;
for (std::string_view arg : SplitByChar(parameter, ' ')) {
const ParseIntResult<int> parsedArg = ParseInt<int>(arg);
if (!parsedArg.has_value())
return "Failed to parse argument as integer";
if (!parsedArg.has_value()) {
name.append(arg);
name += ' ';
continue;
}
const int num = parsedArg.value();
if (num > 0) {
count = num;
break;
}
name.append(arg);
name += ' ';

}
if (name.empty())
return "Monster name cannot be empty. Duh.";
Expand Down

0 comments on commit aba9d79

Please sign in to comment.