fix 6x69 client ID check
This commit is contained in:
@@ -4559,7 +4559,7 @@ struct G_CreateTelepipe_6x68 {
|
||||
struct G_NPCControl_6x69 {
|
||||
G_UnusedHeader header;
|
||||
le_uint16_t state = 0;
|
||||
le_uint16_t npc_client_id = 0;
|
||||
le_uint16_t npc_entity_id = 0;
|
||||
le_uint16_t command = 0; // 0 = create follower NPC, 1 = stop acting, 2 = start acting, 3 = create attacker NPC
|
||||
le_uint16_t npc_template_index = 0; // Specifies which NPC to create if command == 0 or 3; unused otherwise
|
||||
} __packed__;
|
||||
|
||||
@@ -1017,10 +1017,7 @@ static void on_npc_control(shared_ptr<Client> c, uint8_t command, uint8_t flag,
|
||||
if (!l->is_game()) {
|
||||
throw runtime_error("cannot create NPCs in the lobby");
|
||||
}
|
||||
if (cmd.npc_client_id >= 4) {
|
||||
throw runtime_error("NPC client ID is not valid");
|
||||
}
|
||||
if (l->clients[cmd.npc_client_id]) {
|
||||
if ((cmd.npc_entity_id < 4) && l->clients[cmd.npc_entity_id]) {
|
||||
throw runtime_error("cannot overwrite existing player with NPC");
|
||||
}
|
||||
forward_subcommand(c, command, flag, data, size);
|
||||
|
||||
Reference in New Issue
Block a user