BWAPI
Skynet/Skynet/IdleTask.cpp
Go to the documentation of this file.
00001 #include "IdleTask.h"
00002 
00003 IdleTask::IdleTask(TaskType priority)
00004 : Task(priority)
00005 {
00006 }
00007 
00008 int IdleTask::getEndTime() const
00009 {
00010         return Requirement::maxTime;
00011 }
00012 
00013 int IdleTask::getEndTime(Unit unit) const
00014 {
00015         return getEndTime();
00016 }
00017 
00018 Position IdleTask::getStartLocation(Unit unit) const
00019 {
00020         return unit->getPosition();
00021 }
00022 
00023 Position IdleTask::getEndLocation(Unit unit) const
00024 {
00025         return unit->getPosition();
00026 }
00027 
00028 bool IdleTask::preUpdate()
00029 {
00030         if(!mUnit)
00031                 complete();
00032 
00033         return false;
00034 }
00035 
00036 bool IdleTask::update()
00037 {
00038         return hasEnded() && !mUnit;
00039 }
00040 
00041 bool IdleTask::waitingForUnit(Unit unit) const
00042 {
00043         return false;
00044 }
00045 
00046 void IdleTask::giveUnit(Unit unit)
00047 {
00048         assert(mUnit == StaticUnits::nullunit);
00049         mUnit = unit;
00050 }
00051 
00052 void IdleTask::returnUnit(Unit unit)
00053 {
00054         assert(mUnit == unit);
00055         mUnit = StaticUnits::nullunit;
00056 }
00057 
00058 bool IdleTask::morph(Unit unit, BWAPI::UnitType previousType)
00059 {
00060         return true;
00061 }
00062 
00063 UnitGroup IdleTask::getFinishedUnits()
00064 {
00065         assert(false);
00066         return UnitGroup();
00067 }
00068 
00069 int IdleTask::getPriority(Unit unit) const
00070 {
00071         return 0;
00072 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines