Freeciv-3.3: /fast/freeciv/nightly/main/client/editor.h File Reference

Freeciv-3.3

Loading...
Searching...
No Matches
Macros | Enumerations | Functions
editor.h File Reference
`#include "fc_types.h"`

Go to the source code of this file.

## Macros

#define | edit_buffer_type_iterate(ARG_ebuf, NAME_type)
#define | edit_buffer_type_iterate_end

## Enumerations

enum | editor_object_type { OBJTYPE_TILE = 0 , OBJTYPE_STARTPOS , OBJTYPE_UNIT , OBJTYPE_CITY , OBJTYPE_PLAYER , OBJTYPE_GAME , NUM_OBJTYPES }
enum | editor_tool_type { ETT_TERRAIN = 0 , ETT_TERRAIN_RESOURCE , ETT_TERRAIN_SPECIAL , ETT_ROAD , ETT_MILITARY_BASE , ETT_UNIT , ETT_CITY , ETT_VISION , ETT_TERRITORY , ETT_STARTPOS , ETT_COPYPASTE , NUM_EDITOR_TOOL_TYPES }
enum | editor_tool_mode { ETM_PAINT = 0 , ETM_ERASE , ETM_COPY , ETM_PASTE , NUM_EDITOR_TOOL_MODES }
enum | editor_keyboard_modifiers { EKM_NONE = 0 , EKM_SHIFT = 1<<0 , EKM_ALT = 1<<1 , EKM_CTRL = 1<<2 }
enum | mouse_button_values { MOUSE_BUTTON_OTHER = 0 , MOUSE_BUTTON_LEFT = 1 , MOUSE_BUTTON_MIDDLE = 2 , MOUSE_BUTTON_RIGHT = 3 }
enum | edit_buffer_types { EBT_TERRAIN = 1<<0 , EBT_RESOURCE = 1<<1 , EBT_SPECIAL = 1<<2 , EBT_BASE = 1<<3 , EBT_ROAD = 1<<4 , EBT_UNIT = 1<<5 , EBT_CITY = 1<<6 , EBT_ALL = (1<<7) - 1 }

## Functions

void | editor_init (void)
void | editor_clear (void)
void | editor_free (void)
void | editor_ruleset_changed (void)
bool | editor_is_active (void)
enum editor_tool_type | editor_get_tool (void)
void | editor_set_tool (enum editor_tool_type emt)
const struct tile * | editor_get_current_tile (void)
void | editor_set_current_tile (const struct tile *ptile)
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)
void | editor_tool_set_mode (enum editor_tool_type ett, enum editor_tool_mode etm)
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)
const char * | editor_tool_get_mode_name (enum editor_tool_type ett, enum editor_tool_mode etm)
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)
bool | editor_tool_has_applied_player (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, int player_no)
bool | editor_tool_is_usable (enum editor_tool_type ett)
bool | editor_tool_has_value (enum editor_tool_type ett)
bool | editor_tool_has_value_erase (enum editor_tool_type ett)
int | editor_tool_get_value (enum editor_tool_type ett)
void | editor_tool_set_value (enum editor_tool_type ett, int value)
const char * | editor_tool_get_value_name (enum editor_tool_type ett, int value)
const char * | editor_tool_get_name (enum editor_tool_type ett)
struct sprite * | editor_tool_get_sprite (enum editor_tool_type ett)
const char * | editor_tool_get_tooltip (enum editor_tool_type ett)
const char * | editor_get_mode_tooltip (enum editor_tool_mode etm)
struct sprite * | editor_get_mode_sprite (enum editor_tool_mode etm)
struct edit_buffer * | editor_get_copy_buffer (void)
void | editor_mouse_button_press (int canvas_x, int canvas_y, int button, int modifiers)
void | editor_mouse_button_release (int canvas_x, int canvas_y, int button, int modifiers)
void | editor_mouse_move (int canvas_x, int canvas_y, int modifiers)
void | editor_apply_tool (const struct tile *ptile, bool part_of_selection)
void | editor_notify_edit_finished (void)
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)
int | editor_selection_count (void)
const struct tile * | editor_get_selection_center (void)
struct unit * | editor_unit_virtual_create (void)
struct edit_buffer * | edit_buffer_new (int type_flags)
void | edit_buffer_free (struct edit_buffer *ebuf)
void | edit_buffer_clear (struct edit_buffer *ebuf)
void | edit_buffer_set_origin (struct edit_buffer *ebuf, const struct tile *ptile)
const struct tile * | edit_buffer_get_origin (const struct edit_buffer *ebuf)
bool | edit_buffer_has_type (const struct edit_buffer *ebuf, int type)
void | edit_buffer_copy (struct edit_buffer *ebuf, const struct tile *ptile)
void | edit_buffer_copy_square (struct edit_buffer *ebuf, const struct tile *center, int radius)
void | edit_buffer_paste (struct edit_buffer *ebuf, const struct tile *dest)
int | edit_buffer_get_status_string (const struct edit_buffer *ebuf, char *buf, int buflen)

## Macro Definition Documentation

## ◆ edit_buffer_type_iterate

#define edit_buffer_type_iterate | ( |  | ARG_ebuf,
|  |  | NAME_type
| ) |  |

Value:
do {\
int NAME_type;\
if (!(ARG_ebuf)) {\
break;\
}\
for (NAME_type = 1; NAME_type < EBT_ALL; NAME_type <<= 1) {\
if (!(edit_buffer_has_type((ARG_ebuf), NAME_type))) {\
continue;\
}
incite_cost
char * incite_cost
Definition comments.c:74
edit_buffer_has_type
bool edit_buffer_has_type(const struct edit_buffer *ebuf, int type)
Definition editor.c:1921
EBT_ALL
@ EBT_ALL
Definition editor.h:165

Definition at line 184 of file editor.h.

## ◆ edit_buffer_type_iterate_end

#define edit_buffer_type_iterate_end

Value:
}\
} while (FALSE)
FALSE
#define FALSE
Definition support.h:47

Definition at line 195 of file editor.h.

## Enumeration Type Documentation

## ◆ edit_buffer_types

enum edit_buffer_types

Enumerator
EBT_TERRAIN |
EBT_RESOURCE |
EBT_SPECIAL |
EBT_BASE |
EBT_ROAD |
EBT_UNIT |
EBT_CITY |
EBT_ALL |

Definition at line 155 of file editor.h.

## ◆ editor_keyboard_modifiers

enum editor_keyboard_modifiers

Enumerator
EKM_NONE |
EKM_SHIFT |
EKM_ALT |
EKM_CTRL |

Definition at line 116 of file editor.h.

## ◆ editor_object_type

enum editor_object_type

Enumerator
OBJTYPE_TILE |
OBJTYPE_STARTPOS |
OBJTYPE_UNIT |
OBJTYPE_CITY |
OBJTYPE_PLAYER |
OBJTYPE_GAME |
NUM_OBJTYPES |

Definition at line 25 of file editor.h.

## ◆ editor_tool_mode

enum editor_tool_mode

Enumerator
ETM_PAINT |
ETM_ERASE |
ETM_COPY |
ETM_PASTE |
NUM_EDITOR_TOOL_MODES |

Definition at line 52 of file editor.h.

## ◆ editor_tool_type

enum editor_tool_type

Enumerator
ETT_TERRAIN |
ETT_TERRAIN_RESOURCE |
ETT_TERRAIN_SPECIAL |
ETT_ROAD |
ETT_MILITARY_BASE |
ETT_UNIT |
ETT_CITY |
ETT_VISION |
ETT_TERRITORY |
ETT_STARTPOS |
ETT_COPYPASTE |
NUM_EDITOR_TOOL_TYPES |

Definition at line 36 of file editor.h.

## ◆ mouse_button_values

enum mouse_button_values

Enumerator
MOUSE_BUTTON_OTHER |
MOUSE_BUTTON_LEFT |
MOUSE_BUTTON_MIDDLE |
MOUSE_BUTTON_RIGHT |

Definition at line 123 of file editor.h.

## Function Documentation

## ◆ 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_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 |  | ) |

Get the current tool used by the editor.

Definition at line 286 of file editor.c.

Referenced by editbar_mode_button_toggled(), editinfobox_handle_mode_image_button_press(), editinfobox_handle_mode_image_button_press(), editinfobox_handle_tool_image_button_press(), editinfobox_handle_tool_image_button_press(), editinfobox_refresh(), editinfobox_spin_button_value_changed(), editinfobox_tool_applied_player_changed(), editor_apply_tool(), editor_apply_tool_to_selection(), editor_grab_applied_player(), handle_edit_key_press(), handle_edit_key_press(), handle_edit_key_press_with_shift(), handle_edit_key_press_with_shift(), refresh_all_buttons(), and refresh_tool_applied_player_combo().

## ◆ 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 |  | ) |

Returns TRUE if the client is in edit mode.

Definition at line 346 of file editor.c.

Referenced by butt_down_mapcanvas(), butt_release_mapcanvas(), editbar_refresh(), editgui_notify_object_changed(), editgui_notify_object_created(), editgui_refresh(), editinfobox_refresh(), fill_sprite_array(), handle_research_info(), handle_unknown_research(), left_butt_down_mapcanvas(), left_butt_up_mapcanvas(), middle_butt_down_mapcanvas(), move_mapcanvas(), move_mapcanvas(), put_one_tile(), real_menus_update(), refresh_tool_value_selector(), right_butt_down_mapcanvas(), right_butt_up_mapcanvas(), toplevel_key_press_handler(), toplevel_key_press_handler(), and toplevel_key_release_handler().

## ◆ 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_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_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 | ) |

Get the mode for the tool.

Definition at line 335 of file editor.c.

Referenced by editinfobox_refresh(), editor_apply_tool(), editor_apply_tool_to_selection(), editor_tool_cycle_mode(), editor_tool_toggle_mode(), and refresh_all_buttons().

## ◆ 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 | ) |

Get the current tool sub-value.

Definition at line 409 of file editor.c.

Referenced by editinfobox_refresh(), editor_apply_tool(), editor_unit_virtual_create(), property_page_create_objects(), and refresh_tool_value_selector().

## ◆ 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().