ai/ai.h
changeset 2687 eb2443a14a74
parent 2684 8aba54c245cc
child 2696 309dedc426e5
equal deleted inserted replaced
2686:a3e667057607 2687:eb2443a14a74
     1 #ifndef AI_H
     1 #ifndef AI_H
     2 #define AI_H
     2 #define AI_H
     3 
     3 
     4 #include "../functions.h"
     4 #include "../functions.h"
     5 #include "../network.h"
     5 #include "../network.h"
       
     6 #ifdef GPMI
       
     7 #include <gpmi.h>
       
     8 #endif /* GPMI */
     6 
     9 
     7 /* How DoCommands look like for an AI */
    10 /* How DoCommands look like for an AI */
     8 typedef struct AICommand {
    11 typedef struct AICommand {
     9 	uint32 tile;
    12 	uint32 tile;
    10 	uint32 p1;
    13 	uint32 p1;
    19 /* The struct for an AIScript Player */
    22 /* The struct for an AIScript Player */
    20 typedef struct AIPlayer {
    23 typedef struct AIPlayer {
    21 	bool active;            //! Is this AI active?
    24 	bool active;            //! Is this AI active?
    22 	AICommand *queue;       //! The commands that he has in his queue
    25 	AICommand *queue;       //! The commands that he has in his queue
    23 	AICommand *queue_tail;  //! The tail of this queue
    26 	AICommand *queue_tail;  //! The tail of this queue
       
    27 #ifdef GPMI
       
    28 	gpmi_module *module;    //! The link to the GPMI module
       
    29 #endif /* GPMI */
    24 } AIPlayer;
    30 } AIPlayer;
    25 
    31 
    26 /* The struct to keep some data about the AI in general */
    32 /* The struct to keep some data about the AI in general */
    27 typedef struct AIStruct {
    33 typedef struct AIStruct {
    28 	/* General */
    34 	/* General */
    30 	uint tick;              //! The current tick (something like _frame_counter, only for AIs)
    36 	uint tick;              //! The current tick (something like _frame_counter, only for AIs)
    31 
    37 
    32 	/* For network-clients (a OpenTTD client who acts as an AI connected to a server) */
    38 	/* For network-clients (a OpenTTD client who acts as an AI connected to a server) */
    33 	bool network_client;    //! Are we a network_client?
    39 	bool network_client;    //! Are we a network_client?
    34 	uint8 network_playas;   //! The current network player we are connected as
    40 	uint8 network_playas;   //! The current network player we are connected as
       
    41 
       
    42 #ifdef GPMI
       
    43 	bool gpmi;              //! True if we want GPMI AIs
       
    44 #endif /* GPMI */
    35 } AIStruct;
    45 } AIStruct;
    36 
    46 
    37 VARDEF AIStruct _ai;
    47 VARDEF AIStruct _ai;
    38 VARDEF AIPlayer _ai_player[MAX_PLAYERS];
    48 VARDEF AIPlayer _ai_player[MAX_PLAYERS];
    39 
    49