Browse Source

Renamed 'Owned' to 'PlayerOwned'

master
Bergmann89 3 years ago
parent
commit
dc2e4e09a8
2 changed files with 9 additions and 9 deletions
  1. +1
    -1
      space-crush-common/src/components/mod.rs
  2. +8
    -8
      space-crush-common/src/components/player.rs

+ 1
- 1
space-crush-common/src/components/mod.rs View File

@@ -13,7 +13,7 @@ pub use fleet::{Fleet, FleetOwned};
pub use meeting_point::{MeetingPoint, MeetingPointOwned};
pub use obstacle::Obstacle;
pub use planet::Planet;
pub use player::{Owned as PlayerOwned, Player};
pub use player::{Player, PlayerOwned};
pub use position::{Position, Shape};
pub use ship::{Count as ShipCount, Obstacle as ShipObstacle, Ship, Type as ShipType};
pub use velocity::Velocity;

+ 8
- 8
space-crush-common/src/components/player.rs View File

@@ -13,12 +13,12 @@ pub struct Player {
}

#[derive(Copy, Clone, Debug)]
pub struct Owned {
pub struct PlayerOwned {
owner: Entity,
}

#[derive(Serialize, Deserialize)]
pub struct OwnedData<M> {
pub struct PlayerOwnedData<M> {
pub owner: M,
}

@@ -46,7 +46,7 @@ impl Component for Player {
type Storage = HashMapStorage<Self>;
}

impl Owned {
impl PlayerOwned {
pub fn new(owner: Entity) -> Self {
Self { owner }
}
@@ -56,15 +56,15 @@ impl Owned {
}
}

impl Component for Owned {
impl Component for PlayerOwned {
type Storage = HashMapStorage<Self>;
}

impl<M> ConvertSaveload<M> for Owned
impl<M> ConvertSaveload<M> for PlayerOwned
where
for<'de> M: Marker + Serialize + Deserialize<'de>,
{
type Data = OwnedData<M>;
type Data = PlayerOwnedData<M>;
type Error = NoError;

fn convert_into<F>(&self, mut ids: F) -> Result<Self::Data, Self::Error>
@@ -73,7 +73,7 @@ where
{
let owner = ids(self.owner).unwrap();

Ok(OwnedData { owner })
Ok(PlayerOwnedData { owner })
}

fn convert_from<F>(data: Self::Data, mut ids: F) -> Result<Self, Self::Error>
@@ -82,7 +82,7 @@ where
{
let owner = ids(data.owner).unwrap();

Ok(Owned { owner })
Ok(PlayerOwned { owner })
}
}



Loading…
Cancel
Save