src/ai/api/ai_controller.cpp
branchnoai
changeset 11097 6967c52c78c5
parent 11079 925e3823a101
child 11098 37d15a8951b8
equal deleted inserted replaced
11096:4c9f93632d0b 11097:6967c52c78c5
    47 #include "ai_log.hpp.sq"
    47 #include "ai_log.hpp.sq"
    48 #include "ai_map.hpp.sq"
    48 #include "ai_map.hpp.sq"
    49 #include "ai_marine.hpp.sq"
    49 #include "ai_marine.hpp.sq"
    50 #include "ai_order.hpp.sq"
    50 #include "ai_order.hpp.sq"
    51 #include "ai_road.hpp.sq"
    51 #include "ai_road.hpp.sq"
    52 #include "ai_settings.hpp.sq"
       
    53 #include "ai_sign.hpp.sq"
    52 #include "ai_sign.hpp.sq"
    54 #include "ai_station.hpp.sq"
    53 #include "ai_station.hpp.sq"
    55 #include "ai_stationlist.hpp.sq"
    54 #include "ai_stationlist.hpp.sq"
    56 #include "ai_subsidy.hpp.sq"
    55 #include "ai_subsidy.hpp.sq"
    57 #include "ai_subsidylist.hpp.sq"
    56 #include "ai_subsidylist.hpp.sq"
    62 #include "ai_townlist.hpp.sq"
    61 #include "ai_townlist.hpp.sq"
    63 #include "ai_transactionmode.hpp.sq"
    62 #include "ai_transactionmode.hpp.sq"
    64 #include "ai_tunnel.hpp.sq"
    63 #include "ai_tunnel.hpp.sq"
    65 #include "ai_vehicle.hpp.sq"
    64 #include "ai_vehicle.hpp.sq"
    66 #include "ai_vehiclelist.hpp.sq"
    65 #include "ai_vehiclelist.hpp.sq"
       
    66 
       
    67 /* static */ void AIController::SetCommandDelay(int ticks)
       
    68 {
       
    69 	if (ticks <= 0) return;
       
    70 	AIObject::SetDoCommandDelay(ticks);
       
    71 }
    67 
    72 
    68 /* static */ void AIController::Sleep(int ticks)
    73 /* static */ void AIController::Sleep(int ticks)
    69 {
    74 {
    70 	if (ticks <= 0) {
    75 	if (ticks <= 0) {
    71 		AILog::Warning("Sleep() value should be > 0. Assuming value 1.");
    76 		AILog::Warning("Sleep() value should be > 0. Assuming value 1.");
   133 	SQAILog_Register(this->engine);
   138 	SQAILog_Register(this->engine);
   134 	SQAIMap_Register(this->engine);
   139 	SQAIMap_Register(this->engine);
   135 	SQAIMarine_Register(this->engine);
   140 	SQAIMarine_Register(this->engine);
   136 	SQAIOrder_Register(this->engine);
   141 	SQAIOrder_Register(this->engine);
   137 	SQAIRoad_Register(this->engine);
   142 	SQAIRoad_Register(this->engine);
   138 	SQAISettings_Register(this->engine);
       
   139 	SQAISign_Register(this->engine);
   143 	SQAISign_Register(this->engine);
   140 	SQAIStation_Register(this->engine);
   144 	SQAIStation_Register(this->engine);
   141 	SQAIStationList_Register(this->engine);
   145 	SQAIStationList_Register(this->engine);
   142 	SQAIStationList_Vehicle_Register(this->engine);
   146 	SQAIStationList_Vehicle_Register(this->engine);
   143 	SQAISubsidy_Register(this->engine);
   147 	SQAISubsidy_Register(this->engine);
   198 
   202 
   199 	/* Run the constructor first */
   203 	/* Run the constructor first */
   200 	if (this->engine->MethodExists(*this->SQ_instance, "constructor")) {
   204 	if (this->engine->MethodExists(*this->SQ_instance, "constructor")) {
   201 		this->engine->CallMethod(*this->SQ_instance, "constructor");
   205 		this->engine->CallMethod(*this->SQ_instance, "constructor");
   202 	}
   206 	}
       
   207 
   203 	/* When that is done, start the Start() function */
   208 	/* When that is done, start the Start() function */
   204 	this->engine->CallMethod(*this->SQ_instance, "Start");
   209 	this->engine->CallMethod(*this->SQ_instance, "Start");
   205 }
   210 }
   206 
   211 
   207 AIController::~AIController()
   212 AIController::~AIController()