Quote:Original post by Twinsen2
std::vector<std::vector<void*>> agentPath;
That should be:
std::vector<std::vector<void*> > agentPath;
Notice the space between > and > (so it won't be mistaken for >>, like the operator std::cout uses).
Quote:basicly this above allows me to have a vector list again for each entity in the botPaths list.
What is botPaths? Does this mean that a single element (of std::vector<void*>) of agentPath belongs to a single agent, and the std::vector<void*> is the nodes (node is of type void*). Why don't you use a node class instead of void*? Would be much more clear.
Quote:
agentPath .push_back( getAStar()->getPathList() );
Here i insert the vector list of nodes to travel to in the agentPath list.
now, it is working "well sorta", but i have this on a loop for about 15 agents and somehow BotPaths.size() returns 2847 where according to me it should return 14.
You haven't mentioned BotPaths before, so we don't know when elements are added. If you meant that agentPath.size() is 2847, then let us see the loop. Also, in case you run this multiple times, do you remember to clear() agentPath before running the loop 15 times? Also try to see what the contents of agentPath is, is it invalid data? Is it 2833 copies of the same element? What is it?
Quote:also the vector list inside the agentPath that contains the nodes to travel to doesnt contain the correct size either, but its size is alot more closer to what it should be rather than agentPath.
I think we need more information about getAStar()->getPathList() and the expected results before we can answer that question.
Quote:I was just wondering if some1 with a bit more knowledge could possibly offer an explanation on the size of the agentPath, imo i think that each object in the list can only store a certain amount of data?? so it allocates a new agentPath entity for it, but thats wrong i know.
I'm not quite sure what you say here, don't you think std::vector<T> can hold 15 elements? I can assure you, that it can.
Quote:anotehr way which i was going 2 do it, was store say the agentAPath vector list in a map or array....
You should solve your problem, if you don't, then you will run into the problem again in the future, when it might be harder to debug.
Quote:maybe vectors dont like being used the way i am using them?
No, not unless you use them in the wrong way.
Quote:if worse comes to worse i'll add each node to be traveled to manually, 1 by one to the list but though you could to it autonomilsy like this.
like if this works it will be very easy to get access to every agents list.
Like previously said, you should really solve your problem.
Please give us all the information you have, what have you tried? What do you suspect might have happened? Give us more code to look at, etc. Describing the code is not enough, because you might have bugs you didn't realize existed.