<?php

chdir(dirname(__FILE__));

include_once("server_settings_classic.php");
include_once("internal/metagame.php");
include_once("internal/log.php");

// available tracker implementations
include_once("trackers/map_rotator_classic.php");
include_once("trackers/basic_command_handler.php");

// --------------------------------------------

class GameMode extends MetaGame {
	protected $map_rotator = NULL;

	// --------------------------------------------
	public function init() {
		parent::init();

		// trigger map change right now
		$this->map_rotator = new MapRotatorClassic($this);
		$this->map_rotator->start();
	}

	// --------------------------------------------
	// MapRotator calls here when a battle has started
	public function post_begin_match() {
		parent::post_begin_match();

		// add tracker for match end to switch to next
		$this->add_tracker($this->map_rotator);

		$this->add_tracker(new BasicCommandHandler($this));
	}

}

// --------------------------------------------

$metagame = new GameMode();

$metagame->init();
// execution blocks here at run until comms from server is lost
$metagame->run();
$metagame->uninit();


?>