diff options
Diffstat (limited to 'crates/whirl_server/src/cmd')
| -rw-r--r-- | crates/whirl_server/src/cmd/commands/appear_actor.rs | 4 | ||||
| -rw-r--r-- | crates/whirl_server/src/cmd/commands/register_object_id.rs | 2 | ||||
| -rw-r--r-- | crates/whirl_server/src/cmd/structure.rs | 6 |
3 files changed, 5 insertions, 7 deletions
diff --git a/crates/whirl_server/src/cmd/commands/appear_actor.rs b/crates/whirl_server/src/cmd/commands/appear_actor.rs index 836c681..6100fcc 100644 --- a/crates/whirl_server/src/cmd/commands/appear_actor.rs +++ b/crates/whirl_server/src/cmd/commands/appear_actor.rs @@ -25,8 +25,8 @@ impl Creatable for AppearActor { command.put_i8(Command::ApprActr as i32 as i8); // Type // Content - command.put_i8(self.short_object_id as i8); // ObjId, why is it here? Worlds... - command.put_u16(self.room_id as u16); // Room ID + command.put_i8(self.short_object_id); // ObjId, why is it here? Worlds... + command.put_u16(self.room_id); // Room ID command.put_u16(self.x as u16); // X command.put_u16(self.y as u16); // Y command.put_u16(self.z as u16); // Z diff --git a/crates/whirl_server/src/cmd/commands/register_object_id.rs b/crates/whirl_server/src/cmd/commands/register_object_id.rs index 7791ae2..bdf4bca 100644 --- a/crates/whirl_server/src/cmd/commands/register_object_id.rs +++ b/crates/whirl_server/src/cmd/commands/register_object_id.rs @@ -23,7 +23,7 @@ impl Creatable for RegisterObjectId { // Content command.put_u8(self.long_object_id.len() as u8); // Long object ID length command.put_slice(self.long_object_id.as_bytes()); // Long object ID - command.put_i8(self.short_object_id as i8); // Short object ID + command.put_i8(self.short_object_id); // Short object ID // Length let mut command_as_vec = command.to_vec(); diff --git a/crates/whirl_server/src/cmd/structure.rs b/crates/whirl_server/src/cmd/structure.rs index 54d47ed..de6567e 100644 --- a/crates/whirl_server/src/cmd/structure.rs +++ b/crates/whirl_server/src/cmd/structure.rs @@ -1,6 +1,7 @@ // Copyright (C) 2021-2021 The Whirlsplash Collective // SPDX-License-Identifier: GPL-3.0-only +#[derive(Default)] pub struct Command { pub length: i32, pub obj_id: i32, @@ -32,7 +33,7 @@ impl Command { body: vec![], }; if command.length > 3 { - command.body = data[3..].to_owned(); + data[3..].clone_into(&mut command.body); } command_set.push(command); @@ -44,6 +45,3 @@ impl Command { command_set } } -impl Default for Command { - fn default() -> Self { Self { length: 0, obj_id: 0, id: 0, body: vec![] } } -} |