Ignore:
Timestamp:
Sep 13, 2017, 5:19:58 PM (8 years ago)
Author:
Frederik Heber <frederik.heber@…>
Children:
15acdb
Parents:
ab3827
Message:

ActionQueue has predicates to check if current Action is Process or MakroAction.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/Actions/ActionQueue.cpp

    rab3827 r17fceea  
    5252#include "Actions/ActionHistory.hpp"
    5353#include "Actions/ActionRegistry.hpp"
     54#include "Actions/MakroAction.hpp"
     55#include "Actions/Process.hpp"
    5456#include "World.hpp"
    5557
     
    160162  bool status = (CurrentAction == actionqueue.size());
    161163  return status;
     164}
     165
     166bool ActionQueue::isProcess() const
     167{
     168  if (isIdle())
     169    return false;
     170  const Process *possibleprocess = dynamic_cast<const Process *>(&getCurrentAction());
     171  if (possibleprocess == NULL)
     172    return false;
     173  else
     174    return true;
     175}
     176
     177bool ActionQueue::isMakroAction() const
     178{
     179  if (isIdle())
     180    return false;
     181  const MakroAction *possiblemakroaction = dynamic_cast<const MakroAction *>(&getCurrentAction());
     182  if (possiblemakroaction == NULL)
     183    return false;
     184  else
     185    return true;
     186}
     187
     188const Action& ActionQueue::getCurrentAction() const
     189{
     190  return *const_cast<const Action *>(actionqueue[CurrentAction]);
    162191}
    163192
Note: See TracChangeset for help on using the changeset viewer.