src/ai/api/ai_station.hpp.sq
branchnoai
changeset 9866 efc38e1f559a
parent 9814 be51ea0adc29
child 10094 e737405b06dd
equal deleted inserted replaced
9865:f241472f09dc 9866:efc38e1f559a
     1 #include "ai_station.hpp"
     1 #include "ai_station.hpp"
     2 
     2 
     3 namespace SQConvert {
     3 namespace SQConvert {
     4 	/* Allow enums to be used as Squirrel parameters */
     4 	/* Allow enums to be used as Squirrel parameters */
       
     5 	template <> AIStation::ErrorMessages GetParam(ForceType<AIStation::ErrorMessages>, HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIStation::ErrorMessages)tmp; }
       
     6 	template <> int Return<AIStation::ErrorMessages>(HSQUIRRELVM vm, AIStation::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
     5 	template <> AIStation::StationType GetParam(ForceType<AIStation::StationType>, HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIStation::StationType)tmp; }
     7 	template <> AIStation::StationType GetParam(ForceType<AIStation::StationType>, HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIStation::StationType)tmp; }
     6 	template <> int Return<AIStation::StationType>(HSQUIRRELVM vm, AIStation::StationType res) { sq_pushinteger(vm, (int32)res); return 1; }
     8 	template <> int Return<AIStation::StationType>(HSQUIRRELVM vm, AIStation::StationType res) { sq_pushinteger(vm, (int32)res); return 1; }
     7 
     9 
     8 	/* Allow AIStation to be used as Squirrel parameter */
    10 	/* Allow AIStation to be used as Squirrel parameter */
     9 	template <> AIStation *GetParam(ForceType<AIStation *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIStation *)instance; }
    11 	template <> AIStation *GetParam(ForceType<AIStation *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIStation *)instance; }
    16 void SQAIStation_Register(Squirrel *engine) {
    18 void SQAIStation_Register(Squirrel *engine) {
    17 	DefSQClass <AIStation> SQAIStation("AIStation");
    19 	DefSQClass <AIStation> SQAIStation("AIStation");
    18 	SQAIStation.PreRegister(engine);
    20 	SQAIStation.PreRegister(engine);
    19 	SQAIStation.AddConstructor<void (AIStation::*)(), 1>(engine, "x");
    21 	SQAIStation.AddConstructor<void (AIStation::*)(), 1>(engine, "x");
    20 
    22 
    21 	SQAIStation.DefSQConst(engine, AIStation::STATION_ANY,        "STATION_ANY");
    23 	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_BASE,                       "ERR_STATION_BASE");
    22 	SQAIStation.DefSQConst(engine, AIStation::STATION_TRAIN,      "STATION_TRAIN");
    24 	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_LARGE,                  "ERR_STATION_TOO_LARGE");
    23 	SQAIStation.DefSQConst(engine, AIStation::STATION_TRUCK_STOP, "STATION_TRUCK_STOP");
    25 	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_CLOSE_TO_OTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_OTHER_STATION");
    24 	SQAIStation.DefSQConst(engine, AIStation::STATION_BUS_STOP,   "STATION_BUS_STOP");
    26 	SQAIStation.DefSQConst(engine, AIStation::STATION_ANY,                            "STATION_ANY");
    25 	SQAIStation.DefSQConst(engine, AIStation::STATION_AIRPORT,    "STATION_AIRPORT");
    27 	SQAIStation.DefSQConst(engine, AIStation::STATION_TRAIN,                          "STATION_TRAIN");
    26 	SQAIStation.DefSQConst(engine, AIStation::STATION_DOCK,       "STATION_DOCK");
    28 	SQAIStation.DefSQConst(engine, AIStation::STATION_TRUCK_STOP,                     "STATION_TRUCK_STOP");
       
    29 	SQAIStation.DefSQConst(engine, AIStation::STATION_BUS_STOP,                       "STATION_BUS_STOP");
       
    30 	SQAIStation.DefSQConst(engine, AIStation::STATION_AIRPORT,                        "STATION_AIRPORT");
       
    31 	SQAIStation.DefSQConst(engine, AIStation::STATION_DOCK,                           "STATION_DOCK");
       
    32 
       
    33 	AIError::RegisterErrorMap(STR_306C_STATION_TOO_SPREAD_OUT,       AIStation::ERR_STATION_TOO_LARGE);
       
    34 	AIError::RegisterErrorMap(STR_300D_TOO_CLOSE_TO_ANOTHER_AIRPORT, AIStation::ERR_STATION_TOO_CLOSE_TO_OTHER_STATION);
       
    35 	AIError::RegisterErrorMap(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION, AIStation::ERR_STATION_TOO_CLOSE_TO_OTHER_STATION);
       
    36 
       
    37 	AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_LARGE,                  "ERR_STATION_TOO_LARGE");
       
    38 	AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_CLOSE_TO_OTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_OTHER_STATION");
    27 
    39 
    28 	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetClassName,               "GetClassName",               1, "x");
    40 	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetClassName,               "GetClassName",               1, "x");
    29 	SQAIStation.DefSQStaticMethod(engine, &AIStation::IsValidStation,             "IsValidStation",             2, "xi");
    41 	SQAIStation.DefSQStaticMethod(engine, &AIStation::IsValidStation,             "IsValidStation",             2, "xi");
    30 	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetStationID,               "GetStationID",               2, "xi");
    42 	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetStationID,               "GetStationID",               2, "xi");
    31 	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetName,                    "GetName",                    2, "xi");
    43 	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetName,                    "GetName",                    2, "xi");