////////////////////////////////////////////////////////////////////////////////
// FighterPlayer.h
// Class used by the player to control a conventional or aerospace fighter
// Written by Björn Ganster since 2021
////////////////////////////////////////////////////////////////////////////////

#ifndef FighterPlayer__H
#define FighterPlayer__H

#include "AeroTech.h"
#include "MechVM.h"
#include "VehicleAI.h"

class FighterPlayer: public PlayerVehicleAI, JoystickListener {
public:
	// Construct fighter AI
	FighterPlayer(AeroTech* aeroTech);

	// Destructor
	~FighterPlayer() OVERRIDE;

	// Keyboard event handlers
	void keypressed(BGKey key, bool shiftHeld, bool controlHeld, bool down, bool repeat)
		OVERRIDE;

	// Button state changed over a window: returns child that was clicked
	void buttonStateChanged(int button, bool down, int /*x*/, int /*y*/) OVERRIDE;

	void mouseMoved(int /*x*/, int /*y*/) OVERRIDE;

	void setPosition(const Point3D& pos, double heading = 0);

	void setAim(double dx, double dy) OVERRIDE;

	bool weaponActive(int i, bool groupFire) const OVERRIDE;

	void planMovement(DWORD now) OVERRIDE;

	// Notify AI of an event, like a destroyed object
	void updateObjectStatus(const BGCPString& id, SubObjectiveType newStatus) OVERRIDE;

	// Set range where AI triggers
	void setTriggerRange(double newVal) OVERRIDE;

	// Add single goal to attack (possibly after sleep goal)
	void addAttackGoal(const BGCPString& target) OVERRIDE;

	// Add goals for AI
	void addGoals(const std::vector<AIGoal>& goals, bool clearExisting) OVERRIDE;

	// Process SDL joystick events
	void joystickEvent(SDL_Event* event) OVERRIDE;
protected:
	// Casted copy of mVehicle
	AeroTech* mAeroTech;

	// The joystick used to control the aircraft (if any)
	SDL_Joystick* mJoystick;
};

#endif