Author SHA1 Message Date
shenleiandClaude Opus 5.5 3590a06946 Keep feature commands at the end of the command table
interpret_command picks the first entry whose name starts with the typed
command. mt_features sat near the top, so /m ran mt_features instead of mob
and /mt instead of mto. The four mt_* entries now sit after the original
commands; test_cmd_prefix.py checks that no original abbreviation changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 01:37:41 +09:00
shenleiandClaude Opus 5.5 06b96c62d1 Record the batch chest production deploy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 23:47:49 +09:00
3 changed files with 49 additions and 4 deletions
+6
View File
@@ -50,3 +50,9 @@ There is no MTF1 capability bit (the mask stays 511). The client marks the serve
- remaining 20 of 50037 → `done 50037 20 20 done 0`, 11 gained vnums;
- plain right click without Ctrl still uses one box the original way.
- `log.log` only has the original path's rows (`SYSTEM`, `TREASURE_EXP`, `TREASURE_GOLD`). syserr shows only the pre-existing `new_quest_lv52` LUA_ERROR.
## Production deployment
- Deployed 2026-10-15 16:43 with the user's approval, 0 players online. Server main bc32475, game sha256 `412977c7…` (the channel-5 tested binary), db unchanged. Package `/root/deploy-features/20261015-chest`, backup `/root/backup-bin/20261015-164314`, rollback `sh /root/deploy-features/20261015-chest/deploy.sh rollback`. `/usr/metin2/src` was synced (cmd.cpp, cmd_general.cpp, port_chest.h).
- On the first start the db core exited at boot (`QueryLocaleSet: ... errno 2013 Lost connection to MySQL server during query`, db.core kept as `db.core.164339` in the package). MySQL itself had not restarted and the db binary is unchanged. A clean stop of every core and a db-first start (db, auth, CH1–CH4, game99, then channel5) came up normally: 14 game, 1 db, 1 auth, port 15000 listening. If this repeats, check `ps` for `./db` after every deploy, not only the game count.
- CH1 (13000) acceptance with the channel-5 scenario: 50037 ×10 → `done 50037 10 10 done 0` (8 vnums, equal to the bag difference); 50070 ×4 in 4 cells → `done 50070 4 4 done 100000`; 71036 → `error kind`, then `error rate`; remaining 20 → `done 50037 20 20 done 0`; plain use unchanged. syserr only has the pre-existing `new_quest_lv52` LUA_ERROR.
+6 -4
View File
@@ -287,10 +287,6 @@ struct command_info cmd_info[] =
{
{ "!RESERVED!", NULL, 0, POS_DEAD, GM_IMPLEMENTOR }, /* 반드시 이 것이 처음이어야 한다. */
{ "autohunt_pull", do_autohunt_pull, 0, POS_STANDING, GM_PLAYER },
{ "mt_features", do_port_features, 0, POS_DEAD, GM_PLAYER },
{ "mt_switchbot", do_port_switchbot, 0, POS_DEAD, GM_PLAYER },
{ "mt_pickup", do_port_pickup, 0, POS_DEAD, GM_PLAYER },
{ "mt_chest", do_port_chest, 0, POS_DEAD, GM_PLAYER },
{ "bio", do_port_biolog, 0, POS_DEAD, GM_PLAYER },
{ "biolog", do_port_biolog, 0, POS_DEAD, GM_PLAYER },
{ "server_bonuses", do_server_bonuses, 0, POS_DEAD, GM_PLAYER },
@@ -603,6 +599,12 @@ struct command_info cmd_info[] =
{ "ds_list", do_ds_list, 0, POS_DEAD, GM_PLAYER },
{ "do_clear_affect", do_clear_affect, 0, POS_DEAD, GM_LOW_WIZARD},
// PORT: feature commands stay at the end: commands are prefix matched in table order, so an entry placed
// earlier would take over abbreviations of original commands (/m -> mob, /mt -> mto).
{ "mt_features", do_port_features, 0, POS_DEAD, GM_PLAYER },
{ "mt_switchbot", do_port_switchbot, 0, POS_DEAD, GM_PLAYER },
{ "mt_pickup", do_port_pickup, 0, POS_DEAD, GM_PLAYER },
{ "mt_chest", do_port_chest, 0, POS_DEAD, GM_PLAYER },
{ "\n", NULL, 0, POS_DEAD, GM_IMPLEMENTOR } /* 반드시 이 것이 마지막이어야 한다. */
};
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
"""Port commands must not take over abbreviations of the original commands.
interpret_command (cmd.cpp) picks the first table entry whose name starts with the typed command
(strncmp over the typed length; do_cmd entries need an exact match). A port command placed before an
original one would steal its abbreviations, as mt_features once did with /m (mob) and /mt (mto).
"""
from pathlib import Path
import re
ROOT=Path(__file__).resolve().parents[2]
text=(ROOT/'src/server/game/src/cmd.cpp').read_bytes().decode('latin1')
table=text.split('struct command_info cmd_info[] =',1)[1]
entries=re.findall(r'\{\s*"((?:[^"\\]|\\.)*)",\s*([A-Za-z_0-9]+|NULL)',table)
assert entries[0][0]=='!RESERVED!'
end=[i for i,(name,_) in enumerate(entries) if name=='\\n']
assert end,'table sentinel not found'
entries=entries[1:end[0]]
PORT=lambda name:name.startswith('mt_')
port=[name for name,_ in entries if PORT(name)]
assert {'mt_features','mt_switchbot','mt_pickup','mt_chest'}<=set(port),port
def resolve(rows,cmd):
for name,fn in rows:
if fn=='do_cmd':
if name==cmd:return name
elif name.startswith(cmd):return name
return None
original=[(name,fn) for name,fn in entries if not PORT(name)]
for name in port:assert resolve(entries,name)==name,name
for name,_ in original:
for k in range(1,len(name)+1):
typed=name[:k]
assert resolve(entries,typed)==resolve(original,typed),'/%s now runs %s instead of %s'%(typed,resolve(entries,typed),resolve(original,typed))
for typed in ('m','mt','mo'):assert not PORT(resolve(entries,typed) or ''),typed
assert resolve(entries,'m')=='mob' and resolve(entries,'mt')=='mto'
print('cmd prefix ok: %d commands, %d port'%(len(entries),len(port)))