Skip to content

Commit

Permalink
Fixed project not building before ECS rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
ekosachev committed Aug 1, 2024
1 parent 709d0dd commit 63f2bb6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 28 deletions.
11 changes: 1 addition & 10 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::game::celestial_bodies::Displayable;
use crate::game::colony::building::BuildingType;
use crate::game::colony::colony::Colony;
use crate::game::game_state::GameState;
use crate::game::shipbuilding::ship_module::ShipModule;
use crate::mode::Mode::{SelectingBodyInSystemTree, SelectingResearchField};
use crate::tabs::Tabs;

Expand Down Expand Up @@ -325,16 +326,6 @@ impl App {
)
)?;
},
Action::ScheduleLoadShipModulesForType(ref module_type_name) => {
let module_type = self.state.get_ship_module_type_by_name(module_type_name);
let modules: Vec<T> = self.state.get_ship_modules_by_type(module_type);
let data: Vec<(String, Color)> = modules.iter().map(
|m| {
(m.get_name(), m.get_menu_color())
}
);
action_tx.send(Action::LoadShipModulesForType(data))?;
}
_ => {},
}
for component in self.components.iter_mut()
Expand Down
4 changes: 2 additions & 2 deletions src/components/ship_module_designer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ impl Component for ShipModuleDesigner {
}
}
Action::ContinueSelecting => {
self.state = WidgetState::SelectingModule
return Ok(Some(Action::))
self.state = WidgetState::SelectingModule;
return Ok(None)
}
Action::SelectNext => {
match self.state {
Expand Down
16 changes: 8 additions & 8 deletions src/game/game_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::game::celestial_bodies::solar_system::SolarSystem;
use crate::game::colony::building::BuildingType;
use crate::game::colony::colony::Colony;
use crate::game::research::research_manager::ResearchManager;
use crate::game::shipbuilding::ship_module::{ShipModule, ShipModuleType};
use crate::game::shipbuilding::ship_module::ShipModuleType;
use crate::game::shipbuilding::ship_module_manager::ShipModuleManager;

pub struct GameState {
Expand Down Expand Up @@ -130,11 +130,11 @@ impl GameState {
self.ship_module_manager.get_ship_module_types()
}

pub fn get_ship_module_type_by_name(&self, name: String) -> ShipModuleType {
self.ship_module_manager.get_ship_module_type_by_name(name)
}

pub fn get_ship_modules_by_type<T: ShipModule>(&self, module_type: ShipModuleType) -> Vec<T> {
self.ship_module_manager.get_ship_modules_by_type(module_type)
}
// pub fn get_ship_module_type_by_name(&self, name: String) -> ShipModuleType {
// self.ship_module_manager.get_ship_module_type_by_name(name)
// }
//
// pub fn get_ship_modules_by_type<T: ShipModule>(&self, module_type: ShipModuleType) -> Vec<T> {
// self.ship_module_manager.get_ship_modules_by_type(module_type)
// }
}
2 changes: 1 addition & 1 deletion src/game/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ pub mod research;
pub mod game_state;
pub mod colony;
mod resource;
mod shipbuilding;
pub mod shipbuilding;
14 changes: 7 additions & 7 deletions src/game/shipbuilding/ship_module_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ impl ShipModuleManager {
ShipModuleType::from(name)
}

pub fn get_ship_modules_by_type<T: ShipModule>(&self, module_type: ShipModuleType) -> Vec<T> {
let modules = match module_type {
ShipModuleType::SublightThruster => { self.sublight_engines.clone() }
};
modules
}
// pub fn get_ship_modules_by_type<T: ShipModule>(&self, module_type: ShipModuleType) -> Vec<T> {
// let modules = match module_type {
// ShipModuleType::SublightThruster => { self.sublight_engines.clone() }
// };
//
// modules
// }
}

0 comments on commit 63f2bb6

Please sign in to comment.