diff --git a/prototypes/src/prototypes/company.rs b/prototypes/src/prototypes/company.rs index 5ca9e957..43871350 100644 --- a/prototypes/src/prototypes/company.rs +++ b/prototypes/src/prototypes/company.rs @@ -1,11 +1,34 @@ use crate::prototypes::PrototypeBase; use crate::{get_with_err, GoodsCompanyID, Prototype, Recipe, Zone}; -use egui_inspect::debug_inspect_impl; +use egui_inspect::{debug_inspect_impl, Inspect}; use geom::Vec2; use mlua::{FromLua, Lua, Table, Value}; use serde::{Deserialize, Serialize}; use std::ops::Deref; +#[derive(Debug, Copy, Clone, Serialize, Deserialize)] +pub enum BuildingGen { + House, + Farm, + CenteredDoor { + vertical_factor: f32, // 1.0 means that the door is at the bottom, just on the street + }, + NoWalkway { + door_pos: Vec2, // door_pos is relative to the center of the building + }, +} +debug_inspect_impl!(BuildingGen); + +#[derive(Copy, Clone, Serialize, Deserialize, Debug, PartialEq, Eq, Inspect)] +pub enum CompanyKind { + /// Buyers come to get their goods + Store, + /// Buyers get their goods delivered to them + Factory, + /// Buyers get their goods instantly delivered, useful for things like electricity/water/.. + Network, +} + #[derive(Debug)] pub struct GoodsCompanyPrototype { pub base: PrototypeBase, @@ -56,16 +79,6 @@ impl Deref for GoodsCompanyPrototype { } } -#[derive(Copy, Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] -pub enum CompanyKind { - // Buyers come to get their goods - Store, - // Buyers get their goods delivered to them - Factory, - // Buyers get their goods instantly delivered, useful for things like electricity/water/.. - Network, -} - impl<'a> FromLua<'a> for CompanyKind { fn from_lua(value: Value<'a>, lua: &'a Lua) -> mlua::Result { let s: String = FromLua::from_lua(value, lua)?; @@ -81,22 +94,6 @@ impl<'a> FromLua<'a> for CompanyKind { } } -debug_inspect_impl!(CompanyKind); - -#[derive(Debug, Copy, Clone, Serialize, Deserialize)] -pub enum BuildingGen { - House, - Farm, - CenteredDoor { - vertical_factor: f32, // 1.0 means that the door is at the bottom, just on the street - }, - NoWalkway { - door_pos: Vec2, // door_pos is relative to the center of the building - }, -} - -debug_inspect_impl!(BuildingGen); - impl<'a> FromLua<'a> for BuildingGen { fn from_lua(value: Value<'a>, _: &'a Lua) -> mlua::Result { let table = match value { diff --git a/simulation/src/souls/human.rs b/simulation/src/souls/human.rs index 8950f8ac..9445b996 100644 --- a/simulation/src/souls/human.rs +++ b/simulation/src/souls/human.rs @@ -33,14 +33,12 @@ pub enum HumanDecisionKind { MultiStack(Vec), } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, Inspect)] pub enum Gender { M, F, } -debug_inspect_impl!(Gender); - #[derive(Inspect, Serialize, Deserialize)] pub struct PersonalInfo { pub name: String, diff --git a/simulation/src/transportation/mod.rs b/simulation/src/transportation/mod.rs index 38279e62..a4418db9 100644 --- a/simulation/src/transportation/mod.rs +++ b/simulation/src/transportation/mod.rs @@ -38,13 +38,12 @@ impl Debug for Speed { } } -#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Inspect)] pub enum TransportationGroup { Unknown, Vehicles, Pedestrians, } -debug_inspect_impl!(TransportationGroup); #[derive(Copy, Clone, Serialize, Deserialize, Inspect)] pub struct TransportState { diff --git a/simulation/src/transportation/train.rs b/simulation/src/transportation/train.rs index 8acf4e75..a2ed2eaa 100644 --- a/simulation/src/transportation/train.rs +++ b/simulation/src/transportation/train.rs @@ -38,15 +38,13 @@ pub struct LocomotiveReservation { upcoming_inters: Vec, } -#[derive(Debug, Copy, Clone, Serialize, Deserialize)] +#[derive(Debug, Copy, Clone, Serialize, Deserialize, Inspect)] pub enum RailWagonKind { Locomotive, Passenger, Freight, } -debug_inspect_impl!(RailWagonKind); - #[derive(Inspect, Serialize, Deserialize)] pub struct RailWagon { pub kind: RailWagonKind, diff --git a/simulation/src/transportation/vehicle.rs b/simulation/src/transportation/vehicle.rs index 79464617..5712c78d 100644 --- a/simulation/src/transportation/vehicle.rs +++ b/simulation/src/transportation/vehicle.rs @@ -23,7 +23,7 @@ pub enum VehicleState { debug_inspect_impl!(VehicleState); -#[derive(Copy, Clone, Debug, Serialize, Deserialize)] +#[derive(Copy, Clone, Debug, Serialize, Deserialize, Inspect)] pub enum VehicleKind { Car, Truck, @@ -222,5 +222,3 @@ impl Vehicle { } } } - -debug_inspect_impl!(VehicleKind);