Commit 08833c9c authored by Thomas Pitiot 's avatar Thomas Pitiot

up

parent 900ad261
......@@ -15,7 +15,7 @@ public:
Agent(Simulator* sim,VEC3 startingPoint,std::vector<VEC3> goals);
Agent(Simulator* sim, VEC3 startingPoint,std::vector<VEC3> goals,Dart d) ;
~Agent();
void init(VEC3 startingPoint,std::vector<VEC3> goals,Dart d);
void init(Simulator * sim ,VEC3 startingPoint,std::vector<VEC3> goals,Dart d);
void updatePosition();
......
#include "simulator.h"
// initialisation Agent
void Agent::init(VEC3 startingPoint,std::vector<VEC3> goals,Dart d)
void Agent::init(Simulator * sim ,VEC3 startingPoint,std::vector<VEC3> goals,Dart d)
{
sim_=sim;
goals_=goals;
r=0.0f;
g=0.0f;
......@@ -16,21 +17,19 @@ void Agent::init(VEC3 startingPoint,std::vector<VEC3> goals,Dart d)
maxVelocity_=3.0f;
//lien simulateur
agentNo=sim_->agents.size() ;
Simulator* sim_;
alive=true;
sim_->agents.push_back(this);
}
Agent::Agent(Simulator* sim,VEC3 startingPoint,std::vector<VEC3> goals, Dart d):
sim_(sim)
Agent::Agent(Simulator* sim,VEC3 startingPoint,std::vector<VEC3> goals, Dart d)
{
init(startingPoint,goals,d);
init(sim,startingPoint,goals,d);
}
Agent::Agent(Simulator* sim,VEC3 startingPoint,std::vector<VEC3> goals):
sim_(sim)
Agent::Agent(Simulator* sim,VEC3 startingPoint,std::vector<VEC3> goals)
{
Dart d=sim_->envMap_.getBelongingCell(startingPoint);
init(startingPoint,goals,d);
Dart d=sim->envMap_.getBelongingCell(startingPoint);
init(sim,startingPoint,goals,d);
}
void Agent::updatePosition()
......
......@@ -84,6 +84,7 @@ void Simulator::initAgents(int nbAgents)
goals.push_back(goal);
goals.push_back(start);
Agent * ag = new Agent(this,start,goals);
CGoGNout<<"agent initialisé : "<<ag->agentNo<<CGoGNendl;
// CGoGNout<<"agent n°" << agents_[i]->agentNo << " : "<< agents_[i]<<CGoGNendl;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment