Freeciv21
Develop your civilization from humble roots to a global empire
api_server_edit.cpp File Reference
#include "city.h"
#include "cityturn.h"
#include "fcintl.h"
#include "rand.h"
#include "movement.h"
#include "research.h"
#include "unittype.h"
#include "api_game_find.h"
#include "luascript.h"
#include "aiiface.h"
#include "barbarian.h"
#include "citytools.h"
#include "console.h"
#include "maphand.h"
#include "notify.h"
#include "plrhand.h"
#include "srv_main.h"
#include "stdinhand.h"
#include "techtools.h"
#include "unittools.h"
#include "mapgen_utils.h"
#include "api_server_edit.h"
+ Include dependency graph for api_server_edit.cpp:

Go to the source code of this file.

Functions

bool api_edit_unleash_barbarians (lua_State *L, Tile *ptile)
 Unleash barbarians on a tile, for example from a hut. More...
 
void api_edit_place_partisans (lua_State *L, Tile *ptile, Player *pplayer, int count, int sq_radius)
 Place partisans for a player around a tile (normally around a city). More...
 
Unitapi_edit_create_unit (lua_State *L, Player *pplayer, Tile *ptile, Unit_Type *ptype, int veteran_level, City *homecity, int moves_left)
 Create a new unit. More...
 
Unitapi_edit_create_unit_full (lua_State *L, Player *pplayer, Tile *ptile, Unit_Type *ptype, int veteran_level, City *homecity, int moves_left, int hp_left, Unit *ptransport)
 Create a new unit. More...
 
bool api_edit_unit_teleport (lua_State *L, Unit *punit, Tile *dest)
 Teleport unit to destination tile. More...
 
void api_edit_unit_turn (lua_State *L, Unit *punit, Direction dir)
 Change unit orientation. More...
 
void api_edit_unit_kill (lua_State *L, Unit *punit, const char *reason, Player *killer)
 Kill the unit. More...
 
bool api_edit_change_terrain (lua_State *L, Tile *ptile, Terrain *pterr)
 Change terrain on tile. More...
 
void api_edit_create_city (lua_State *L, Player *pplayer, Tile *ptile, const char *name)
 Create a new city. More...
 
void api_edit_resize_city (lua_State *L, City *pcity, int size, const char *reason)
 Resizes a city. More...
 
Playerapi_edit_create_player (lua_State *L, const char *username, Nation_Type *pnation, const char *ai)
 Create a new player. More...
 
void api_edit_change_gold (lua_State *L, Player *pplayer, int amount)
 Change pplayer's gold by amount. More...
 
Tech_Typeapi_edit_give_technology (lua_State *L, Player *pplayer, Tech_Type *ptech, int cost, bool notify, const char *reason)
 Give pplayer technology ptech. More...
 
bool api_edit_trait_mod_set (lua_State *L, Player *pplayer, const char *tname, const int mod)
 Modify player's trait value. More...
 
void api_edit_create_owned_extra (lua_State *L, Tile *ptile, const char *name, Player *pplayer)
 Create a new owned extra. More...
 
void api_edit_create_extra (lua_State *L, Tile *ptile, const char *name)
 Create a new extra. More...
 
void api_edit_create_base (lua_State *L, Tile *ptile, const char *name, Player *pplayer)
 Create a new base. More...
 
void api_edit_create_road (lua_State *L, Tile *ptile, const char *name)
 Add a new road. More...
 
void api_edit_remove_extra (lua_State *L, Tile *ptile, const char *name)
 Remove extra from tile, if present. More...
 
void api_edit_tile_set_label (lua_State *L, Tile *ptile, const char *label)
 Set tile label text. More...
 
void api_edit_climate_change (lua_State *L, enum climate_change_type type, int effect)
 Global climate change. More...
 
Playerapi_edit_civil_war (lua_State *L, Player *pplayer, int probability)
 Provoke a civil war. More...
 
void api_edit_player_victory (lua_State *L, Player *pplayer)
 Make player winner of the scenario. More...
 
bool api_edit_unit_move (lua_State *L, Unit *punit, Tile *ptile, int movecost)
 Move a unit. More...
 
void api_edit_unit_moving_disallow (lua_State *L, Unit *punit)
 Prohibit unit from moving. More...
 
void api_edit_unit_moving_allow (lua_State *L, Unit *punit)
 Allow unit to move. More...
 
void api_edit_city_add_history (lua_State *L, City *pcity, int amount)
 Add history to a city. More...
 
void api_edit_player_add_history (lua_State *L, Player *pplayer, int amount)
 Add history to a player. More...
 

Function Documentation

◆ api_edit_change_gold()

void api_edit_change_gold ( lua_State *  L,
Player pplayer,
int  amount 
)

Change pplayer's gold by amount.

Definition at line 336 of file api_server_edit.cpp.

◆ api_edit_change_terrain()

bool api_edit_change_terrain ( lua_State *  L,
Tile ptile,
Terrain pterr 
)

Change terrain on tile.

Definition at line 238 of file api_server_edit.cpp.

◆ api_edit_city_add_history()

void api_edit_city_add_history ( lua_State *  L,
City pcity,
int  amount 
)

Add history to a city.

Definition at line 638 of file api_server_edit.cpp.

◆ api_edit_civil_war()

Player* api_edit_civil_war ( lua_State *  L,
Player pplayer,
int  probability 
)

Provoke a civil war.

Definition at line 541 of file api_server_edit.cpp.

◆ api_edit_climate_change()

void api_edit_climate_change ( lua_State *  L,
enum climate_change_type  type,
int  effect 
)

Global climate change.

Definition at line 525 of file api_server_edit.cpp.

◆ api_edit_create_base()

void api_edit_create_base ( lua_State *  L,
Tile ptile,
const char *  name,
Player pplayer 
)

Create a new base.

Definition at line 471 of file api_server_edit.cpp.

◆ api_edit_create_city()

void api_edit_create_city ( lua_State *  L,
Player pplayer,
Tile ptile,
const char *  name 
)

Create a new city.

Definition at line 269 of file api_server_edit.cpp.

◆ api_edit_create_extra()

void api_edit_create_extra ( lua_State *  L,
Tile ptile,
const char *  name 
)

Create a new extra.

Definition at line 463 of file api_server_edit.cpp.

◆ api_edit_create_owned_extra()

void api_edit_create_owned_extra ( lua_State *  L,
Tile ptile,
const char *  name,
Player pplayer 
)

Create a new owned extra.

Definition at line 440 of file api_server_edit.cpp.

Referenced by api_edit_create_base(), api_edit_create_extra(), and api_edit_create_road().

◆ api_edit_create_player()

Player* api_edit_create_player ( lua_State *  L,
const char *  username,
Nation_Type pnation,
const char *  ai 
)

Create a new player.

Definition at line 301 of file api_server_edit.cpp.

◆ api_edit_create_road()

void api_edit_create_road ( lua_State *  L,
Tile ptile,
const char *  name 
)

Add a new road.

Definition at line 480 of file api_server_edit.cpp.

◆ api_edit_create_unit()

Unit* api_edit_create_unit ( lua_State *  L,
Player pplayer,
Tile ptile,
Unit_Type ptype,
int  veteran_level,
City homecity,
int  moves_left 
)

Create a new unit.

Definition at line 73 of file api_server_edit.cpp.

◆ api_edit_create_unit_full()

Unit* api_edit_create_unit_full ( lua_State *  L,
Player pplayer,
Tile ptile,
Unit_Type ptype,
int  veteran_level,
City homecity,
int  moves_left,
int  hp_left,
Unit ptransport 
)

Create a new unit.

Definition at line 84 of file api_server_edit.cpp.

Referenced by api_edit_create_unit().

◆ api_edit_give_technology()

Tech_Type* api_edit_give_technology ( lua_State *  L,
Player pplayer,
Tech_Type ptech,
int  cost,
bool  notify,
const char *  reason 
)

Give pplayer technology ptech.

Quietly returns nullptr if player already has this tech; otherwise returns the tech granted. Use nullptr for ptech to grant a random tech. sends script signal "tech_researched" with the given reason

Definition at line 350 of file api_server_edit.cpp.

◆ api_edit_place_partisans()

void api_edit_place_partisans ( lua_State *  L,
Tile ptile,
Player pplayer,
int  count,
int  sq_radius 
)

Place partisans for a player around a tile (normally around a city).

Definition at line 57 of file api_server_edit.cpp.

◆ api_edit_player_add_history()

void api_edit_player_add_history ( lua_State *  L,
Player pplayer,
int  amount 
)

Add history to a player.

Definition at line 649 of file api_server_edit.cpp.

◆ api_edit_player_victory()

void api_edit_player_victory ( lua_State *  L,
Player pplayer 
)

Make player winner of the scenario.

Definition at line 570 of file api_server_edit.cpp.

◆ api_edit_remove_extra()

void api_edit_remove_extra ( lua_State *  L,
Tile ptile,
const char *  name 
)

Remove extra from tile, if present.

Definition at line 488 of file api_server_edit.cpp.

◆ api_edit_resize_city()

void api_edit_resize_city ( lua_State *  L,
City pcity,
int  size,
const char *  reason 
)

Resizes a city.

Definition at line 287 of file api_server_edit.cpp.

◆ api_edit_tile_set_label()

void api_edit_tile_set_label ( lua_State *  L,
Tile ptile,
const char *  label 
)

Set tile label text.

Definition at line 510 of file api_server_edit.cpp.

◆ api_edit_trait_mod_set()

bool api_edit_trait_mod_set ( lua_State *  L,
Player pplayer,
const char *  tname,
const int  mod 
)

Modify player's trait value.

Definition at line 419 of file api_server_edit.cpp.

◆ api_edit_unit_kill()

void api_edit_unit_kill ( lua_State *  L,
Unit punit,
const char *  reason,
Player killer 
)

Kill the unit.

Definition at line 218 of file api_server_edit.cpp.

◆ api_edit_unit_move()

bool api_edit_unit_move ( lua_State *  L,
Unit punit,
Tile ptile,
int  movecost 
)

Move a unit.

Definition at line 581 of file api_server_edit.cpp.

◆ api_edit_unit_moving_allow()

void api_edit_unit_moving_allow ( lua_State *  L,
Unit punit 
)

Allow unit to move.

Definition at line 625 of file api_server_edit.cpp.

◆ api_edit_unit_moving_disallow()

void api_edit_unit_moving_disallow ( lua_State *  L,
Unit punit 
)

Prohibit unit from moving.

Definition at line 612 of file api_server_edit.cpp.

◆ api_edit_unit_teleport()

bool api_edit_unit_teleport ( lua_State *  L,
Unit punit,
Tile dest 
)

Teleport unit to destination tile.

Definition at line 154 of file api_server_edit.cpp.

◆ api_edit_unit_turn()

void api_edit_unit_turn ( lua_State *  L,
Unit punit,
Direction  dir 
)

Change unit orientation.

Definition at line 201 of file api_server_edit.cpp.

◆ api_edit_unleash_barbarians()

bool api_edit_unleash_barbarians ( lua_State *  L,
Tile ptile 
)

Unleash barbarians on a tile, for example from a hut.

Definition at line 46 of file api_server_edit.cpp.