-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModel.h
75 lines (72 loc) · 2.18 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
67
68
69
70
71
72
73
74
#pragma once
#include <iostream>
#include <vector>
#include <memory>
#include "Castle.h"
#include "Thug.h"
#include "Knight.h"
#include "FileOpener.h"
#include "View.h"
#include "Farm.h"
using namespace std;
class Model
{
private :
Model(){ }
~Model() { }
static Model* ptr;
int time;
vector<vector<string>> attacksHeld;
AgentFactory af;
vector<shared_ptr<Castle>> castles;
vector<shared_ptr<Farm>> farms;
//vector<shared_ptr<Peasant>> peasants;
vector<shared_ptr<Agent>> agents;
vector<shared_ptr<Zone>> zones;
shared_ptr<Castle> get_castle(string name);
vector<shared_ptr<Castle>> get_castleS();
shared_ptr<Farm> get_farm(string name);
vector<shared_ptr<Farm>> get_farmS();
public:
static void ResetInstance()
{
delete ptr;
ptr = NULL;
}
void addAttacks(vector<string> a);
int getTime() { return time; }
void go();
void set_on_course(vector<string> tokens);
static Coordinate create_coordinate(string str_x, string str_y); //foramt must be (x, y)
static Model& get_Instance();
Model(const Model&) = delete;
Model& operator= (const Model&) = delete;
Model(const Model&&) = delete;
Model& operator= (const Model&&) = delete;
void initModel(int argc, char* argv[]);
void set_to_default();
void print_status();
bool agent_exist(string str);
shared_ptr<Agent> find_agent(string str);
void create_agent(AgentFactory::TYPE type, vector<string> tokens);
bool is_castle_exist(string name);
bool is_farm_exist(string name);
bool is_castle_exist(Coordinate pos);
bool is_farm_exist(Coordinate pos);
bool check_if_peasant(string name);
shared_ptr<Knight> get_knight_given_name(string name);
shared_ptr<Thug> get_thug_given_name(string name);
void stop_agent(string name);
void set_destination_for_knight(vector<string> tokens);
void swapForFirst(string);
void position(vector<string>);
void attack(vector<string> tokens);
bool safe_to_attack(Coordinate );
shared_ptr<Peasant> get_peasant_given_name(string name);
shared_ptr<Farm> get_farm_given_name(string name);
//shared_ptr<Zone> get_Zone_given_name(string name);
shared_ptr<Castle> get_castle_given_name(string name);
void updateView();
void start_peasant_work(vector<string> tokens);
void peasant_status(string);
};