-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScenarioLoader.h
80 lines (71 loc) · 2.22 KB
/
ScenarioLoader.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
75
76
77
78
79
80
/* -*- Mode: C++; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* scenarioLoader.h
* hog
*
* Created by Renee Jansen on 5/2/2006
* Cleaned up by Marzo Sette Torres Junior <[email protected]>
*
*/
#ifndef SCENARIOLOADER_H
#define SCENARIOLOADER_H
#include <vector>
#include <cstring>
#include <string>
using std::string;
static const int kNoScaling = -1;
/**
* Experiments stored by the ScenarioLoader class.
*/
class ScenarioLoader;
class Experiment {
public:
Experiment(int sx,int sy,int gx,int gy,int b, double d, string m)
: startx(sx), starty(sy), goalx(gx), goaly(gy), scaleX(kNoScaling),
scaleY(kNoScaling), bucket(b), distance(d), map(m) {
}
Experiment(int sx,int sy,int gx,int gy,int sizeX, int sizeY,int b, double d,
string m)
: startx(sx), starty(sy), goalx(gx), goaly(gy), scaleX(sizeX),
scaleY(sizeY), bucket(b), distance(d), map(m) {
}
int GetStartX() const { return startx; }
int GetStartY() const { return starty; }
int GetGoalX() const { return goalx; }
int GetGoalY() const { return goaly; }
int GetBucket() const { return bucket; }
double GetDistance() const { return distance; }
void GetMapName(char* mymap) const { strcpy(mymap,map.c_str()); }
string const &GetMapName() const { return map; }
int GetXScale() const { return scaleX; }
int GetYScale() const { return scaleY; }
private:
friend class ScenarioLoader;
int startx, starty, goalx, goaly;
int scaleX;
int scaleY;
int bucket;
double distance;
string map;
};
/** A class which loads and stores scenarios from files.
* Versions currently handled: 0.0 and 1.0 (includes scale).
*/
class ScenarioLoader {
public:
ScenarioLoader() { scenName[0] = 0; }
ScenarioLoader(const char *);
void Save(const char *) const;
int GetNumExperiments() const { return experiments.size(); }
char const *GetScenarioName() const { return scenName; }
Experiment const &GetNthExperiment(int which) const {
return experiments[which];
}
void AddExperiment(Experiment const &which) {
experiments.push_back(which);
}
private:
char scenName[1024];
std::vector<Experiment> experiments;
};
#endif