dimanche 22 juillet 2018

Access pointer methods of pointer vector

I'm not really sure how to phrase the question exactly correctly, but I've declared two vectors

std::vector<enemy*> enemies;
std::vector<hit_area *> effects;

these work and are fine, however I pass them to a function with

handleGame(strd_maps[0], &gcam, &mainchar, currentKeyStates, &enemies, &effects)

which works and is fine, however in the function, when I try to access members or methods or enemies or effect

if(effects[d]->collide(enemies[i]->x, enemies[i]->y enemies[i]->w, enemies[i]->h))

I get the error "base operand of "->" has non-pointer type 'std::vector*'. I can access the size of both enemies and effects, it's just accessing the methods that is giving problems

Aucun commentaire:

Enregistrer un commentaire