Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions | Variables
editor.c File Reference
#include <stdarg.h>
#include <string.h>
#include "bitvector.h"
#include "fcintl.h"
#include "log.h"
#include "support.h"
#include "game.h"
#include "map.h"
#include "movement.h"
#include "packets.h"
#include "client_main.h"
#include "climap.h"
#include "control.h"
#include "editor.h"
#include "mapctrl_common.h"
#include "tilespec.h"
#include "zoom.h"
#include "editgui_g.h"
#include "mapview_g.h"

Go to the source code of this file.

Data Structures

struct  edit_buffer
 
struct  editor_tool
 
struct  editor_state
 

Enumerations

enum  selection_modes { SELECTION_MODE_NEW = 0 , SELECTION_MODE_ADD , SELECTION_MODE_REMOVE }
 
enum  editor_tool_flags {
  ETF_NO_FLAGS = 0 , ETF_HAS_VALUE = 1<<0 , ETF_HAS_SIZE = 1<<1 , ETF_HAS_COUNT = 1<<2 ,
  ETF_HAS_APPLIED_PLAYER = 1<<3 , ETF_HAS_VALUE_ERASE = 1<<4
}
 

Functions

static void tool_set_init_value (enum editor_tool_type ett)
 
static void tool_init (enum editor_tool_type ett, const char *name, int flags, const char *tooltip)
 
void editor_ruleset_changed (void)
 
void editor_init (void)
 
void editor_clear (void)
 
void editor_free (void)
 
void editor_set_tool (enum editor_tool_type ett)
 
enum editor_tool_type editor_get_tool (void)
 
void editor_tool_set_mode (enum editor_tool_type ett, enum editor_tool_mode etm)
 
bool editor_tool_has_mode (enum editor_tool_type ett, enum editor_tool_mode etm)
 
enum editor_tool_mode editor_tool_get_mode (enum editor_tool_type ett)
 
bool editor_is_active (void)
 
bool editor_tool_is_usable (enum editor_tool_type ett)
 
bool editor_tool_has_value (enum editor_tool_type ett)
 
void editor_tool_set_value (enum editor_tool_type ett, int value)
 
int editor_tool_get_value (enum editor_tool_type ett)
 
static void editor_start_selection_rectangle (int canvas_x, int canvas_y)
 
static bool tile_really_has_any_specials (const struct tile *ptile)
 
static void editor_grab_applied_player (const struct tile *ptile)
 
static void editor_grab_tool (const struct tile *ptile)
 
static bool can_edit_tile_properties (struct tile *ptile)
 
static void popup_properties (struct tile *ptile)
 
void editor_mouse_button_press (int canvas_x, int canvas_y, int button, int modifiers)
 
static void editor_end_selection_rectangle (int canvas_x, int canvas_y)
 
static void editor_draw_selrect (void)
 
void editor_mouse_button_release (int canvas_x, int canvas_y, int button, int modifiers)
 
static void editor_resize_selection_rectangle (int canvas_x, int canvas_y)
 
void editor_mouse_move (int canvas_x, int canvas_y, int modifiers)
 
void editor_notify_edit_finished (void)
 
void editor_apply_tool (const struct tile *ptile, bool part_of_selection)
 
void editor_set_current_tile (const struct tile *ptile)
 
const struct tileeditor_get_current_tile (void)
 
void editor_tool_toggle_mode (enum editor_tool_type ett, enum editor_tool_mode etm)
 
void editor_tool_cycle_mode (enum editor_tool_type ett)
 
void editor_selection_clear (void)
 
void editor_selection_add (const struct tile *ptile)
 
void editor_selection_remove (const struct tile *ptile)
 
bool editor_tile_is_selected (const struct tile *ptile)
 
void editor_apply_tool_to_selection (void)
 
const chareditor_tool_get_name (enum editor_tool_type ett)
 
const chareditor_tool_get_value_name (enum editor_tool_type emt, int value)
 
bool editor_tool_has_size (enum editor_tool_type ett)
 
int editor_tool_get_size (enum editor_tool_type ett)
 
void editor_tool_set_size (enum editor_tool_type ett, int size)
 
bool editor_tool_has_count (enum editor_tool_type ett)
 
int editor_tool_get_count (enum editor_tool_type ett)
 
void editor_tool_set_count (enum editor_tool_type ett, int count)
 
struct spriteeditor_tool_get_sprite (enum editor_tool_type ett)
 
const chareditor_tool_get_tooltip (enum editor_tool_type ett)
 
int editor_tool_get_applied_player (enum editor_tool_type ett)
 
void editor_tool_set_applied_player (enum editor_tool_type ett, int player_no)
 
bool editor_tool_has_applied_player (enum editor_tool_type ett)
 
bool editor_tool_has_value_erase (enum editor_tool_type ett)
 
int editor_selection_count (void)
 
struct uniteditor_unit_virtual_create (void)
 
struct edit_bufferedit_buffer_new (int type_flags)
 
void edit_buffer_free (struct edit_buffer *ebuf)
 
void edit_buffer_clear (struct edit_buffer *ebuf)
 
void edit_buffer_copy_square (struct edit_buffer *ebuf, const struct tile *center, int radius)
 
void edit_buffer_copy (struct edit_buffer *ebuf, const struct tile *ptile)
 
static void fill_tile_edit_packet (struct packet_edit_tile *packet, const struct tile *ptile)
 
static void paste_tile (struct edit_buffer *ebuf, const struct tile *vtile, const struct tile *ptile_dest)
 
void edit_buffer_paste (struct edit_buffer *ebuf, const struct tile *dest)
 
struct edit_buffereditor_get_copy_buffer (void)
 
const chareditor_tool_get_mode_name (enum editor_tool_type ett, enum editor_tool_mode etm)
 
const chareditor_get_mode_tooltip (enum editor_tool_mode etm)
 
struct spriteeditor_get_mode_sprite (enum editor_tool_mode etm)
 
int edit_buffer_get_status_string (const struct edit_buffer *ebuf, char *buf, int buflen)
 
void edit_buffer_set_origin (struct edit_buffer *ebuf, const struct tile *ptile)
 
const struct tileedit_buffer_get_origin (const struct edit_buffer *ebuf)
 
bool edit_buffer_has_type (const struct edit_buffer *ebuf, int type)
 
const struct tileeditor_get_selection_center (void)
 

Variables

static struct editor_stateeditor = NULL
 

Enumeration Type Documentation

◆ editor_tool_flags

Enumerator
ETF_NO_FLAGS 
ETF_HAS_VALUE 
ETF_HAS_SIZE 
ETF_HAS_COUNT 
ETF_HAS_APPLIED_PLAYER 
ETF_HAS_VALUE_ERASE 

Definition at line 53 of file editor.c.

◆ selection_modes

Enumerator
SELECTION_MODE_NEW 
SELECTION_MODE_ADD 
SELECTION_MODE_REMOVE 

Definition at line 47 of file editor.c.

Function Documentation

◆ can_edit_tile_properties()

static bool can_edit_tile_properties ( struct tile ptile)
inlinestatic

Returns TRUE if the given tile has some objects with editable properties.

Definition at line 621 of file editor.c.

Referenced by popup_properties().

◆ edit_buffer_clear()

void edit_buffer_clear ( struct edit_buffer ebuf)

Remove all copy data stored in the edit buffer.

Definition at line 1470 of file editor.c.

Referenced by editor_apply_tool(), editor_apply_tool_to_selection(), and editor_clear().

◆ edit_buffer_copy()

void edit_buffer_copy ( struct edit_buffer ebuf,
const struct tile ptile 
)

Append a single tile to the copy buffer.

Definition at line 1505 of file editor.c.

Referenced by edit_buffer_copy_square(), and editor_apply_tool().

◆ edit_buffer_copy_square()

void edit_buffer_copy_square ( struct edit_buffer ebuf,
const struct tile center,
int  radius 
)

Copy from a square region of half-width 'radius' centered around 'center' into the buffer.

Definition at line 1488 of file editor.c.

Referenced by editor_apply_tool().

◆ edit_buffer_free()

void edit_buffer_free ( struct edit_buffer ebuf)

Free all memory allocated for the edit buffer.

Definition at line 1451 of file editor.c.

Referenced by editor_free().

◆ edit_buffer_get_origin()

const struct tile * edit_buffer_get_origin ( const struct edit_buffer ebuf)

Return the previously set origin, or NULL if none.

Definition at line 1910 of file editor.c.

Referenced by edit_buffer_paste().

◆ edit_buffer_get_status_string()

int edit_buffer_get_status_string ( const struct edit_buffer ebuf,
char buf,
int  buflen 
)

Fill the supplied buffer with a translated string describing the edit buffer's current state. Returns the number of bytes used.

Definition at line 1870 of file editor.c.

Referenced by editinfobox_refresh().

◆ edit_buffer_has_type()

bool edit_buffer_has_type ( const struct edit_buffer ebuf,
int  type 
)

Returns TRUE if the edit buffer was created with the given type flag.

Definition at line 1921 of file editor.c.

◆ edit_buffer_new()

struct edit_buffer * edit_buffer_new ( int  type_flags)

Create a new edit buffer corresponding to all types set in 'type_flags'.

Definition at line 1433 of file editor.c.

Referenced by editor_init().

◆ edit_buffer_paste()

void edit_buffer_paste ( struct edit_buffer ebuf,
const struct tile dest 
)

Paste the entire contents of the edit buffer using 'dest' as the origin.

Definition at line 1735 of file editor.c.

Referenced by editor_apply_tool().

◆ edit_buffer_set_origin()

void edit_buffer_set_origin ( struct edit_buffer ebuf,
const struct tile ptile 
)

Set the "origin" for subsequent copy operations. This controls the x and y offset of newly created virtual tiles in the buffer.

Definition at line 1898 of file editor.c.

Referenced by edit_buffer_clear(), edit_buffer_copy_square(), and editor_apply_tool_to_selection().

◆ editor_apply_tool()

void editor_apply_tool ( const struct tile ptile,
bool  part_of_selection 
)

Apply the current editor tool to the given tile. This function is suitable to called over multiple tiles at once. Once the batch of operations is finished you should call editor_notify_edit_finished. The 'part_of_selection' parameter should be TRUE if the tool is being applied to a tile from a selection.

Definition at line 909 of file editor.c.

Referenced by editor_apply_tool_to_selection(), editor_mouse_button_press(), and editor_mouse_move().

◆ editor_apply_tool_to_selection()

void editor_apply_tool_to_selection ( void  )

Apply the current editor tool to all tiles in the current selection.

Definition at line 1128 of file editor.c.

Referenced by handle_edit_key_press(), and handle_edit_key_press().

◆ editor_clear()

void editor_clear ( void  )

Clear the editor data which is game dependent.

Definition at line 246 of file editor.c.

Referenced by set_client_state().

◆ editor_draw_selrect()

static void editor_draw_selrect ( void  )
static

Draws the editor selection rectangle using draw_selection_rectangle().

Definition at line 780 of file editor.c.

Referenced by editor_resize_selection_rectangle().

◆ editor_end_selection_rectangle()

static void editor_end_selection_rectangle ( int  canvas_x,
int  canvas_y 
)
static

Record and handle the end of the selection rectangle.

Definition at line 722 of file editor.c.

Referenced by editor_mouse_button_release().

◆ editor_free()

void editor_free ( void  )

Free the client's editor.

Definition at line 257 of file editor.c.

Referenced by client_exit().

◆ editor_get_copy_buffer()

struct edit_buffer * editor_get_copy_buffer ( void  )

Returns the copy buffer for the given tool.

Definition at line 1767 of file editor.c.

Referenced by editinfobox_refresh(), editor_apply_tool(), and editor_apply_tool_to_selection().

◆ editor_get_current_tile()

const struct tile * editor_get_current_tile ( void  )

Get the tile that the user's mouse pointer is currently over.

Definition at line 1028 of file editor.c.

Referenced by editor_mouse_move().

◆ editor_get_mode_sprite()

struct sprite * editor_get_mode_sprite ( enum editor_tool_mode  etm)

Returns the editor sprite corresponding to the tool mode.

Definition at line 1837 of file editor.c.

Referenced by editbar_add_mode_button(), and get_tool_mode_pixbuf().

◆ editor_get_mode_tooltip()

const char * editor_get_mode_tooltip ( enum editor_tool_mode  etm)

Returns a translated tooltip string assumed to be used for the toggle button for this tool mode in the editor gui.

Definition at line 1815 of file editor.c.

Referenced by editbar_add_mode_button().

◆ editor_get_selection_center()

const struct tile * editor_get_selection_center ( void  )

Returns the "center" tile of a group of selected tiles, or NULL. The center is calculated as the vector sum divided by the number of tiles, i.e. the average of the map distance vectors of the selected tiles.

Definition at line 1934 of file editor.c.

Referenced by editor_apply_tool_to_selection().

◆ editor_get_tool()

enum editor_tool_type editor_get_tool ( void  )

◆ editor_grab_applied_player()

static void editor_grab_applied_player ( const struct tile ptile)
static

Set the editor's current applied player number according to what exists on the given tile.

Definition at line 465 of file editor.c.

Referenced by editor_mouse_button_press().

◆ editor_grab_tool()

static void editor_grab_tool ( const struct tile ptile)
static

Set the editor's current tool according to what exists at the given tile.

Definition at line 497 of file editor.c.

Referenced by editor_mouse_button_press().

◆ editor_init()

void editor_init ( void  )

Initialize the client's editor state information to some suitable default values. This only needs to be done once at client start.

Definition at line 193 of file editor.c.

Referenced by default_tileset_select().

◆ editor_is_active()

bool editor_is_active ( void  )

◆ editor_mouse_button_press()

void editor_mouse_button_press ( int  canvas_x,
int  canvas_y,
int  button,
int  modifiers 
)

Handle a user's mouse button press at the given point on the map canvas.

Definition at line 661 of file editor.c.

Referenced by handle_edit_mouse_button_press(), and handle_edit_mouse_button_press().

◆ editor_mouse_button_release()

void editor_mouse_button_release ( int  canvas_x,
int  canvas_y,
int  button,
int  modifiers 
)

Handle the release of a mouse button click.

Definition at line 798 of file editor.c.

Referenced by handle_edit_mouse_button_release(), and handle_edit_mouse_button_release().

◆ editor_mouse_move()

void editor_mouse_move ( int  canvas_x,
int  canvas_y,
int  modifiers 
)

Handle the mouse moving over the map canvas.

Definition at line 866 of file editor.c.

Referenced by handle_edit_mouse_move(), and handle_edit_mouse_move().

◆ editor_notify_edit_finished()

void editor_notify_edit_finished ( void  )

Notify the server that a batch of edits has completed. This is used as a hint for the server to now do any checks it has saved while the batch was being processed.

Definition at line 897 of file editor.c.

Referenced by editor_apply_tool_to_selection(), editor_mouse_button_press(), and editor_mouse_move().

◆ editor_resize_selection_rectangle()

static void editor_resize_selection_rectangle ( int  canvas_x,
int  canvas_y 
)
static

Handle a change in the size of the selection rectangle. The given point is the new extremity of the rectangle.

Definition at line 826 of file editor.c.

Referenced by editor_mouse_move().

◆ editor_ruleset_changed()

void editor_ruleset_changed ( void  )

Adjust editor for changed ruleset.

Definition at line 180 of file editor.c.

Referenced by handle_rulesets_ready().

◆ editor_selection_add()

void editor_selection_add ( const struct tile ptile)

Add the given tile to the current selection.

Definition at line 1095 of file editor.c.

Referenced by editor_end_selection_rectangle().

◆ editor_selection_clear()

void editor_selection_clear ( void  )

Unselect all selected tiles.

Definition at line 1084 of file editor.c.

Referenced by editor_start_selection_rectangle().

◆ editor_selection_count()

int editor_selection_count ( void  )

Returns the number of currently selected tiles.

Definition at line 1388 of file editor.c.

Referenced by editor_apply_tool_to_selection(), and editor_start_selection_rectangle().

◆ editor_selection_remove()

void editor_selection_remove ( const struct tile ptile)

Remove the given tile from the current selection.

Definition at line 1106 of file editor.c.

Referenced by editor_end_selection_rectangle().

◆ editor_set_current_tile()

void editor_set_current_tile ( const struct tile ptile)

Sets the tile currently assumed to be under the user's mouse pointer.

Definition at line 1016 of file editor.c.

Referenced by editor_mouse_button_press(), editor_mouse_button_release(), and editor_mouse_move().

◆ editor_set_tool()

void editor_set_tool ( enum editor_tool_type  ett)

Set the current tool to be used by the editor.

Definition at line 270 of file editor.c.

Referenced by editor_grab_tool(), handle_edit_key_press_with_shift(), handle_edit_key_press_with_shift(), and try_to_set_editor_tool().

◆ editor_start_selection_rectangle()

static void editor_start_selection_rectangle ( int  canvas_x,
int  canvas_y 
)
static

Record the start of the selection rectangle.

Definition at line 422 of file editor.c.

Referenced by editor_mouse_button_press().

◆ editor_tile_is_selected()

bool editor_tile_is_selected ( const struct tile ptile)

Returns TRUE if the given tile is selected.

Definition at line 1117 of file editor.c.

Referenced by fill_sprite_array(), popup_properties(), and put_one_tile().

◆ editor_tool_cycle_mode()

void editor_tool_cycle_mode ( enum editor_tool_type  ett)

Set the editor tool mode to the next available mode.

Definition at line 1058 of file editor.c.

Referenced by editinfobox_handle_mode_image_button_press(), and editinfobox_handle_mode_image_button_press().

◆ editor_tool_get_applied_player()

int editor_tool_get_applied_player ( enum editor_tool_type  ett)

Returns the current applied player number for the editor tool.

May return a player number for which player_by_number returns NULL.

Definition at line 1341 of file editor.c.

Referenced by editor_apply_tool(), editor_unit_virtual_create(), property_page_create_objects(), and refresh_tool_applied_player_combo().

◆ editor_tool_get_count()

int editor_tool_get_count ( enum editor_tool_type  ett)

Returns the 'count' parameter for the editor tool.

Definition at line 1252 of file editor.c.

Referenced by editinfobox_refresh(), editor_apply_tool(), handle_edit_key_press(), handle_edit_key_press(), and property_page_create_objects().

◆ editor_tool_get_mode()

enum editor_tool_mode editor_tool_get_mode ( enum editor_tool_type  ett)

◆ editor_tool_get_mode_name()

const char * editor_tool_get_mode_name ( enum editor_tool_type  ett,
enum editor_tool_mode  etm 
)

Returns the translated string name for the given mode.

Definition at line 1778 of file editor.c.

Referenced by editinfobox_refresh().

◆ editor_tool_get_name()

const char * editor_tool_get_name ( enum editor_tool_type  ett)

Get the translated name of the given tool type.

Definition at line 1159 of file editor.c.

Referenced by create_tool_value_selector(), editinfobox_refresh(), and try_to_set_editor_tool().

◆ editor_tool_get_size()

int editor_tool_get_size ( enum editor_tool_type  ett)

Returns the current size parameter for the given editor tools.

Definition at line 1218 of file editor.c.

Referenced by editinfobox_refresh(), editor_apply_tool(), handle_edit_key_press(), handle_edit_key_press(), and property_page_create_objects().

◆ editor_tool_get_sprite()

struct sprite * editor_tool_get_sprite ( enum editor_tool_type  ett)

Returns a sprite containing an icon for the given tool type. Returns NULL if no such sprite exists.

Definition at line 1275 of file editor.c.

Referenced by editbar_add_tool_button(), and editinfobox_refresh().

◆ editor_tool_get_tooltip()

const char * editor_tool_get_tooltip ( enum editor_tool_type  ett)

Returns a translated "tooltip" description for the given tool type.

Definition at line 1327 of file editor.c.

Referenced by editbar_add_tool_button().

◆ editor_tool_get_value()

int editor_tool_get_value ( enum editor_tool_type  ett)

◆ editor_tool_get_value_name()

const char * editor_tool_get_value_name ( enum editor_tool_type  emt,
int  value 
)

Get the translated name of the given tool value. If no such name exists, returns an empty string.

Definition at line 1172 of file editor.c.

Referenced by editinfobox_refresh().

◆ editor_tool_has_applied_player()

bool editor_tool_has_applied_player ( enum editor_tool_type  ett)

Returns TRUE if the given tool makes use of the editor's applied player number.

Definition at line 1365 of file editor.c.

Referenced by editor_apply_tool(), and refresh_tool_applied_player_combo().

◆ editor_tool_has_count()

bool editor_tool_has_count ( enum editor_tool_type  ett)

Return TRUE if it is meaningful for the given tool to use the 'count' parameter.

Definition at line 1241 of file editor.c.

Referenced by editinfobox_refresh(), handle_edit_key_press(), and handle_edit_key_press().

◆ editor_tool_has_mode()

bool editor_tool_has_mode ( enum editor_tool_type  ett,
enum editor_tool_mode  etm 
)

Return TRUE if the given tool supports the given mode.

Definition at line 313 of file editor.c.

Referenced by editor_tool_cycle_mode(), editor_tool_set_mode(), editor_tool_toggle_mode(), and refresh_all_buttons().

◆ editor_tool_has_size()

bool editor_tool_has_size ( enum editor_tool_type  ett)

Return TRUE if the given editor tool uses the 'size' parameter.

Definition at line 1207 of file editor.c.

Referenced by editinfobox_refresh(), handle_edit_key_press(), and handle_edit_key_press().

◆ editor_tool_has_value()

bool editor_tool_has_value ( enum editor_tool_type  ett)

Returns TRUE if the given tool type has sub-values (e.g. the terrain tool has values corresponding to the terrain types).

Definition at line 385 of file editor.c.

Referenced by editbar_add_tool_button(), editgui_run_tool_selection(), editor_grab_tool(), editor_tool_get_value(), editor_tool_set_value(), refresh_all_tool_value_selectors(), and refresh_tool_value_selector().

◆ editor_tool_has_value_erase()

bool editor_tool_has_value_erase ( enum editor_tool_type  ett)

Returns TRUE if erase mode for the given tool erases by sub-value instead of any object corresponding to the tool type.

Definition at line 1377 of file editor.c.

Referenced by editor_tool_get_mode_name().

◆ editor_tool_is_usable()

bool editor_tool_is_usable ( enum editor_tool_type  ett)

Returns TRUE if the given tool should be made available to the user via the editor GUI. For example, this will return FALSE for ETT_MILITARY_BASE if there are no bases defined in the ruleset.

NB: This depends on the ruleset information received from the server, so it will return FALSE if the client does not have it yet.

Definition at line 359 of file editor.c.

Referenced by try_to_set_editor_tool().

◆ editor_tool_set_applied_player()

void editor_tool_set_applied_player ( enum editor_tool_type  ett,
int  player_no 
)

Sets the editor tool's applied player number to the given value.

Definition at line 1352 of file editor.c.

Referenced by editinfobox_tool_applied_player_changed(), editor_grab_applied_player(), and refresh_tool_applied_player_combo().

◆ editor_tool_set_count()

void editor_tool_set_count ( enum editor_tool_type  ett,
int  count 
)

Sets the 'count' parameter of the tool to the given value.

Definition at line 1263 of file editor.c.

Referenced by editinfobox_spin_button_value_changed(), handle_edit_key_press(), and handle_edit_key_press().

◆ editor_tool_set_mode()

void editor_tool_set_mode ( enum editor_tool_type  ett,
enum editor_tool_mode  etm 
)

Set the mode for the editor tool.

Definition at line 298 of file editor.c.

Referenced by editbar_mode_button_toggled(), editor_tool_cycle_mode(), and editor_tool_toggle_mode().

◆ editor_tool_set_size()

void editor_tool_set_size ( enum editor_tool_type  ett,
int  size 
)

Sets the size parameter for the given tool.

Definition at line 1229 of file editor.c.

Referenced by editinfobox_spin_button_value_changed(), handle_edit_key_press(), and handle_edit_key_press().

◆ editor_tool_set_value()

void editor_tool_set_value ( enum editor_tool_type  ett,
int  value 
)

Set the value ID for the given tool. How the value is interpreted depends on the tool type.

Definition at line 397 of file editor.c.

Referenced by editgui_run_tool_selection(), and editor_grab_tool().

◆ editor_tool_toggle_mode()

void editor_tool_toggle_mode ( enum editor_tool_type  ett,
enum editor_tool_mode  etm 
)

Toggle the current tool mode between the given mode and ETM_PAINT (or ETM_COPY for the copy & paste tool).

Definition at line 1041 of file editor.c.

Referenced by handle_edit_key_press_with_shift(), and handle_edit_key_press_with_shift().

◆ editor_unit_virtual_create()

struct unit * editor_unit_virtual_create ( void  )

Creates a virtual unit (like unit_virtual_create) based on the current editor state. You should free() the unit when it is no longer needed. If creation is not possible, then NULL is returned.

The virtual unit has no homecity or tile. It is owned by the player corresponding to the current 'applied player' parameter and has unit type given by the sub-value of the unit tool (ETT_UNIT).

Definition at line 1405 of file editor.c.

Referenced by can_create_unit_at_tile().

◆ fill_tile_edit_packet()

static void fill_tile_edit_packet ( struct packet_edit_tile packet,
const struct tile ptile 
)
static

Helper function to fill in an edit packet with the tile's current values.

Definition at line 1607 of file editor.c.

Referenced by paste_tile().

◆ paste_tile()

static void paste_tile ( struct edit_buffer ebuf,
const struct tile vtile,
const struct tile ptile_dest 
)
static

Helper function for edit_buffer_paste(). Do a single paste of the stuff set in the buffer on the virtual tile to the destination tile 'ptile_dest'.

Definition at line 1645 of file editor.c.

Referenced by edit_buffer_paste().

◆ popup_properties()

static void popup_properties ( struct tile ptile)
static

Handle a request to edit the properties for the given tile. If the tile is part of a selection, then all selected tiles are passed to the property editor.

Definition at line 631 of file editor.c.

Referenced by editor_mouse_button_press().

◆ tile_really_has_any_specials()

static bool tile_really_has_any_specials ( const struct tile ptile)
inlinestatic

Temporary convenience function to work-around the fact that certain special values (S_RESOURCE_VALID) do not in fact correspond to drawable special types.

Definition at line 446 of file editor.c.

Referenced by editor_grab_tool().

◆ tool_init()

static void tool_init ( enum editor_tool_type  ett,
const char name,
int  flags,
const char tooltip 
)
static

Initialize editor tool data.

Definition at line 151 of file editor.c.

Referenced by editor_init().

◆ tool_set_init_value()

static void tool_set_init_value ( enum editor_tool_type  ett)
static

Set tool to some value legal under current ruleset.

Definition at line 105 of file editor.c.

Referenced by editor_ruleset_changed(), and tool_init().

Variable Documentation

◆ editor

struct editor_state* editor = NULL
static

Definition at line 100 of file editor.c.

Referenced by add_global_worklist(), add_target_to_production(), add_target_to_worklist(), change_production(), create_and_append_worklist_page(), create_worklist(), editor_apply_tool(), editor_apply_tool_to_selection(), editor_clear(), editor_draw_selrect(), editor_end_selection_rectangle(), editor_free(), editor_get_copy_buffer(), editor_get_current_tile(), editor_get_selection_center(), editor_get_tool(), editor_grab_applied_player(), editor_grab_tool(), editor_init(), editor_mouse_button_press(), editor_mouse_button_release(), editor_mouse_move(), editor_resize_selection_rectangle(), editor_selection_add(), editor_selection_clear(), editor_selection_count(), editor_selection_remove(), editor_set_current_tile(), editor_set_tool(), editor_start_selection_rectangle(), editor_tile_is_selected(), editor_tool_get_applied_player(), editor_tool_get_count(), editor_tool_get_mode(), editor_tool_get_name(), editor_tool_get_size(), editor_tool_get_tooltip(), editor_tool_get_value(), editor_tool_get_value_name(), editor_tool_has_applied_player(), editor_tool_has_count(), editor_tool_has_mode(), editor_tool_has_size(), editor_tool_has_value(), editor_tool_has_value_erase(), editor_tool_is_usable(), editor_tool_set_applied_player(), editor_tool_set_count(), editor_tool_set_mode(), editor_tool_set_size(), editor_tool_set_value(), insert_worklist(), ok_worklist_editor_callback(), popdown_worklist_editor(), popup_properties(), popup_worklist(), popup_worklist_editor(), refresh_production_label(), refresh_worklist(), refresh_worklist_count_label(), remove_item_from_worklist(), rename_worklist_editor_callback(), reset_city_worklist(), reset_global_worklist(), set_global_worklist(), swap_item_down_from_worklist(), swap_item_up_from_worklist(), tool_init(), tool_set_init_value(), and worklist_editor_targets_callback().