OpenAstra
 
Loading...
Searching...
No Matches
modulemanager.h
1#ifndef MODULEMANAGER_H
2#define MODULEMANAGER_H
3
4#include "module.h"
5
7
8class ModuleManager
9{
10public:
11 ModuleManager( std::shared_ptr<StarsystemObject> owner );
12
13 bool modulesFromTemplate( const nlohmann::json& config );
14
15 virtual ~ModuleManager();
16
17 void replaceModule(std::shared_ptr<Module> new_module, int64_t slot );
18 void replaceModule(const std::string& module_type, int64_t slot );
19
20 std::vector<std::shared_ptr<Module>> getModules();
21
22 std::shared_ptr<Module> getModule( ObjectId module_id ) const;
23
24 virtual void tick( double delta_time_s, double current_time_s );
25
26private:
27 std::shared_ptr<StarsystemObject> _owner;
28
29 bool checkAddToMap( std::map<std::string, int64_t>& map, const std::string& value );
30 bool checkRemoveFromMap( std::map<std::string, int64_t>& map, const std::string& value );
31
32 std::map<std::string, int64_t> _aggregate_values_map;
33 std::map<std::string, int64_t> _aggregate_capacities_map;
34 std::map<std::string, int64_t> _transform_sources_targets_map;
35
36 void finalizeUndumpModules();
37};
38
39#endif // MODULEMANAGER_H
Definition gameid.hpp:9
Definition starsystemobject.h:14