Freeciv21
Develop your civilization from humble roots to a global empire
ai.cpp File Reference
#include <fc_config.h>
#include <cstring>
#include "fcintl.h"
#include "log.h"
#include "timing.h"
#include "ai.h"
#include "player.h"
+ Include dependency graph for ai.cpp:

Go to the source code of this file.

Functions

struct ai_typeget_ai_type (int id)
 Returns ai_type of given id. More...
 
void init_ai (struct ai_type *ai)
 Initializes AI structure. More...
 
int ai_type_number (const struct ai_type *ai)
 Returns id of the given ai_type. More...
 
struct ai_typeai_type_by_name (const char *search)
 Find ai type with given name. More...
 
struct ai_typeai_type_alloc ()
 Return next free ai_type. More...
 
void ai_type_dealloc ()
 Free latest ai_type. More...
 
int ai_type_get_count ()
 Return number of ai types. More...
 
const char * ai_name (const struct ai_type *ai)
 Return the name of the ai type. More...
 
const char * ai_type_name_or_fallback (const char *orig_name)
 Return usable ai type name, if possible. More...
 

Variables

static struct ai_type ai_types [FREECIV_AI_MOD_LAST]
 
static int ai_type_count = 0
 

Function Documentation

◆ ai_name()

const char* ai_name ( const struct ai_type ai)

Return the name of the ai type.

Definition at line 99 of file ai.cpp.

Referenced by ai_type_by_name(), ai_type_name_or_fallback(), aicmd_command(), aifill(), sg_load_players(), sg_save_player_main(), show_players(), and split_player().

◆ ai_type_alloc()

struct ai_type* ai_type_alloc ( )

Return next free ai_type.

Definition at line 75 of file ai.cpp.

Referenced by ai_init().

◆ ai_type_by_name()

struct ai_type* ai_type_by_name ( const char *  search)

Find ai type with given name.

Definition at line 59 of file ai.cpp.

Referenced by ai_init(), ai_type_name_or_fallback(), and server_create_player().

◆ ai_type_dealloc()

void ai_type_dealloc ( )

Free latest ai_type.

Definition at line 89 of file ai.cpp.

Referenced by ai_init().

◆ ai_type_get_count()

int ai_type_get_count ( )

Return number of ai types.

Definition at line 94 of file ai.cpp.

Referenced by aitype_generator(), and sg_save_game().

◆ ai_type_name_or_fallback()

const char* ai_type_name_or_fallback ( const char *  orig_name)

Return usable ai type name, if possible.

This is either the name given as parameter or some fallback name for it. nullptr is returned if no name matches.

Definition at line 110 of file ai.cpp.

Referenced by server_create_player().

◆ ai_type_number()

int ai_type_number ( const struct ai_type ai)

◆ get_ai_type()

struct ai_type* get_ai_type ( int  id)

Returns ai_type of given id.

Definition at line 32 of file ai.cpp.

Referenced by ai_type_alloc(), aitype_accessor(), and client_main().

◆ init_ai()

void init_ai ( struct ai_type ai)

Initializes AI structure.

Definition at line 42 of file ai.cpp.

Referenced by ai_init(), and client_main().

Variable Documentation

◆ ai_type_count

int ai_type_count = 0
static

Definition at line 27 of file ai.cpp.

Referenced by ai_type_alloc(), ai_type_dealloc(), and ai_type_get_count().

◆ ai_types

struct ai_type ai_types[FREECIV_AI_MOD_LAST]
static

Definition at line 1 of file ai.cpp.

Referenced by ai_type_number(), and get_ai_type().