/***************************************************************************
 *   Copyright (C) 2004 by ian reinhart geiser                             *
 *   ian@geiseri.com                                                       *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef BATTLEROUND_H
#define BATTLEROUND_H

#include <qstringlist.h>
#include <qvector.h>

class Unit;
/**
This is the main class than handles a battle.  It keeps a list of contents and orders the units inside per inititive in the round.

@author ian reinhart geiser
*/
class BattleRound{
public:
    BattleRound();

    ~BattleRound();

    void add( Unit *unit);
    
    Unit *unit( int idx ) const;
    int count() const;
    void remove( Unit *unt) const;

    Unit *deadUnit( int idx ) const;
    int deadCount() const;

    // Starts the round, the @ref nextUnit() is set to the first unit.
    void startRound();
    // Returns the next unit in the lineup.  Dead units are removed.
    Unit *nextUnit() const;
    // Ends the round, performs any cleanup on the @ref Units.
    void endRound();
    
    
private:
	// Reorderes everyone.
	void order(); 
	QVector<Unit*> m_units;
	QVector<Unit*> m_dead;
	mutable QVector<Unit*>::Iterator m_current;
};

#endif

