Freeciv21
Develop your civilization from humble roots to a global empire
goto.h
Go to the documentation of this file.
1 /**************************************************************************
2  Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3  __ __ part of Freeciv21. Freeciv21 is free software: you can
4 / \\..// \ redistribute it and/or modify it under the terms of the GNU
5  ( oo ) General Public License as published by the Free Software
6  \__/ Foundation, either version 3 of the License, or (at your
7  option) any later version. You should have received
8  a copy of the GNU General Public License along with Freeciv21. If not,
9  see https://www.gnu.org/licenses/.
10 **************************************************************************/
11 #pragma once
12 
13 #include "fc_types.h"
14 
15 class PFPath;
16 struct tile;
17 struct unit;
18 struct unit_list;
19 struct unit_order;
20 
25 
28 };
29 
30 void init_client_goto();
31 void free_client_goto();
32 
33 void enter_goto_state(const std::vector<unit *> &units);
34 void exit_goto_state();
35 
36 void goto_unit_killed(struct unit *punit);
37 
38 bool goto_is_active();
39 bool goto_tile_state(const struct tile *ptile, enum goto_tile_state *state,
40  int *turns, bool *waypoint);
41 void goto_add_waypoint();
42 bool goto_pop_waypoint();
43 
44 bool is_valid_goto_destination(const struct tile *ptile);
45 bool is_valid_goto_draw_line(struct tile *dest_tile);
46 
47 void request_orders_cleared(struct unit *punit);
48 void send_rally_path(city *pcity, unit *punit, const PFPath &path,
49  unit_order *final_order);
50 bool send_goto_tile(struct unit *punit, struct tile *ptile);
51 bool send_rally_tile(struct city *pcity, struct tile *ptile);
52 bool send_attack_tile(struct unit *punit, struct tile *ptile);
53 void send_patrol_route();
54 void send_goto_route();
55 void send_connect_route(enum unit_activity activity, struct extra_type *tgt);
56 
57 struct tile *tile_before_end_path(struct unit *punit, struct tile *ptile);
58 
59 bool can_unit_move_now(const struct unit *punit);
bool goto_pop_waypoint()
Returns whether there were any waypoint popped (we don't remove the initial position)
Definition: goto.cpp:126
void send_patrol_route()
Send the current patrol route (i.e., the one generated via HOVER_STATE) to the server.
Definition: goto.cpp:718
void init_client_goto()
Called only by handle_map_info() in client/packhand.c.
Definition: goto.cpp:79
bool send_attack_tile(struct unit *punit, struct tile *ptile)
Send orders for the unit to move it to the arbitrary tile and attack everything it approaches.
Definition: goto.cpp:694
void enter_goto_state(const std::vector< unit * > &units)
Enter the goto state: activate, prepare PF-template and add the initial part.
Definition: goto.cpp:247
void send_rally_path(city *pcity, unit *punit, const PFPath &path, unit_order *final_order)
Send an arbitrary rally path for the city to the server.
Definition: goto.cpp:620
bool goto_is_active()
Is goto state active?
Definition: goto.cpp:302
void send_goto_route()
Send the current goto route (i.e., the one generated via HOVER_STATE) to the server.
Definition: goto.cpp:836
void goto_add_waypoint()
Inserts a waypoint at the end of the current goto line.
Definition: goto.cpp:104
bool is_valid_goto_draw_line(struct tile *dest_tile)
Puts a line to dest_tile on the map according to the current goto_map.
Definition: goto.cpp:383
goto_tile_state
Definition: goto.h:21
@ GTS_INVALID
Definition: goto.h:27
@ GTS_EXHAUSTED_MP
Definition: goto.h:24
@ GTS_MP_LEFT
Definition: goto.h:23
@ GTS_TURN_STEP
Definition: goto.h:22
@ GTS_COUNT
Definition: goto.h:26
struct tile * tile_before_end_path(struct unit *punit, struct tile *ptile)
Finds penultimate tile on path for given unit going to ptile.
Definition: goto.cpp:888
bool send_goto_tile(struct unit *punit, struct tile *ptile)
Send orders for the unit to move it to the arbitrary tile.
Definition: goto.cpp:630
bool send_rally_tile(struct city *pcity, struct tile *ptile)
Send rally orders for the city to move new units to the arbitrary tile.
Definition: goto.cpp:652
bool can_unit_move_now(const struct unit *punit)
Returns if unit can move now.
Definition: goto.cpp:56
void send_connect_route(enum unit_activity activity, struct extra_type *tgt)
Send the current connect route (i.e., the one generated via HOVER_STATE) to the server.
Definition: goto.cpp:724
void goto_unit_killed(struct unit *punit)
Called from control_unit_killed() in client/control.c.
Definition: goto.cpp:284
bool is_valid_goto_destination(const struct tile *ptile)
Determines if a goto to the destination tile is allowed.
Definition: goto.cpp:96
void exit_goto_state()
Tidy up and deactivate goto state.
Definition: goto.cpp:269
void request_orders_cleared(struct unit *punit)
Send a packet to the server to request that the current orders be cleared.
Definition: goto.cpp:442
void free_client_goto()
Called above, and by control_done() in client/control.c.
Definition: goto.cpp:87
Definition: city.h:291
Definition: tile.h:42
enum unit_activity activity
Definition: unit.h:81
Definition: unit.h:134