Browse Source

formatting

pull/104/head
andy 3 years ago
parent
commit
7102ee7e6d
  1. 6
      src/entity/character.rs
  2. 4
      src/entity/gateway/postgres/postgres.rs
  3. 2
      src/ship/character.rs
  4. 4
      src/ship/packet/handler/lobby.rs

6
src/entity/character.rs

@ -311,13 +311,13 @@ impl CharacterKeyboardConfig {
#[derive(Clone)]
pub struct CharacterGamepadConfig {
pub gamepad_config: [u8; 56],
pub gamepad_config: [u8; 0x38],
}
impl Default for CharacterGamepadConfig {
fn default() -> CharacterGamepadConfig {
CharacterGamepadConfig {
gamepad_config: [0; 56],
gamepad_config: DEFAULT_GAMEPAD_CONFIG,
}
}
}
@ -327,7 +327,7 @@ impl CharacterGamepadConfig {
self.gamepad_config = new_config.gamepad_config;
}
pub fn as_bytes(&self) -> [u8; 56] {
pub fn as_bytes(&self) -> [u8; 0x38] {
self.gamepad_config
}
}

4
src/entity/gateway/postgres/postgres.rs

@ -144,7 +144,7 @@ impl EntityGateway for PostgresGateway {
}
async fn create_user_settings(&mut self, settings: NewUserSettingsEntity) -> Result<UserSettingsEntity, GatewayError> {
let new_settings = sqlx::query_as::<_, PgUserSettings>("insert into user_settings (user_account, blocked_users, key_config, gamepad_config, option_flags, shortcuts, symbol_chats, team_name)
let new_settings = sqlx::query_as::<_, PgUserSettings>("insert into user_settings (user_account, blocked_users, keyboard_config, gamepad_config, option_flags, shortcuts, symbol_chats, team_name)
values ($1, $2, $3, $4, $5, $6, $7, $8) returning *;")
.bind(settings.user_id.0)
.bind(settings.settings.blocked_users.iter().copied().flat_map(|i| i.to_le_bytes().to_vec()).collect::<Vec<u8>>())
@ -166,7 +166,7 @@ impl EntityGateway for PostgresGateway {
}
async fn save_user_settings(&mut self, settings: &UserSettingsEntity) -> Result<(), GatewayError> {
sqlx::query("update user_settings set blocked_users=$1, key_config=$2, gamepad_config=$3, option_flags=$4, shortcuts=$5, symbol_chats=$6, team_name=$7 where id=$8")
sqlx::query("update user_settings set blocked_users=$1, keyboard_config=$2, gamepad_config=$3, option_flags=$4, shortcuts=$5, symbol_chats=$6, team_name=$7 where id=$8")
.bind(settings.settings.blocked_users.iter().copied().flat_map(|i| i.to_le_bytes().to_vec()).collect::<Vec<u8>>())
.bind(&settings.settings.keyboard_config.to_vec())
.bind(&settings.settings.gamepad_config.to_vec())

2
src/ship/character.rs

@ -174,7 +174,7 @@ impl<'a> FullCharacterBytesBuilder<'a> {
}
#[must_use]
pub fn joystick_config(self, gamepad_config: &'a [u8; 0x38]) -> FullCharacterBytesBuilder<'a> {
pub fn gamepad_config(self, gamepad_config: &'a [u8; 0x38]) -> FullCharacterBytesBuilder<'a> {
FullCharacterBytesBuilder {
gamepad_config: Some(gamepad_config),
..self

4
src/ship/packet/handler/lobby.rs

@ -32,10 +32,8 @@ pub fn block_selected(id: ClientId,
.meseta(*meseta)
.inventory(inventory)
.bank(bank)
// .keyboard_config(&client.settings.settings.keyboard_config)
// .joystick_config(&client.settings.settings.joystick_config)
.keyboard_config(&client.character.keyboard_config.as_bytes())
.joystick_config(&client.character.gamepad_config.as_bytes())
.gamepad_config(&client.character.gamepad_config.as_bytes())
.symbol_chat(&client.settings.settings.symbol_chats)
.tech_menu(&client.character.tech_menu.as_bytes())
.option_flags(client.character.option_flags)

Loading…
Cancel
Save