Freeciv-3.2
Loading...
Searching...
No Matches
Functions
api_common_utilities.c File Reference
#include <math.h>
#include "cvercmp.h"
#include "deprecations.h"
#include "log.h"
#include "rand.h"
#include "map.h"
#include "version.h"
#include "luascript.h"
#include "api_common_utilities.h"

Go to the source code of this file.

Functions

int api_utilities_random (lua_State *L, int min, int max)
 
const charapi_utilities_fc_version (lua_State *L)
 
const charapi_utilities_name_version (lua_State *L)
 
const charapi_utilities_comparable_version (lua_State *L)
 
const charapi_utilities_version_string (lua_State *L)
 
int api_utilities_versions_compare (lua_State *L, const char *ver1, const char *ver2)
 
void api_utilities_log_base (lua_State *L, int level, const char *message)
 
int api_utilities_direction_id (lua_State *L, Direction dir)
 
const charapi_utilities_dir2str (lua_State *L, Direction dir)
 
const Directionapi_utilities_str2dir (lua_State *L, const char *dir)
 
const Directionapi_utilities_dir_ccw (lua_State *L, Direction dir)
 
const Directionapi_utilities_dir_cw (lua_State *L, Direction dir)
 
const Directionapi_utilities_opposite_dir (lua_State *L, Direction dir)
 
bool api_utilities_direction_is_cardinal (lua_State *L, Direction dir)
 
void api_utilities_deprecation_warning (lua_State *L, char *method, char *replacement, char *deprecated_since)
 

Function Documentation

◆ api_utilities_comparable_version()

const char * api_utilities_comparable_version ( lua_State L)

Comparable freeciv version

Definition at line 79 of file api_common_utilities.c.

Referenced by tolua_common_a_comparable_version00().

◆ api_utilities_deprecation_warning()

void api_utilities_deprecation_warning ( lua_State L,
char method,
char replacement,
char deprecated_since 
)

Lua script wants to warn about use of deprecated construct.

Definition at line 231 of file api_common_utilities.c.

Referenced by tolua_common_a_log_deprecation_warning00().

◆ api_utilities_dir2str()

const char * api_utilities_dir2str ( lua_State L,
Direction  dir 
)

Definition at line 156 of file api_common_utilities.c.

Referenced by tolua_game_Direction_properties_name00().

◆ api_utilities_dir_ccw()

const Direction * api_utilities_dir_ccw ( lua_State L,
Direction  dir 
)

Previous (counter-clockwise) valid direction

Definition at line 178 of file api_common_utilities.c.

Referenced by tolua_game_direction_next_ccw00().

◆ api_utilities_dir_cw()

const Direction * api_utilities_dir_cw ( lua_State L,
Direction  dir 
)

Next (clockwise) valid direction

Definition at line 194 of file api_common_utilities.c.

Referenced by tolua_game_direction_next_cw00().

◆ api_utilities_direction_id()

int api_utilities_direction_id ( lua_State L,
Direction  dir 
)

Definition at line 146 of file api_common_utilities.c.

Referenced by tolua_game_Direction_properties_id00().

◆ api_utilities_direction_is_cardinal()

bool api_utilities_direction_is_cardinal ( lua_State L,
Direction  dir 
)

Is a direction cardinal one?

Definition at line 221 of file api_common_utilities.c.

Referenced by tolua_game_Direction_properties_cardinal00().

◆ api_utilities_fc_version()

const char * api_utilities_fc_version ( lua_State L)

Name and version of freeciv. Deprecated because of the confusing function name.

Definition at line 55 of file api_common_utilities.c.

Referenced by tolua_common_a_fc_version00().

◆ api_utilities_log_base()

void api_utilities_log_base ( lua_State L,
int  level,
const char message 
)

One log message. This module is used by script_game and script_auth.

Definition at line 129 of file api_common_utilities.c.

Referenced by tolua_common_a_log_base00().

◆ api_utilities_name_version()

const char * api_utilities_name_version ( lua_State L)

Return the name and version of freeciv

Definition at line 69 of file api_common_utilities.c.

Referenced by tolua_common_a_name_version00().

◆ api_utilities_opposite_dir()

const Direction * api_utilities_opposite_dir ( lua_State L,
Direction  dir 
)

Opposite direction - validity not checked, but it's valid iff original direction is.

Definition at line 211 of file api_common_utilities.c.

Referenced by tolua_game_direction_opposite00().

◆ api_utilities_random()

int api_utilities_random ( lua_State L,
int  min,
int  max 
)

Generate random number.

Definition at line 40 of file api_common_utilities.c.

Referenced by tolua_common_a_random00().

◆ api_utilities_str2dir()

const Direction * api_utilities_str2dir ( lua_State L,
const char dir 
)

Convert text describing direction into direction

Definition at line 167 of file api_common_utilities.c.

Referenced by tolua_game_direction_str2dir00(), and tolua_game_find_direction00().

◆ api_utilities_version_string()

const char * api_utilities_version_string ( lua_State L)

Version string with no name

Definition at line 89 of file api_common_utilities.c.

Referenced by tolua_common_a_version_string00().

◆ api_utilities_versions_compare()

int api_utilities_versions_compare ( lua_State L,
const char ver1,
const char ver2 
)

Compare two version strings. Return which one is bigger, or zero if they are equal.

Definition at line 100 of file api_common_utilities.c.

Referenced by tolua_common_a_versions_compare00().