summary refs log tree commit diff stats
path: root/src/systems/realizing.h
blob: ab5a150d3a164279ad455cc4c9ae0f07f0e75c84 (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
78
79
80
81
82
83
84
85
86
#ifndef REALIZING_H_6853748C
#define REALIZING_H_6853748C

#include <string>
#include <map>
#include "system.h"
#include "vector.h"

class RealizingSystem : public System {
public:

  /**
   * Constructs the realizing system.
   *
   * Note that this must be constructed after the following system:
   * - Mapping
   * - Animating
   * - Pondering
   * - Scripting
   */
  RealizingSystem(
    Game& game,
    std::string worldFile,
    std::string prototypeFile);

  id_type getActiveMap() const
  {
    return activeMap_;
  }

  int getStartingMapId() const
  {
    return startingMapId_;
  }

  vec2i getStartingPos() const
  {
    return startingPos_;
  }

  id_type getEntityByMapId(size_t mapId) const
  {
    return entityByMapId_.at(mapId);
  }

  id_type getActivePlayer() const
  {
    return activePlayer_;
  }

  void setActivePlayer(id_type entity)
  {
    activePlayer_ = entity;
  }

  /**
   * Loads the given map.
   */
  void loadMap(id_type mapEntity);

  /**
   * Treats the given entity as part of the active map.
   */
  void enterActiveMap(id_type entity);

  /**
   * Stops treating the given entity as part of the active map.
   */
  void leaveActiveMap(id_type entity);

private:

  void deactivateMap();

  void activateMap(id_type mapEntity);

  std::string worldFile_;
  std::string prototypeFile_;
  int startingMapId_;
  vec2i startingPos_;
  std::map<size_t, id_type> entityByMapId_;
  id_type activeMap_;
  id_type activePlayer_;
};

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