Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console: use the new string functions #1459

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- fixed cameras with glide values sometimes moving in the wrong direction (#1451, regression from 4.3)
- fixed `/give` console command giving duplicate items under some circumstances (#1463, regression from 3.0)
- fixed `/give` console command confusing logging around mismatched items (#1463, regression from 3.0)
- fixed `/flip` console command misreporting an already enabled flipmap as off (regression from 4.0)
- fixed console commands causing improper ring shutdown with selected inventory item (#1460, regression from 3.0)
- improved logs module names readability
- improved crash debug information on Windows
Expand Down
5 changes: 4 additions & 1 deletion src/game/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <libtrx/log.h>

#include <SDL2/SDL_keycode.h>
#include <assert.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
Expand Down Expand Up @@ -74,7 +75,7 @@ static COMMAND_RESULT Console_Eval(const char *const cmdline)
const CONSOLE_COMMAND *matching_cmd = NULL;

for (CONSOLE_COMMAND *cur_cmd = &g_ConsoleCommands[0];
cur_cmd->proc != NULL; cur_cmd++) {
cur_cmd->prefix != NULL; cur_cmd++) {
if (strstr(cmdline, cur_cmd->prefix) != cmdline) {
continue;
}
Expand All @@ -96,7 +97,9 @@ static COMMAND_RESULT Console_Eval(const char *const cmdline)
return CR_BAD_INVOCATION;
}

assert(matching_cmd->proc != NULL);
const COMMAND_RESULT result = matching_cmd->proc(args);

switch (result) {
case CR_BAD_INVOCATION:
Console_Log(GS(OSD_COMMAND_BAD_INVOCATION), cmdline);
Expand Down
Loading