fix 6x69 command 02 checks
This commit is contained in:
@@ -4581,7 +4581,7 @@ struct G_CreateTelepipe_6x68 {
|
|||||||
|
|
||||||
struct G_NPCControl_6x69 {
|
struct G_NPCControl_6x69 {
|
||||||
G_UnusedHeader header;
|
G_UnusedHeader header;
|
||||||
le_uint16_t param1; // Commands 0/3: state; commands 1/2: npc_entity_id
|
le_uint16_t param1; // Commands 0/3: state; command 1: npc_entity_id; command 2: unknown
|
||||||
le_uint16_t param2; // Commands 0/3: npc_entity_id; commands 1/2: unused
|
le_uint16_t param2; // Commands 0/3: npc_entity_id; commands 1/2: unused
|
||||||
le_uint16_t command = 0; // 0 = create follower NPC, 1 = stop acting, 2 = start acting, 3 = create attacker NPC
|
le_uint16_t command = 0; // 0 = create follower NPC, 1 = stop acting, 2 = start acting, 3 = create attacker NPC
|
||||||
le_uint16_t param3; // Commands 0/3: npc_template_index; commands 1/2: unused
|
le_uint16_t param3; // Commands 0/3: npc_template_index; commands 1/2: unused
|
||||||
|
|||||||
@@ -1028,20 +1028,21 @@ static void on_npc_control(shared_ptr<Client> c, uint8_t command, uint8_t flag,
|
|||||||
throw runtime_error("cannot create or modify NPC in the lobby");
|
throw runtime_error("cannot create or modify NPC in the lobby");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t npc_entity_id = 0xFFFF;
|
int32_t npc_entity_id = -1;
|
||||||
switch (cmd.command) {
|
switch (cmd.command) {
|
||||||
case 0:
|
case 0:
|
||||||
case 3:
|
case 3:
|
||||||
npc_entity_id = cmd.param2;
|
npc_entity_id = cmd.param2;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
|
||||||
npc_entity_id = cmd.param1;
|
npc_entity_id = cmd.param1;
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw runtime_error("invalid 6x69 command");
|
throw runtime_error("invalid 6x69 command");
|
||||||
}
|
}
|
||||||
if ((npc_entity_id < 4) && l->clients[npc_entity_id]) {
|
if ((npc_entity_id >= 0) && (npc_entity_id < 4) && l->clients[npc_entity_id]) {
|
||||||
throw runtime_error("cannot create or modify NPC in existing player slot");
|
throw runtime_error("cannot create or modify NPC in existing player slot");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user