void testRoomLimit(Area *a, int count)
{
for(int i = 0; i < count; i++)
{
Room *nR = new Room;
a->_rooms.push_back(nR);
}
}
Room *nR = new Room
a->_rooms.push_back(nR)
list<Room *>::iterator r;
for(r = (*a)->_rooms.begin(); r != (*a)->_rooms.end(); r++)
{
if(whatever)
//Random code
}
list<Room *>::iterator r;
for(r = (*a)->_rooms.begin(); r != (*a)->_rooms.end(); r++)
{
if(whatever)
//Random code
}
class Room {
private:
static int top_room_id;
int room_id;
public:
static void get_a_room_id() {
return ++top_room_id;
}
Room() {
room_id = get_a_room_id();
}
};
int Room::top_room_id = 0;
I've tried both push_front and push_back, both seem to be the same amount of lag. (I would have assumed push_back would be virtually no lag since I 'think' it doesn't have to cycle through all the others and 'adjust' them, since you're just tacking something onto the end of it so you'd only have to modify the last element and the element being added)
What helps, but doesn't make it better is when mass loading: use 2 lists, the real one and a fake one that you dispose of when done. You load everything into the fake one first, and when it reaches a magic number(I settled on 60), it merges it into the real table and starts over. This sped it up certainly, but it felt sloppy. And it doesn't help when adding just one element, that lag is still there.
So I was just wondering if anyone else even uses lists, and if you do how do you solve this issue? atm i'm having to split world maps up into smaller world maps that link to each other, and it works… but I would have preferred a world map be a single world map area and not several world map areas strung together.
Thanks for your time and any advice/etc.