/**
  * New match.
  * @param $name Name of the match/map
  * @param $year Stating year, i.e. 1846
  * @param $season Starting season (0=spring, 1=fall)
  **/
 public static function create(Game $game, $name)
 {
     $m = new Match();
     $m->setGame($game);
     $m->setName($name);
     // Create the first turn
     $turn = Turn::create($m);
     $m->setCurrentTurn($turn);
     // Copy over the territories to our first state
     $tts = $game->getGameTerritories();
     foreach ($tts as $tt) {
         $state = State::create($game, $m, $turn, $tt, $tt->getInitialOccupier(), new Unit($tt->getInitialUnit()));
     }
     $m->save();
     return $m;
 }
Exemple #2
0
 public function __construct(Turn $turn)
 {
     global $MLOG;
     $this->log = $MLOG;
     $this->required_retreats = array();
     $this->retreats = array();
     $this->season = $turn->getSeason();
     $this->turn = $turn;
     $this->unit_supply = null;
 }