mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 18:03:37 +02:00
tile::symbol() -> ::type_symbol(), ::symbol() accounts for agent id
This commit is contained in:
parent
ce6f46ef1c
commit
8e78efd7d8
2 changed files with 13 additions and 3 deletions
11
map.cc
11
map.cc
|
@ -1,6 +1,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "agent.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -22,7 +23,15 @@ tile::on_tick(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
char
|
char
|
||||||
tile_ground::symbol(void)
|
tile::symbol(void)
|
||||||
|
{
|
||||||
|
if (agent)
|
||||||
|
return '0' + (agent->id % 10);
|
||||||
|
return type_symbol();
|
||||||
|
}
|
||||||
|
|
||||||
|
char
|
||||||
|
tile_ground::type_symbol(void)
|
||||||
{
|
{
|
||||||
return '.';
|
return '.';
|
||||||
}
|
}
|
||||||
|
|
5
map.h
5
map.h
|
@ -13,11 +13,12 @@ public:
|
||||||
|
|
||||||
virtual void on_tick(void);
|
virtual void on_tick(void);
|
||||||
|
|
||||||
virtual char symbol(void) = 0;
|
char symbol(void);
|
||||||
|
virtual char type_symbol(void) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class tile_ground : public tile {
|
class tile_ground : public tile {
|
||||||
char symbol(void);
|
char type_symbol(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class position {
|
class position {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue