2020-04-21 23:45:40 -06:00
|
|
|
use libpso::packet::ship::*;
|
|
|
|
use crate::common::serverstate::ClientId;
|
2020-05-02 22:08:37 -03:00
|
|
|
use crate::ship::ship::{SendShipPacket, ShipError, Clients};
|
2020-04-21 23:45:40 -06:00
|
|
|
use crate::entity::gateway::EntityGateway;
|
|
|
|
|
|
|
|
pub fn update_config<EG: EntityGateway>(id: ClientId,
|
|
|
|
update_config: &UpdateConfig,
|
2020-04-22 23:49:49 -06:00
|
|
|
clients: &mut Clients,
|
2020-04-21 23:45:40 -06:00
|
|
|
entity_gateway: &mut EG)
|
|
|
|
-> Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send> {
|
|
|
|
let client = clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id)).unwrap();
|
|
|
|
client.character.config.update(update_config);
|
|
|
|
entity_gateway.save_character(&client.character);
|
|
|
|
Box::new(None.into_iter())
|
|
|
|
}
|