![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <cstdarg>#include <ctime>#include <sys/stat.h>#include "lua.h"#include "tolua.h"#include "log.h"#include "registry.h"#include "registry_ini.h"#include "api_game_specenum.h"#include "luascript.h"#include "luascript_func.h"#include "luascript_signal.h"#include "tolua_game_gen.h"#include "tolua_signal_gen.h"#include "console.h"#include "stdinhand.h"#include "tolua_server_gen.h"#include "script_server.h"
Include dependency graph for script_server.cpp:Go to the source code of this file.
Functions | |
| static void | script_server_vars_init () |
| Initialize the game script variables. More... | |
| static void | script_server_vars_free () |
| Free the game script variables. More... | |
| static void | script_server_vars_load (struct section_file *file) |
| Load the game script variables in file. More... | |
| static void | script_server_vars_save (struct section_file *file) |
| Save the game script variables to file. More... | |
| static void | script_server_code_init () |
| Initialize the optional game script code (useful for scenarios). More... | |
| static void | script_server_code_free () |
| Free the optional game script code (useful for scenarios). More... | |
| static void | script_server_code_load (struct section_file *file) |
| Load the optional game script code from file (useful for scenarios). More... | |
| static void | script_server_code_save (struct section_file *file) |
| Save the optional game script code to file (useful for scenarios). More... | |
| static void | script_server_signals_create () |
| Declare any new signal types you need here. More... | |
| static void | script_server_functions_define () |
| Add server callback functions; these must be defined in the lua script '[rulesetdir]/script.lua': More... | |
| static void | script_server_cmd_reply (struct fc_lua *fcl, QtMsgType level, const char *format,...) |
| Send the message via cmd_reply(). More... | |
| static void static bool | script_server_do_string_shared (struct fc_lua *fcl, struct connection *caller, const char *str) |
| Parse and execute the script in str in the context of the specified instance. More... | |
| bool | script_server_do_string (struct connection *caller, const char *str) |
| Parse and execute the script in str in the same instance as the ruleset. More... | |
| bool | script_server_unsafe_do_string (struct connection *caller, const char *str) |
| Parse and execute the script in str in an unsafe instance. More... | |
| bool | script_server_load_file (const char *filename, char **buf) |
| Load script to a buffer. More... | |
| static bool | script_server_do_file_shared (struct fc_lua *fcl, struct connection *caller, const char *filename) |
| Parse and execute the script at filename in the context of the specified instance. More... | |
| bool | script_server_do_file (struct connection *caller, const char *filename) |
| Parse and execute the script at filename in the same instance as the ruleset. More... | |
| bool | script_server_unsafe_do_file (struct connection *caller, const char *filename) |
| Parse and execute the script at filename in an unsafe instance. More... | |
| void | script_server_remove_exported_object (void *object) |
| Mark any, if exported, full userdata representing 'object' in the current script state as 'Nonexistent'. More... | |
| bool | script_server_init () |
| Initialize the scripting state. More... | |
| void | script_server_free () |
| Free the scripting data. More... | |
| void | script_server_state_load (struct section_file *file) |
| Load the scripting state from file. More... | |
| void | script_server_state_save (struct section_file *file) |
| Save the scripting state to file. More... | |
| void | script_server_signal_emit (const char *signal_name,...) |
| Invoke all the callback functions attached to a given signal. More... | |
| bool | script_server_call (const char *func_name,...) |
| Call a lua function. More... | |
Variables | |
| static struct fc_lua * | fcl_main = nullptr |
| Lua virtual machine states. More... | |
| static struct fc_lua * | fcl_unsafe = nullptr |
| static char * | script_server_code = nullptr |
| Optional game script code (useful for scenarios). More... | |
| bool script_server_call | ( | const char * | func_name, |
| ... | |||
| ) |
Call a lua function.
Definition at line 525 of file script_server.cpp.
|
static |
Send the message via cmd_reply().
Definition at line 540 of file script_server.cpp.
Referenced by script_server_do_file_shared(), and script_server_do_string_shared().
|
static |
Free the optional game script code (useful for scenarios).
Definition at line 241 of file script_server.cpp.
Referenced by script_server_free().
|
static |
Initialize the optional game script code (useful for scenarios).
Definition at line 236 of file script_server.cpp.
Referenced by script_server_init().
|
static |
Load the optional game script code from file (useful for scenarios).
Definition at line 252 of file script_server.cpp.
Referenced by script_server_state_load().
|
static |
Save the optional game script code to file (useful for scenarios).
Definition at line 267 of file script_server.cpp.
Referenced by script_server_state_save().
| bool script_server_do_file | ( | struct connection * | caller, |
| const char * | filename | ||
| ) |
Parse and execute the script at filename in the same instance as the ruleset.
Definition at line 178 of file script_server.cpp.
Referenced by lua_command().
|
static |
Parse and execute the script at filename in the context of the specified instance.
Definition at line 150 of file script_server.cpp.
Referenced by script_server_do_file(), and script_server_unsafe_do_file().
| bool script_server_do_string | ( | struct connection * | caller, |
| const char * | str | ||
| ) |
Parse and execute the script in str in the same instance as the ruleset.
Definition at line 101 of file script_server.cpp.
Referenced by lua_command().
|
static |
Parse and execute the script in str in the context of the specified instance.
Definition at line 74 of file script_server.cpp.
Referenced by script_server_do_string(), and script_server_unsafe_do_string().
| void script_server_free | ( | ) |
Free the scripting data.
Definition at line 337 of file script_server.cpp.
Referenced by load_rulesetdir(), and rulesets_deinit().
|
static |
Add server callback functions; these must be defined in the lua script '[rulesetdir]/script.lua':
respawn_callback (optional):
Definition at line 516 of file script_server.cpp.
Referenced by script_server_init().
| bool script_server_init | ( | ) |
Initialize the scripting state.
Definition at line 277 of file script_server.cpp.
Referenced by load_rulesetdir().
| bool script_server_load_file | ( | const char * | filename, |
| char ** | buf | ||
| ) |
Load script to a buffer.
Definition at line 118 of file script_server.cpp.
| void script_server_remove_exported_object | ( | void * | object | ) |
Mark any, if exported, full userdata representing 'object' in the current script state as 'Nonexistent'.
This changes the type of the lua variable.
Definition at line 197 of file script_server.cpp.
Referenced by player_limit_to_max_rates(), remove_city(), and server_remove_unit_full().
| void script_server_signal_emit | ( | const char * | signal_name, |
| ... | |||
| ) |
Invoke all the callback functions attached to a given signal.
Definition at line 379 of file script_server.cpp.
Referenced by apply_disaster(), begin_turn(), building_removed(), city_add_unit(), city_build_building(), city_build_unit(), city_change_size(), city_create_unit(), city_increase_size(), city_populate(), city_reduce_size(), civil_war(), create_city(), diplomat_incite(), disband_city(), do_city_migration(), do_nuclear_explosion(), do_tech_parasite_effect(), end_turn(), handle_diplomacy_accept_treaty_req(), kill_player(), freeciv::server::pulse(), script_tech_learned(), server_remove_unit_full(), srv_ready(), unit_conquer_city(), unit_do_destroy_city(), unit_enter_hut(), unit_move(), worklist_change_build_target(), and worklist_item_postpone_req_vec().
|
static |
Declare any new signal types you need here.
Definition at line 391 of file script_server.cpp.
Referenced by script_server_init().
| void script_server_state_load | ( | struct section_file * | file | ) |
Load the scripting state from file.
Definition at line 358 of file script_server.cpp.
Referenced by sg_load_script().
| void script_server_state_save | ( | struct section_file * | file | ) |
Save the scripting state to file.
Definition at line 370 of file script_server.cpp.
Referenced by sg_save_script().
| bool script_server_unsafe_do_file | ( | struct connection * | caller, |
| const char * | filename | ||
| ) |
Parse and execute the script at filename in an unsafe instance.
Definition at line 186 of file script_server.cpp.
Referenced by lua_command().
| bool script_server_unsafe_do_string | ( | struct connection * | caller, |
| const char * | str | ||
| ) |
Parse and execute the script in str in an unsafe instance.
Definition at line 109 of file script_server.cpp.
Referenced by lua_command().
|
static |
Free the game script variables.
Definition at line 213 of file script_server.cpp.
Referenced by script_server_free().
|
static |
Initialize the game script variables.
Definition at line 206 of file script_server.cpp.
Referenced by script_server_init().
|
static |
Load the game script variables in file.
Definition at line 220 of file script_server.cpp.
Referenced by script_server_state_load().
|
static |
Save the game script variables to file.
Definition at line 228 of file script_server.cpp.
Referenced by script_server_state_save().
|
static |
Lua virtual machine states.
Definition at line 46 of file script_server.cpp.
Referenced by script_server_call(), script_server_code_load(), script_server_do_file(), script_server_do_string(), script_server_free(), script_server_functions_define(), script_server_init(), script_server_remove_exported_object(), script_server_signal_emit(), script_server_signals_create(), script_server_vars_load(), and script_server_vars_save().
|
static |
Definition at line 47 of file script_server.cpp.
Referenced by script_server_free(), script_server_init(), script_server_remove_exported_object(), script_server_unsafe_do_file(), and script_server_unsafe_do_string().
|
static |
Optional game script code (useful for scenarios).
Definition at line 52 of file script_server.cpp.
Referenced by script_server_code_free(), script_server_code_init(), script_server_code_load(), and script_server_code_save().