//	ToneCreator.h - Base class for all Tone Creators.
//  ----------------------------------------------------------------------------
//	This file is part of 'GameTemplate', template code for a game.
//	Copyright (C) 2011  Niall Moody
//	
//	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 3 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, see <http://www.gnu.org/licenses/>.
//	----------------------------------------------------------------------------

#ifndef TONECREATOR_H_
#define TONECREATOR_H_

#include "c0xHeaders.h"
#include "Tone.h"

#include <string>
#include <memory>

class ToneSounder;

///	Base class for all Tone Creators.
class ToneCreator
{
  public:
	///	Constructor.
	ToneCreator() {};
	///	Destructor.
	virtual ~ToneCreator() {};

	///	Constructs this Creator's Tone, returns its pointer.
	virtual TonePtr createTone(int startRail,
							   int startNumRails,
							   shared_ptr<TonesSounder>& sounder) const = 0;

	///	Returns true if this Tone type should be generated with a Pickup.
	virtual bool getCarriesPickup() const {return false;};

	///	Returns which side of the screen this Tone should start from.
	/*!
		\return False == Left, True == Right.
	 */
	virtual bool getStartingSide() const = 0;
	///	Used to make sure the player isn't put in an unfair position.
	/*!
		The point of this method is to ensure that new Tones are not generated
		on rails which already have another Tone close to the edge of the
		screen. The return value of this method is therefore the distance
		within which there may be no other Tones if this Tone is to be
		generated on that rail.
	 */
	virtual int getMinDistanceToOtherTones() const = 0;
	///	Used to make sure the player isn't put in an unfair position.
	/*!
		\return -1 if there can be any number of those Tone types on screen, a
		positive value otherwise.

		The point of this method is to avoid situations where e.g. a fast Tone
		could be generated on a screen that is already full of slow Tones.
		Passing in the name of the Tone type you're interested in will return
		the maximum number of those Tones which may be on screen before the
		screen is seen to be too busy for this Tone type to be generated.
	 */
	virtual int getMaxNumOtherTones(const std::wstring& toneType) const = 0;
	///	Used to make sure the player isn't put in an unfair position.
	/*!
		\return -1 if this Tone type doesn't care.

		This will be used to e.g. avoid generating a lot of fast Tones when
		the player is already in a tricky position, having to deal with a lot
		of potential crashes.
	 */
	virtual int getMaxNumWarnings() const = 0;
};

#endif
