#include "stdafx.h"
#include "../UnitRecord.h"
#include "UnitRecordType.h"

UnitRecordType::SavedState::SavedState(UnitRecordType* unitRecordType)
{
  UnitRecord* unitRecord = unitRecordType->getUnitRecord();
  assert(unitRecord->isAccessible());
  BWAPI::Unit* unit = unitRecord->getUnit();

  m_position = unit->getPosition();
  m_tilePosition = unit->getTilePosition();
  m_unitType = unit->getType();
  m_player = unit->getPlayer();
  m_hitPoints = unit->getHitPoints();
  m_shields = unit->getShields();
  m_isLifted = unit->isLifted();
  m_isCompleted = unit->isCompleted();
}

void UnitRecordType::SavedState::_output(std::ostream& out) const
{
  out << "Saved state of " << m_unitType.getName();
}

void UnitRecordType::_output(std::ostream& out) const
{
  out << "Type \"" << m_unitType << "\" of \"" << *m_unitRecord << "\"";
}

void UnitRecordType::_outputUnitInfo(std::ostream& out) const
{
  unused(out);
}