mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 18:03:37 +02:00
map::agent_startpos(): Introduce, abstract out from main loop
This commit is contained in:
parent
ea4f18b642
commit
ec3897b29b
3 changed files with 16 additions and 6 deletions
6
main.cc
6
main.cc
|
@ -66,11 +66,7 @@ next_agent:
|
|||
int cfd = accept(lfd, NULL, NULL);
|
||||
if (cfd >= 0) {
|
||||
class connection *conn = new class connection(cfd);
|
||||
class tile *agentpos;
|
||||
do {
|
||||
agentpos = &map.tile_at(random() % map.w, random() % map.h);
|
||||
} while (agentpos->agent);
|
||||
agents.push_back(new class agent(agents.size(), *agentpos, conn));
|
||||
agents.push_back(new class agent(agents.size(), map.agent_startpos(), conn));
|
||||
}
|
||||
|
||||
/* Run on_tick everywhere. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue