forked from miki151/keeperrl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.h
66 lines (51 loc) · 2.04 KB
/
model.h
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
#ifndef _MODEL_H
#define _MODEL_H
#include <vector>
#include <queue>
#include "util.h"
#include "level.h"
#include "action.h"
#include "level_generator.h"
#include "square_factory.h"
#include "monster.h"
#include "level_maker.h"
class Collective;
/**
* Main class that holds all game logic.
*/
class Model {
public:
Model(View* view);
/** Generates levels and all game entities for a single player game. */
static Model* heroModel(View* view);
/** Generates levels and all game entities for a collective game. */
static Model* collectiveModel(View* view);
/** Makes an update to the game. This method is repeatedly called to make the game run.
Returns the total logical time elapsed.*/
void update(double totalTime);
/** Removes creature from current level and puts into the next, according to direction. */
Vec2 changeLevel(StairDirection direction, StairKey key, Creature*);
/** Removes creature from current level and puts into the given level */
void changeLevel(Level*, Vec2 position, Creature*);
/** Adds new creature to the queue. Assumes this creature has already been added to a level. */
void addCreature(PCreature);
/** Removes creature from the queue. Assumes it has already been removed from its level. */
void removeCreature(Creature*);
bool isTurnBased();
void gameOver(const Creature* player, int numKills, const string& enemiesString, int points);
void conquered(const string& title, const string& land, vector<const Creature*> kills, int points);
void showHighscore(bool highlightLast = false);
private:
Level* buildLevel(Level::Builder&& b, LevelMaker*, bool surface = false);
void addLink(StairDirection, StairKey, Level*, Level*);
Level* prepareTopLevel(vector<SettlementInfo> settlements);
Level* prepareTopLevel2(vector<SettlementInfo> settlements);
vector<PLevel> levels;
View* view;
TimeQueue timeQueue;
vector<PCreature> deadCreatures;
double lastTick = -1000;
map<tuple<StairDirection, StairKey, Level*>, Level*> levelLinks;
Collective* collective = nullptr;
};
#endif