Argentum Online - Servidor
map_monitor.h
1 #ifndef __MAP_MONITOR_H
2 #define __MAP_MONITOR_H
3 
4 #include <mutex>
5 #include <queue>
6 
7 #include "../../include/nlohmann/json.hpp"
8 #include "../../include/types.h"
9 #include "actions/action.h"
10 #include "map.h"
11 #include "map_log_factory.h"
12 #include "map_transitions.h"
13 
14 class MapMonitor {
15  private:
16  std::recursive_mutex m;
17  Map map;
18 
19  public:
20  MapMonitor(MapId map_id, const std::string& map_name, bool is_safe,
21  const nlohmann::json& map_description,
22  const nlohmann::json& map_mobs,
23  const nlohmann::json& map_transitions);
24  ~MapMonitor();
25 
26  MapMonitor(const MapMonitor& other) = delete;
27 
28  const std::string& get_name();
29 
30 
31  nlohmann::json add_player(nlohmann::json player_info);
32 
33  nlohmann::json rm_player(EntityId entity_id);
34 
35  position_t get_position(EntityId entity_id);
36 
37  bool entity_exists(EntityId entity_id);
38 
39  std::queue<map_change_t> get_transitions();
40 
41  /* Actualiza el estado del mapa. */
42  void update(uint64_t delta_t);
43 
44  /* Ejecuta sobre la entidad asociada al client_id la accion. */
45  void push_action(EntityId entity_id, Action* action);
46 
47  std::vector<map_log_t> get_update_logs();
48 
49  nlohmann::json get_update_data(bool update_entities);
50 
51  nlohmann::json get_map_data();
52 };
53 
54 #endif // MAP_MONITOR_H
Action
Definition: action.h:9
MapMonitor
Definition: map_monitor.h:14
Map
Definition: map.h:47
position
Definition: position.h:8