# ai_testmode.cpp

Go to the documentation of this file.

    00001 /* $Id: ai_testmode.cpp 15060 2009-01-13 15:44:36Z smatz $ */
    00002
    00005 #include "ai_testmode.hpp"
    00006 #include "../../command_type.h"
    00007
    00008 bool AITestMode::ModeProc(TileIndex tile, uint32 p1, uint32 p2, uint procc, CommandCost costs)
    00009 {
    00010   /* In test mode we only return 'false', telling the DoCommand it
    00011     *  should stop after testing the command and return with that result. */
    00012   return false;
    00013 }
    00014
    00015 AITestMode::AITestMode()
    00016 {
    00017   this->last_mode     = this->GetDoCommandMode();
    00018   this->last_instance = this->GetDoCommandModeInstance();
    00019   this->SetDoCommandMode(&AITestMode::ModeProc, this);
    00020 }
    00021
    00022 AITestMode::~AITestMode()
    00023 {
    00024   assert(this->GetDoCommandModeInstance() == this);
    00025   this->SetDoCommandMode(this->last_mode, this->last_instance);
    00026 }