Skip to content

Commit

Permalink
修正 sethotkey / gethotkey 无法正确判断有效索引最大值问题 (感谢 "jian916" 修正) (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
CairoLee authored Sep 16, 2024
1 parent cc0c821 commit 8078158
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/map/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29263,8 +29263,8 @@ BUILDIN_FUNC(gethotkey) {
}

int hotkey_idx = script_getnum(st, 2);
if (hotkey_idx < 0 || hotkey_idx > MAX_HOTKEYS) {
ShowError("buildin_gethotkey: hotkey index %d is out of range (0..%d).\n", hotkey_idx, MAX_HOTKEYS);
if (hotkey_idx < 0 || hotkey_idx > MAX_HOTKEYS_DB) {
ShowError("buildin_gethotkey: hotkey index %d is out of range (0..%d).\n", hotkey_idx, MAX_HOTKEYS_DB);
script_pushint(st, -1);
return SCRIPT_CMD_SUCCESS;
}
Expand Down Expand Up @@ -29317,8 +29317,8 @@ BUILDIN_FUNC(sethotkey) {
}

int hotkey_idx = script_getnum(st, 2);
if (hotkey_idx < 0 || hotkey_idx > MAX_HOTKEYS) {
ShowError("buildin_sethotkey: hotkey index %d is out of range (0..%d).\n", hotkey_idx, MAX_HOTKEYS);
if (hotkey_idx < 0 || hotkey_idx > MAX_HOTKEYS_DB) {
ShowError("buildin_sethotkey: hotkey index %d is out of range (0..%d).\n", hotkey_idx, MAX_HOTKEYS_DB);
script_pushint(st, 0);
return SCRIPT_CMD_SUCCESS;
}
Expand Down

0 comments on commit 8078158

Please sign in to comment.