Freeciv-3.2: /fast/freeciv/nightly/S3_2/server/edithand.c File Reference

Freeciv-3.2

Loading...
Searching...
No Matches
Functions | Variables
edithand.c File Reference
`#include <limits.h>`
`#include "bitvector.h"`
`#include "fcintl.h"`
`#include "log.h"`
`#include "shared.h"`
`#include "support.h"`
`#include "events.h"`
`#include "game.h"`
`#include "government.h"`
`#include "map.h"`
`#include "movement.h"`
`#include "nation.h"`
`#include "terrain.h"`
`#include "research.h"`
`#include "unitlist.h"`
`#include "aiiface.h"`
`#include "citytools.h"`
`#include "cityturn.h"`
`#include "connecthand.h"`
`#include "gamehand.h"`
`#include <hand_gen.h>`
`#include "maphand.h"`
`#include "plrhand.h"`
`#include "notify.h"`
`#include "sanitycheck.h"`
`#include "stdinhand.h"`
`#include "techtools.h"`
`#include "unittools.h"`
`#include "mapgen_utils.h"`
`#include "savemain.h"`
`#include "edithand.h"`

Go to the source code of this file.

## Functions

void | edithand_init (void)
void | edithand_free (void)
void | edithand_send_initial_packets (struct conn_list *dest)
static void | check_edited_tile_terrains (void)
static void | check_leaving_edit_mode (void)
void | handle_edit_mode (struct connection *pc, bool is_edit_mode)
static bool | edit_tile_terrain_handling (struct tile *ptile, struct terrain *pterrain, bool send_info)
static bool | edit_tile_extra_handling (struct tile *ptile, struct extra_type *pextra, bool remove_mode, bool send_info)
void | handle_edit_tile_terrain (struct connection *pc, int tile, Terrain_type_id terrain, int size)
void | handle_edit_tile_extra (struct connection *pc, int tile, int id, bool removal, int eowner, int size)
void | handle_edit_tile (struct connection *pc, const struct packet_edit_tile *packet)
void | handle_edit_unit_create (struct connection *pc, int owner, int tile, Unit_type_id utid, int count, int tag)
void | handle_edit_unit_remove (struct connection *pc, int owner, int tile, Unit_type_id utid, int count)
void | handle_edit_unit_remove_by_id (struct connection *pc, Unit_type_id id)
void | handle_edit_unit (struct connection *pc, const struct packet_edit_unit *packet)
void | handle_edit_city_create (struct connection *pc, int owner, int tile, int size, int tag)
void | handle_edit_city (struct connection *pc, const struct packet_edit_city *packet)
void | handle_edit_player_create (struct connection *pc, int tag)
void | handle_edit_player_remove (struct connection *pc, int id)
void | handle_edit_player (struct connection *pc, const struct packet_edit_player *packet)
void | handle_edit_player_vision (struct connection *pc, int plr_no, int tile, bool known, int size)
void | handle_edit_recalculate_borders (struct connection *pc)
void | handle_edit_city_remove (struct connection *pc, int id)
void | handle_edit_check_tiles (struct connection *pc)
void | handle_edit_toggle_fogofwar (struct connection *pc, int plr_no)
void | handle_edit_startpos (struct connection *pconn, const struct packet_edit_startpos *packet)
void | handle_edit_startpos_full (struct connection *pconn, const struct packet_edit_startpos_full *packet)
void | handle_edit_game (struct connection *pc, const struct packet_edit_game *packet)
void | handle_edit_scenario_desc (struct connection *pc, const char *scenario_desc)
void | handle_save_scenario (struct connection *pc, const char *name)

## Variables

static bool | need_continents_reassigned = FALSE
static struct tile_hash * | modified_tile_table = NULL
static bool * | unfogged_players

## Function Documentation

## ◆ check_edited_tile_terrains()

static void check_edited_tile_terrains | ( | void |  | ) |

static

Do the potentially slow checks required after one or several tiles' terrain has change.

Definition at line 142 of file edithand.c.

Referenced by check_leaving_edit_mode(), and handle_edit_check_tiles().

## ◆ check_leaving_edit_mode()

static void check_leaving_edit_mode | ( | void |  | ) |

static

Do any necessary checks after leaving edit mode to ensure that the game is in a consistent state.

Definition at line 164 of file edithand.c.

Referenced by handle_edit_mode().

## ◆ edit_tile_extra_handling()

static bool edit_tile_extra_handling | ( | struct tile * | ptile,
|  | struct extra_type * | pextra,
|  | bool | remove_mode,
|  | bool | send_info
| ) |  |

static

Base function to edit the extras property of a tile. Returns TRUE if the extra state has changed.

Definition at line 253 of file edithand.c.

Referenced by handle_edit_tile(), and handle_edit_tile_extra().

## ◆ edit_tile_terrain_handling()

static bool edit_tile_terrain_handling | ( | struct tile * | ptile,
|  | struct terrain * | pterrain,
|  | bool | send_info
| ) |  |

static

Base function to edit the terrain property of a tile. Returns TRUE if the terrain has changed.

Definition at line 221 of file edithand.c.

Referenced by handle_edit_tile_terrain().

## ◆ edithand_free()

void edithand_free | ( | void |  | ) |

Free all memory used by data structures required for edit mode.

Definition at line 96 of file edithand.c.

Referenced by server_quit().

## ◆ edithand_init()

void edithand_init | ( | void |  | ) |

Initialize data structures required for edit mode.

Definition at line 78 of file edithand.c.

Referenced by srv_prepare().

## ◆ edithand_send_initial_packets()

void edithand_send_initial_packets | ( | struct conn_list * | dest | ) |

Send the needed packets for connections entering in the editing mode.

Definition at line 112 of file edithand.c.

Referenced by connection_attach_real(), and handle_edit_mode().

## ◆ handle_edit_check_tiles()

void handle_edit_check_tiles | ( | struct connection * | pc | ) |

Run any pending tile checks.

Definition at line 1302 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_city()

void handle_edit_city | ( | struct connection * | pc,
|  | const struct packet_edit_city * | packet
| ) |  |

Handle a request to change the internal state of a city.

Definition at line 740 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_city_create()

void handle_edit_city_create | ( | struct connection * | pc,
|  | int | owner,
|  | int | tile,
|  | int | size,
|  | int | tag
| ) |  |

Allows the editing client to create a city at the given position and of size 'size'.

Definition at line 684 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_city_remove()

void handle_edit_city_remove | ( | struct connection * | pc,
|  | int | id
| ) |  |

Remove any city at the given location.

Definition at line 1285 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_game()

void handle_edit_game | ( | struct connection * | pc,
|  | const struct packet_edit_game * | packet
| ) |  |

Handle edit requests to the main game data structure.

Definition at line 1421 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_mode()

void handle_edit_mode | ( | struct connection * | pc,
|  | bool | is_edit_mode
| ) |  |

Handles a request by the client to enter edit mode.

Definition at line 188 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_player()

void handle_edit_player | ( | struct connection * | pc,
|  | const struct packet_edit_player * | packet
| ) |  |

Handle editing of any or all player properties.

Definition at line 1003 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_player_create()

void handle_edit_player_create | ( | struct connection * | pc,
|  | int | tag
| ) |  |

Handle a request to create a new player.

Definition at line 900 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_player_remove()

void handle_edit_player_remove | ( | struct connection * | pc,
|  | int | id
| ) |  |

Handle a request to remove a player.

Definition at line 979 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_player_vision()

void handle_edit_player_vision | ( | struct connection * | pc,
|  | int | plr_no,
|  | int | tile,
|  | bool | known,
|  | int | size
| ) |  |

Handles vision editing requests from client.

Definition at line 1205 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_recalculate_borders()

void handle_edit_recalculate_borders | ( | struct connection * | pc | ) |

Client editor requests us to recalculate borders. Note that this does not necessarily extend borders to their maximum due to the way the borders code is written. This may be considered a feature or limitation.

Definition at line 1277 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_scenario_desc()

void handle_edit_scenario_desc | ( | struct connection * | pc,
|  | const char * | scenario_desc
| ) |  |

Handle edit requests to scenario description

Definition at line 1484 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_startpos()

void handle_edit_startpos | ( | struct connection * | pconn,
|  | const struct packet_edit_startpos * | packet
| ) |  |

Create or remove a start position at a tile.

Definition at line 1345 of file edithand.c.

Referenced by client_handle_packet(), and server_handle_packet().

## ◆ handle_edit_startpos_full()

void handle_edit_startpos_full | ( | struct connection * | pconn,
|  | const struct packet_edit_startpos_full * | packet
| ) |  |

Setup which nations can start at a start position.

Definition at line 1383 of file edithand.c.

Referenced by client_handle_packet(), and server_handle_packet().

## ◆ handle_edit_tile()

void handle_edit_tile | ( | struct connection * | pc,
|  | const struct packet_edit_tile * | packet
| ) |  |

Handles tile information from the client, to make edits to tiles.

Definition at line 375 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_tile_extra()

void handle_edit_tile_extra | ( | struct connection * | pc,
|  | int | tile,
|  | int | id,
|  | bool | removal,
|  | int | eowner,
|  | int | size
| ) |  |

Handle a request to change one or more tiles' extras. The 'remove' argument controls whether to remove or add the given extra from the tile.

Definition at line 335 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_tile_terrain()

void handle_edit_tile_terrain | ( | struct connection * | pc,
|  | int | tile,
|  | Terrain_type_id | terrain,
|  | int | size
| ) |  |

Handles a client request to change the terrain of the tile at the given x, y coordinates. The 'size' parameter indicates that all tiles in a square of "radius" 'size' should be affected. So size=1 corresponds to the single tile case.

Definition at line 298 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_toggle_fogofwar()

void handle_edit_toggle_fogofwar | ( | struct connection * | pc,
|  | int | plr_no
| ) |  |

Temporarily remove fog-of-war for the player with player number 'plr_no'. This will only stay in effect while the server is in edit mode and the connection is editing. Has no effect if fog-of-war is disabled globally.

Definition at line 1312 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_unit()

void handle_edit_unit | ( | struct connection * | pc,
|  | const struct packet_edit_unit * | packet
| ) |  |

Handles unit information from the client, to make edits to units.

Definition at line 608 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_unit_create()

void handle_edit_unit_create | ( | struct connection * | pc,
|  | int | owner,
|  | int | tile,
|  | Unit_type_id | utid,
|  | int | count,
|  | int | tag
| ) |  |

Handle a request to create 'count' units of type 'utid' at the tile given by the x, y coordinates and owned by player with number 'owner'.

Definition at line 433 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_unit_remove()

void handle_edit_unit_remove | ( | struct connection * | pc,
|  | int | owner,
|  | int | tile,
|  | Unit_type_id | utid,
|  | int | count
| ) |  |

Remove 'count' units of type 'utid' owned by player number 'owner' at tile (x, y).

Definition at line 536 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_edit_unit_remove_by_id()

void handle_edit_unit_remove_by_id | ( | struct connection * | pc,
|  | Unit_type_id | id
| ) |  |

Handle a request to remove a unit given by its id.

Definition at line 591 of file edithand.c.

Referenced by server_handle_packet().

## ◆ handle_save_scenario()

void handle_save_scenario | ( | struct connection * | pc,
|  | const char * | name
| ) |  |

Make scenario file out of current game.

Definition at line 1496 of file edithand.c.

Referenced by server_handle_packet().

## Variable Documentation

## ◆ modified_tile_table

struct tile_hash* modified_tile_table = NULL

static

Definition at line 68 of file edithand.c.

Referenced by check_edited_tile_terrains(), edit_tile_terrain_handling(), edithand_free(), and edithand_init().

## ◆ need_continents_reassigned

bool need_continents_reassigned = FALSE

static

Definition at line 64 of file edithand.c.

Referenced by check_edited_tile_terrains(), edit_tile_terrain_handling(), and edithand_init().

## ◆ unfogged_players

bool* unfogged_players

static

Definition at line 73 of file edithand.c.

Referenced by check_leaving_edit_mode(), edithand_free(), edithand_init(), and handle_edit_toggle_fogofwar().