Index VM cpp --- VM cpp revision 18 VM cpp working copy -314 314 RedAn

 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
Index: VM.cpp
===================================================================
--- VM.cpp (revision 18)
+++ VM.cpp (working copy)
@@ -314,7 +314,7 @@
,RedAntHill = '+'
,BlackAntHill = '-'
};
-typedef vector<vector<Cell>> Matrix;
+typedef vector<vector<Cell> > Matrix;
public:
Map(const std::string& filename)
{
@@ -595,7 +595,7 @@
void step(int id)
{
if (!ant_is_alive(id)) return;
- Map::Position& p = find_ant(id);
+ Map::Position p = find_ant(id);
Ant& ant = ant_at(p);
if (ant.resting() > 0 ) { ant.set_resting(ant.resting() - 1); return;}
@@ -606,7 +606,7 @@
{
case EI_Sense:
{
- Map::Position& pos = m_map.sensed_cell(p,ant.direction(),inst.m_dir);
+ Map::Position pos = m_map.sensed_cell(p,ant.direction(),inst.m_dir);
int st = cell_matches(pos,inst.m_cond,ant.color(),inst.m_i) ? inst.m_st1 : inst.m_st2;
ant.set_state(st);
} break;
@@ -681,7 +681,7 @@
check_for_surrounded_ant_at(m_map.adjacent_cell(p,d));
}
}
- void addAnt(Map::Position& pos,Color c)
+ void addAnt(Map::Position pos,Color c)
{
Ant a(c);
a.m_id = m_maxId++;