Freeciv21
Develop your civilization from humble roots to a global empire
texaiplayer.c File Reference
#include <fc_config.h>
#include "log.h"
#include "ai.h"
#include "city.h"
#include "game.h"
#include "map.h"
#include "unit.h"
#include "advchoice.h"
#include "infracache.h"
#include "aiplayer.h"
#include "daimilitary.h"
#include "texaicity.h"
#include "texaiworld.h"
#include "texaiplayer.h"
+ Include dependency graph for texaiplayer.c:

Go to the source code of this file.

Classes

struct  texai_thr
 
struct  texai_build_choice_req
 

Enumerations

enum  texai_abort_msg_class { TEXAI_ABORT_EXIT , TEXAI_ABORT_PHASE_END , TEXAI_ABORT_NONE }
 

Functions

static enum texai_abort_msg_class texai_check_messages (struct ai_type *ait)
 Handle messages from message queue. More...
 
void texai_init_threading (void)
 Initialize ai thread. More...
 
static void texai_thread_start (void *arg)
 This is main function of ai thread. More...
 
void texai_map_alloc (void)
 Main map has been allocated. More...
 
void texai_whole_map_copy (void)
 Send all tiles to tex thread. More...
 
static void texai_map_alloc_recv (void)
 Map allocation message received. More...
 
void texai_map_free (void)
 Main map has been freed. More...
 
static void texai_map_free_recv (void)
 Map free message received. More...
 
struct unit_list * texai_player_units (struct player *pplayer)
 Callback that returns unit list from player tex ai data. More...
 
void texai_player_alloc (struct ai_type *ait, struct player *pplayer)
 Initialize player for use with tex AI. More...
 
void texai_player_free (struct ai_type *ait, struct player *pplayer)
 Free player from use with tex AI. More...
 
void texai_control_gained (struct ai_type *ait, struct player *pplayer)
 We actually control the player. More...
 
void texai_control_lost (struct ai_type *ait, struct player *pplayer)
 We no longer control the player. More...
 
void texai_refresh (struct ai_type *ait, struct player *pplayer)
 Check for messages sent by player thread. More...
 
void texai_msg_to_thr (struct texai_msg *msg)
 Send message to thread. More...
 
void texai_req_from_thr (struct texai_req *req)
 Thread sends message. More...
 
bool texai_thread_running (void)
 Return whether player thread is running. More...
 

Variables

struct texai_thr exthrai
 

Enumeration Type Documentation

◆ texai_abort_msg_class

Enumerator
TEXAI_ABORT_EXIT 
TEXAI_ABORT_PHASE_END 
TEXAI_ABORT_NONE 

Definition at line 44 of file texaiplayer.c.

Function Documentation

◆ texai_check_messages()

static enum texai_abort_msg_class texai_check_messages ( struct ai_type ait)
static

Handle messages from message queue.

Definition at line 141 of file texaiplayer.c.

Referenced by texai_thread_start().

◆ texai_control_gained()

void texai_control_gained ( struct ai_type ait,
struct player pplayer 
)

We actually control the player.

Definition at line 298 of file texaiplayer.c.

Referenced by texwai_control_gained().

◆ texai_control_lost()

void texai_control_lost ( struct ai_type ait,
struct player pplayer 
)

We no longer control the player.

Definition at line 332 of file texaiplayer.c.

Referenced by texwai_control_lost().

◆ texai_init_threading()

void texai_init_threading ( void  )

Initialize ai thread.

Definition at line 68 of file texaiplayer.c.

Referenced by texai_init_self().

◆ texai_map_alloc()

void texai_map_alloc ( void  )

Main map has been allocated.

Definition at line 109 of file texaiplayer.c.

Referenced by fc_ai_tex_setup().

◆ texai_map_alloc_recv()

static void texai_map_alloc_recv ( void  )
static

Map allocation message received.

Definition at line 126 of file texaiplayer.c.

◆ texai_map_free()

void texai_map_free ( void  )

Main map has been freed.

Definition at line 131 of file texaiplayer.c.

Referenced by fc_ai_tex_setup().

◆ texai_map_free_recv()

static void texai_map_free_recv ( void  )
static

Map free message received.

Definition at line 136 of file texaiplayer.c.

◆ texai_msg_to_thr()

void texai_msg_to_thr ( struct texai_msg msg)

Send message to thread.

Be sure that thread is running so that messages are not just piling up to the list without anybody reading them.

Definition at line 403 of file texaiplayer.c.

Referenced by texai_send_msg().

◆ texai_player_alloc()

void texai_player_alloc ( struct ai_type ait,
struct player pplayer 
)

Initialize player for use with tex AI.

Definition at line 265 of file texaiplayer.c.

Referenced by texwai_player_alloc().

◆ texai_player_free()

void texai_player_free ( struct ai_type ait,
struct player pplayer 
)

Free player from use with tex AI.

Definition at line 280 of file texaiplayer.c.

Referenced by texwai_player_free().

◆ texai_player_units()

struct unit_list* texai_player_units ( struct player pplayer)

Callback that returns unit list from player tex ai data.

Definition at line 141 of file texaiplayer.c.

Referenced by texai_city_worker_task_select().

◆ texai_refresh()

void texai_refresh ( struct ai_type ait,
struct player pplayer 
)

Check for messages sent by player thread.

Definition at line 355 of file texaiplayer.c.

Referenced by texwai_refresh().

◆ texai_req_from_thr()

void texai_req_from_thr ( struct texai_req req)

Thread sends message.

Definition at line 414 of file texaiplayer.c.

Referenced by texai_send_req().

◆ texai_thread_running()

bool texai_thread_running ( void  )

Return whether player thread is running.

Definition at line 424 of file texaiplayer.c.

Referenced by texai_city_destroyed(), texai_city_update(), texai_send_msg(), texai_tile_info(), texai_unit_destroyed(), texai_unit_move_seen(), and texai_unit_update().

◆ texai_thread_start()

static void texai_thread_start ( void *  arg)
static

This is main function of ai thread.

Definition at line 78 of file texaiplayer.c.

Referenced by texai_control_gained().

◆ texai_whole_map_copy()

void texai_whole_map_copy ( void  )

Send all tiles to tex thread.

Definition at line 117 of file texaiplayer.c.

Referenced by fc_ai_tex_setup().

Variable Documentation

◆ exthrai