How to manage team structures and turns?

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
ehenkes
Posts: 47
Joined: Sun Aug 03, 2008 2:52 pm
Location: Germany
Contact:

How to manage team structures and turns?

Post by ehenkes »

This situation must be very frequent:

There are two teams fighting against each other.
They act/fight in turns, i.e. team A - team B - team A - team B - ...
There are different characters who can belong to team A or B

I designed a class CCharacter and a class CTeam (with an array of pointers to the members of the team).

My problem: How can I check by a for loop, whether a character is selected?
There is no general vector array with all characters at the field.

How would you organize this situation and let the teams have their turns alternatively? Is there a general way to manage that?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Re: How to manage team structures and turns?

Post by rogerborg »

ehenkes wrote:My problem: How can I check by a for loop, whether a character is selected?
I don't know, because I have no idea what "selected" means in the context of your problem.
ehenkes wrote:There is no general vector array with all characters at the field.
Then there's no way to do it with a single for loop. Do it by looping over each CCharacter in each CTeam, or create another array of all CCharacters. I'm sure you're very well aware of those two possible solutions.

ehenkes wrote:How would you organize this situation and let the teams have their turns alternatively?
This appears to be a different question. I can't see the connection between "selected" and "turns".
ehenkes wrote:Is there a general way to manage that?
I doubt it.

I also suspect you're thinking out loud, and asking rhetorical questions rather than getting on with just implementing a solution, but then I'm a nasty suspicious hobbitses.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply