mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 18:03:37 +02:00
Spawn some herbs at startup
This commit is contained in:
parent
b80ccfdffd
commit
4d697adc83
4 changed files with 27 additions and 0 deletions
9
main.cc
9
main.cc
|
@ -23,6 +23,7 @@ int
|
|||
main(int argc, char *argv[])
|
||||
{
|
||||
class map map(argc < 2 ? 40 : atoi(argv[1]), argc < 3 ? 20 : atoi(argv[2]));
|
||||
int herbs = argc < 4 ? map.w * map.h / world::herb_rate : atoi(argv[3]);
|
||||
|
||||
srandom(time(NULL));
|
||||
|
||||
|
@ -44,6 +45,14 @@ main(int argc, char *argv[])
|
|||
std::list<class agent *> agents;
|
||||
int aid = 0;
|
||||
|
||||
/* Spawn herbs. */
|
||||
|
||||
for (int i = 0; i < herbs; i++) {
|
||||
class agent *a = new class herb(aid++, map);
|
||||
agents.push_back(a);
|
||||
a->spawn();
|
||||
}
|
||||
|
||||
/* Main tick loop. */
|
||||
|
||||
while (true) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue