summary refs log tree commit diff stats
path: root/src/components/realizable.h
blob: bc834a238583267a1465f2b5906c4b13b929b36f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef REALIZABLE_H_36D8D71E
#define REALIZABLE_H_36D8D71E

#include "component.h"
#include <set>
#include <map>
#include <sol.hpp>
#include "entity_manager.h"
#include "vector.h"

class RealizableComponent : public Component {
public:

  using id_type = EntityManager::id_type;

  /**
   * Path to the XML file containing the world definition.
   *
   * @managed_by RealizingSystem
   */
  std::string worldFile;

  /**
   * Path to the XML file containing the map object prototype definitions.
   *
   * @managed_by RealizingSystem
   */
  std::string prototypeFile;

  /**
   * Starting map and player location for a new game.
   *
   * @managed_by RealizingSystem
   */
  int startingMapId;
  vec2i startingPos;

  /**
   * The set of map entities loaded by this entity. It is only intended for
   * there to be one realizable entity, so this should contain all loaded maps.
   * The realizable entity has ownership of the loaded maps.
   *
   * @managed_by RealizingSystem
   */
  std::set<id_type> maps;

  /**
   * A lookup table that translates a map ID to the entity representing that
   * loaded map.
   *
   * @managed_by RealizingSystem
   */
  std::map<size_t, id_type> entityByMapId;

  /**
   * The entity ID of the currently active map.
   *
   * @managed_by RealizingSystem
   */
  id_type activeMap;

  /**
   * Whether or not a map has been activated yet.
   *
   * @managed_by RealizingSystem
   */
  bool hasActiveMap = false;

  /**
   * The entity ID of the currently active player.
   */
  id_type activePlayer;

  sol::state scriptEngine;
};

#endif /* end of include guard: REALIZABLE_H_36D8D71E */