This internal whiteboard class holds the planned action queues for a team, and offers many utility methods to create and manipulate them. More...
#include <side_actions.hpp>
Classes | |
struct | numbers_t |
Public Types | |
typedef side_actions_container | container |
typedef container::iterator | iterator |
typedef container::const_iterator | const_iterator |
typedef container::reverse_iterator | reverse_iterator |
typedef container::const_reverse_iterator | const_reverse_iterator |
typedef std::pair< iterator, iterator > | range_t |
typedef std::pair< reverse_iterator, reverse_iterator > | rrange_t |
typedef std::pair< const_iterator, const_iterator > | crange_t |
typedef std::pair< const_reverse_iterator, const_reverse_iterator > | crrange_t |
typedef config | net_cmd |
Network code. More... | |
Public Member Functions | |
side_actions () | |
void | set_team_index (std::size_t team_index) |
Must be called only once, right after the team that owns this side_actions is added to the teams vector. More... | |
std::size_t | team_index () |
Returns the team index this action queue belongs to. More... | |
void | get_numbers (const map_location &hex, numbers_t &result) |
Gets called when display is drawing a hex to determine which numbers to draw on it. More... | |
bool | execute_next () |
Executes the first action in the queue, and then deletes it. More... | |
bool | execute (iterator position) |
Executes the specified action, if it exists in the queue. More... | |
bool | empty () const |
Indicates whether the action queue is empty. More... | |
std::size_t | size () const |
Returns the number of actions in the action queue. More... | |
std::size_t | num_turns () const |
Returns the number of turns that have plans. More... | |
std::size_t | turn_size (std::size_t turn_num) const |
Returns the number of actions planned for turn turn_num. More... | |
std::size_t | get_turn (const_iterator it) const |
Returns the turn of a given iterator planned execution. More... | |
void | clear () |
Empties the action queue. More... | |
void | hide () |
Sets whether or not the contents should be drawn on the screen. More... | |
void | show () |
bool | hidden () const |
iterator | insert_action (iterator position, action_ptr action) |
Inserts an action at the specified position. More... | |
iterator | queue_action (std::size_t turn_num, action_ptr action) |
Queues an action to be executed last. More... | |
iterator | bump_earlier (iterator position, bool send_to_net=true) |
Moves an action earlier in the execution order. More... | |
iterator | bump_later (iterator position, bool send_to_net=true) |
Moves an action later in the execution order. More... | |
iterator | remove_action (iterator position, bool validate_after_delete=true) |
Deletes the action at the specified position. More... | |
iterator | get_position_of (action_ptr action) |
iterator | begin () |
Returns the iterator for the first (executed earlier) action within the actions queue. More... | |
reverse_iterator | rbegin () |
reverse version of the above More... | |
const_iterator | begin () const |
const versions of the above More... | |
const_reverse_iterator | rbegin () const |
iterator | end () |
Returns the iterator for the position after the last executed action within the actions queue. More... | |
reverse_iterator | rend () |
reverse version of the above More... | |
const_iterator | end () const |
const versions of the above More... | |
const_reverse_iterator | rend () const |
iterator | turn_begin (std::size_t turn_num) |
iterator | turn_end (std::size_t turn_num) |
reverse_iterator | turn_rbegin (std::size_t turn_num) |
reverse_iterator | turn_rend (std::size_t turn_num) |
const_iterator | turn_begin (std::size_t turn_num) const |
const_iterator | turn_end (std::size_t turn_num) const |
const_reverse_iterator | turn_rbegin (std::size_t turn_num) const |
const_reverse_iterator | turn_rend (std::size_t turn_num) const |
range_t | iter_turn (std::size_t turn_num) |
Returns an iterator range corresponding to the requested turn. More... | |
rrange_t | riter_turn (std::size_t turn_num) |
crange_t | iter_turn (std::size_t turn_num) const |
crrange_t | riter_turn (std::size_t turn_num) const |
template<typename T , typename Compare > | |
iterator | find_first_action_of (std::pair< T, T > between, iterator limit, Compare comp) |
Find the (chronologically) first action between the iterators between.first and between.second but after or equals to limit with respect to the predicate comp. More... | |
template<typename T , typename Compare > | |
const_iterator | find_first_action_of (std::pair< T, T > between, const_iterator limit, Compare comp) const |
iterator | find_first_action_at (map_location hex) |
Find the first action occurring at a given hex. More... | |
iterator | find_first_action_of (const unit &unit, iterator start_position) |
Finds the first action that belongs to this unit, starting the search at the specified position. More... | |
iterator | find_first_action_of (size_t unit_id, iterator start_position) |
iterator | find_first_action_of (const unit &unit) |
Variant of this method that always start searching at the beginning of the queue. More... | |
iterator | find_first_action_of (size_t unit_id) |
iterator | find_last_action_of (const unit &unit, iterator start_position) |
Finds the last action that belongs to this unit, starting the search backwards from the specified position. More... | |
iterator | find_last_action_of (size_t unit_id, iterator start_position) |
const_iterator | find_last_action_of (const unit &unit, const_iterator start_position) const |
const variant of the previous function More... | |
const_iterator | find_last_action_of (size_t unit_id, iterator start_position) const |
iterator | find_last_action_of (const unit &unit) |
Variant of the previous method that always start searching at the end of the queue. More... | |
iterator | find_last_action_of (size_t unit_id) |
const_iterator | find_last_action_of (const unit &unit) const |
const variant of the previous function More... | |
const_iterator | find_last_action_of (size_t unit_id) const |
bool | unit_has_actions (const unit &unit) |
std::size_t | count_actions_of (const unit &unit) |
std::deque< action_ptr > | actions_of (const unit &unit) |
std::size_t | get_turn_num_of (const unit &) const |
Determines the appropriate turn number for the next action planned for this unit. More... | |
int | get_gold_spent () const |
Used to track gold spending by recruits/recalls when building the future unit map. More... | |
void | change_gold_spent_by (int difference) |
Used to track gold spending by recruits/recalls when building the future unit map. More... | |
void | reset_gold_spent () |
Set gold spent back to zero. More... | |
void | update_recruited_unit (std::size_t old_id, unit &new_unit) |
After a recruit action was executed the id of the unit was changed so we need to update the unitid of all following actions on that unit. More... | |
void | raw_turn_shift () |
void | synced_turn_shift () |
iterator | queue_move (std::size_t turn_num, unit &mover, const pathfind::marked_route &route, arrow_ptr arrow, fake_unit_ptr fake_unit) |
Queues a move to be executed last. More... | |
iterator | queue_attack (std::size_t turn_num, unit &mover, const map_location &target_hex, int weapon_choice, const pathfind::marked_route &route, arrow_ptr arrow, fake_unit_ptr fake_unit) |
Queues an attack or attack-move to be executed last. More... | |
iterator | queue_recruit (std::size_t turn_num, const std::string &unit_name, const map_location &recruit_hex) |
Queues a recruit to be executed last. More... | |
iterator | queue_recall (std::size_t turn_num, const unit &unit, const map_location &recall_hex) |
Queues a recall to be executed last. More... | |
iterator | queue_suppose_dead (std::size_t turn_num, unit &curr_unit, const map_location &loc) |
Queues a suppose_dead to be executed last. More... | |
void | execute_net_cmd (const net_cmd &) |
net_cmd | make_net_cmd_insert (std::size_t turn_num, std::size_t pos, action_const_ptr) const |
net_cmd | make_net_cmd_insert (const const_iterator &pos, action_const_ptr) const |
net_cmd | make_net_cmd_replace (const const_iterator &pos, action_const_ptr) const |
net_cmd | make_net_cmd_remove (const const_iterator &pos) const |
net_cmd | make_net_cmd_bump_later (const const_iterator &pos) const |
net_cmd | make_net_cmd_clear () const |
net_cmd | make_net_cmd_refresh () const |
Private Member Functions | |
iterator | safe_insert (std::size_t turn_num, std::size_t pos, action_ptr to_insert) |
iterator | synced_erase (iterator itor) |
iterator | synced_insert (iterator itor, action_ptr to_insert) |
iterator | synced_enqueue (std::size_t turn_num, action_ptr to_insert) |
iterator | safe_erase (const iterator &itor) |
Private Attributes | |
container | actions_ |
std::size_t | team_index_ |
bool | team_index_defined_ |
int | gold_spent_ |
Used to store gold "spent" in planned recruits/recalls when the future unit map is applied. More... | |
bool | hidden_ |
This internal whiteboard class holds the planned action queues for a team, and offers many utility methods to create and manipulate them.
It also provides an interface to the underlying side_actions_container.
Definition at line 282 of file side_actions.hpp.
Definition at line 288 of file side_actions.hpp.
Definition at line 290 of file side_actions.hpp.
Definition at line 285 of file side_actions.hpp.
typedef std::pair<const_iterator,const_iterator> wb::side_actions::crange_t |
Definition at line 294 of file side_actions.hpp.
typedef std::pair<const_reverse_iterator,const_reverse_iterator> wb::side_actions::crrange_t |
Definition at line 295 of file side_actions.hpp.
Definition at line 287 of file side_actions.hpp.
typedef config wb::side_actions::net_cmd |
Network code.
A net_cmd object (a config in disguise) represents a modification to a side_actions object. execute_net_cmd() translates one of these into a real modification of *this. The make_net_cmd_***() family of functions is convenient for building specific types of net_cmds.
Definition at line 554 of file side_actions.hpp.
typedef std::pair<iterator,iterator> wb::side_actions::range_t |
Definition at line 292 of file side_actions.hpp.
Definition at line 289 of file side_actions.hpp.
typedef std::pair<reverse_iterator,reverse_iterator> wb::side_actions::rrange_t |
Definition at line 293 of file side_actions.hpp.
wb::side_actions::side_actions | ( | ) |
Definition at line 265 of file side_actions.cpp.
std::deque< action_ptr > wb::side_actions::actions_of | ( | const unit & | unit | ) |
Definition at line 664 of file side_actions.cpp.
References actions_, wb::side_actions_container::get(), and unit::underlying_id().
|
inline |
Returns the iterator for the first (executed earlier) action within the actions queue.
Definition at line 406 of file side_actions.hpp.
References actions_, and wb::side_actions_container::begin().
Referenced by execute_next(), find_first_action_at(), find_first_action_of(), find_last_action_of(), get_numbers(), get_position_of(), wb::highlighter::last_action_redraw(), make_net_cmd_insert(), make_net_cmd_refresh(), raw_turn_shift(), and update_recruited_unit().
|
inline |
const versions of the above
Definition at line 410 of file side_actions.hpp.
References actions_, and wb::side_actions_container::begin().
side_actions::iterator wb::side_actions::bump_earlier | ( | side_actions::iterator | position, |
bool | send_to_net = true |
||
) |
Moves an action earlier in the execution order.
i.e. at the front of the queue by one position.
Definition at line 493 of file side_actions.cpp.
References actions_, wb::side_actions_container::bump_earlier(), end(), ERR_WB, get_turn(), LOG_WB, make_net_cmd_bump_later(), wb::side_actions_container::position_in_turn(), team_index_, turn_size(), and resources::whiteboard.
Referenced by bump_later().
side_actions::iterator wb::side_actions::bump_later | ( | iterator | position, |
bool | send_to_net = true |
||
) |
Moves an action later in the execution order.
i.e. at the back of the queue by one position.
Definition at line 544 of file side_actions.cpp.
References bump_earlier(), and end().
Referenced by execute_net_cmd().
void wb::side_actions::change_gold_spent_by | ( | int | difference | ) |
Used to track gold spending by recruits/recalls when building the future unit map.
Definition at line 682 of file side_actions.cpp.
References DBG_WB, gold_spent_, and team_index().
|
inline |
Empties the action queue.
Definition at line 358 of file side_actions.hpp.
References actions_, and wb::side_actions_container::clear().
Referenced by execute_net_cmd(), and wb::manager::on_change_controller().
std::size_t wb::side_actions::count_actions_of | ( | const unit & | unit | ) |
Definition at line 659 of file side_actions.cpp.
References actions_, wb::side_actions_container::get(), and unit::underlying_id().
|
inline |
Indicates whether the action queue is empty.
Definition at line 327 of file side_actions.hpp.
References actions_, and wb::side_actions_container::empty().
Referenced by execute_next(), get_numbers(), and wb::operator<<().
|
inline |
Returns the iterator for the position after the last executed action within the actions queue.
Definition at line 416 of file side_actions.hpp.
References actions_, and wb::side_actions_container::end().
Referenced by bump_earlier(), bump_later(), execute_net_cmd(), find_last_action_of(), get_numbers(), get_position_of(), get_turn_num_of(), wb::move::init(), wb::highlighter::last_action_redraw(), make_net_cmd_refresh(), wb::manager::post_delete_action(), raw_turn_shift(), remove_action(), synced_enqueue(), and update_recruited_unit().
|
inline |
const versions of the above
Definition at line 420 of file side_actions.hpp.
References actions_, and wb::side_actions_container::end().
bool wb::side_actions::execute | ( | side_actions::iterator | position | ) |
Executes the specified action, if it exists in the queue.
If the action is not finished, it's moved at the end of the queue.
Definition at line 325 of file side_actions.cpp.
References actions_, actions::undo_list::clear(), resources::controller, wb::side_actions_container::empty(), wb::side_actions_container::end(), ERR_WB, wb::action::execute(), LOG_WB, make_net_cmd_replace(), synced_erase(), team_index_, turn_end(), resources::undo_stack, wb::action::valid(), resources::whiteboard, and WRN_WB.
Referenced by execute_next().
void wb::side_actions::execute_net_cmd | ( | const net_cmd & | cmd | ) |
Definition at line 780 of file side_actions.cpp.
References actions_, bump_later(), config::child_range(), clear(), end(), ERR_WB, wb::action::from_config(), display::get_singleton(), get_turn(), hidden_, display::invalidate(), LOG_WB, config::mandatory_child(), wb::side_actions_container::replace(), safe_erase(), safe_insert(), turn_begin(), and resources::whiteboard.
bool wb::side_actions::execute_next | ( | ) |
Executes the first action in the queue, and then deletes it.
Definition at line 316 of file side_actions.cpp.
side_actions::iterator wb::side_actions::find_first_action_at | ( | map_location | hex | ) |
Find the first action occurring at a given hex.
end() | if no action occurs at the given location. |
Definition at line 589 of file side_actions.cpp.
References actions_, begin(), find_first_action_of(), and wb::side_actions_container::get().
Variant of this method that always start searching at the beginning of the queue.
Definition at line 472 of file side_actions.hpp.
References begin(), and find_first_action_of().
Referenced by find_first_action_of().
side_actions::iterator wb::side_actions::find_first_action_of | ( | const unit & | unit, |
side_actions::iterator | start_position | ||
) |
Finds the first action that belongs to this unit, starting the search at the specified position.
Definition at line 624 of file side_actions.cpp.
References actions_, find_first_action_of(), wb::side_actions_container::get(), and unit::underlying_id().
|
inline |
Definition at line 473 of file side_actions.hpp.
References begin(), and find_first_action_of().
Referenced by find_first_action_of().
side_actions::iterator wb::side_actions::find_first_action_of | ( | size_t | unit_id, |
iterator | start_position | ||
) |
Definition at line 594 of file side_actions.cpp.
References actions_, find_first_action_of(), and wb::side_actions_container::get().
side_actions::const_iterator wb::side_actions::find_first_action_of | ( | std::pair< T, T > | between, |
const_iterator | limit, | ||
Compare | comp | ||
) | const |
Definition at line 614 of file side_actions.hpp.
References actions_, wb::side_actions_container::end(), and wb::side_actions_container::project().
side_actions::iterator wb::side_actions::find_first_action_of | ( | std::pair< T, T > | between, |
iterator | limit, | ||
Compare | comp | ||
) |
Find the (chronologically) first action between the iterators between.first and between.second but after or equals to limit with respect to the predicate comp.
This function makes sense when T is a non-chronological iterator. If T is iterator and Compare is std::less<iterator>, this function returns limit if limit is in [between.first, between.second) or between.first if between.first>limit or end() otherwise.
between | the two iterators between which the action will be searched. |
limit | the lower bound to search from, that is the return value ‘it’ will verify !comp(limit, it). |
comp | the predicate to compare with. |
end() | if no such action exist. |
Definition at line 601 of file side_actions.hpp.
References actions_, wb::side_actions_container::end(), and wb::side_actions_container::project().
Referenced by find_first_action_at(), find_first_action_of(), and find_last_action_of().
side_actions::iterator wb::side_actions::find_last_action_of | ( | const unit & | unit | ) |
Variant of the previous method that always start searching at the end of the queue.
Definition at line 646 of file side_actions.cpp.
References begin(), end(), and find_last_action_of().
side_actions::const_iterator wb::side_actions::find_last_action_of | ( | const unit & | unit | ) | const |
const variant of the previous function
Definition at line 638 of file side_actions.cpp.
References begin(), end(), and find_last_action_of().
side_actions::const_iterator wb::side_actions::find_last_action_of | ( | const unit & | unit, |
side_actions::const_iterator | start_position | ||
) | const |
const variant of the previous function
Definition at line 629 of file side_actions.cpp.
References actions_, find_first_action_of(), wb::side_actions_container::get(), and unit::underlying_id().
side_actions::iterator wb::side_actions::find_last_action_of | ( | const unit & | unit, |
side_actions::iterator | start_position | ||
) |
Finds the last action that belongs to this unit, starting the search backwards from the specified position.
Definition at line 633 of file side_actions.cpp.
References actions_, find_first_action_of(), wb::side_actions_container::get(), and unit::underlying_id().
Referenced by find_last_action_of(), get_turn_num_of(), wb::move::init(), wb::highlighter::last_action_redraw(), and wb::manager::post_delete_action().
side_actions::iterator wb::side_actions::find_last_action_of | ( | size_t | unit_id | ) |
Definition at line 616 of file side_actions.cpp.
References begin(), end(), and find_last_action_of().
side_actions::const_iterator wb::side_actions::find_last_action_of | ( | size_t | unit_id | ) | const |
Definition at line 608 of file side_actions.cpp.
References begin(), end(), and find_last_action_of().
side_actions::iterator wb::side_actions::find_last_action_of | ( | size_t | unit_id, |
side_actions::iterator | start_position | ||
) |
Definition at line 603 of file side_actions.cpp.
References actions_, find_first_action_of(), and wb::side_actions_container::get().
side_actions::const_iterator wb::side_actions::find_last_action_of | ( | size_t | unit_id, |
iterator | start_position | ||
) | const |
Definition at line 599 of file side_actions.cpp.
References actions_, find_first_action_of(), and wb::side_actions_container::get().
|
inline |
Used to track gold spending by recruits/recalls when building the future unit map.
Definition at line 505 of file side_actions.hpp.
References gold_spent_.
void wb::side_actions::get_numbers | ( | const map_location & | hex, |
numbers_t & | result | ||
) |
Gets called when display is drawing a hex to determine which numbers to draw on it.
Definition at line 281 of file side_actions.cpp.
References begin(), empty(), end(), utf8::index(), wb::side_actions::numbers_t::main_number, wb::side_actions::numbers_t::numbers_to_draw, wb::side_actions::numbers_t::secondary_numbers, team_index(), wb::side_actions::numbers_t::team_numbers, and resources::whiteboard.
Referenced by wb::manager::draw_hex().
|
inline |
action | The action whose position you're looking for |
Definition at line 401 of file side_actions.hpp.
|
inline |
Returns the turn of a given iterator planned execution.
The value returned is the difference between the planned turn and the current turn.
0 | If the action is planned for the current turn. |
Definition at line 353 of file side_actions.hpp.
References actions_, and wb::side_actions_container::get_turn().
Referenced by bump_earlier(), execute_net_cmd(), get_turn_num_of(), insert_action(), make_net_cmd_bump_later(), make_net_cmd_insert(), make_net_cmd_refresh(), make_net_cmd_remove(), make_net_cmd_replace(), raw_turn_shift(), and remove_action().
std::size_t wb::side_actions::get_turn_num_of | ( | const unit & | u | ) | const |
Determines the appropriate turn number for the next action planned for this unit.
0 | if the unit doesn't have any planned action |
Definition at line 673 of file side_actions.cpp.
References end(), find_last_action_of(), and get_turn().
Referenced by wb::manager::save_recruit(), wb::manager::save_suppose_dead(), wb::manager::save_temp_attack(), and wb::manager::save_temp_move().
|
inline |
Definition at line 363 of file side_actions.hpp.
References hidden_.
Referenced by wb::manager::draw_hex().
void wb::side_actions::hide | ( | ) |
Sets whether or not the contents should be drawn on the screen.
Definition at line 390 of file side_actions.cpp.
References hidden_.
side_actions::iterator wb::side_actions::insert_action | ( | iterator | position, |
action_ptr | action | ||
) |
Inserts an action at the specified position.
The begin() and end() functions might prove useful here.
Definition at line 415 of file side_actions.cpp.
References actions_, ERR_WB, get_turn(), LOG_WB, wb::side_actions_container::position_in_turn(), synced_insert(), and resources::whiteboard.
|
inline |
Returns an iterator range corresponding to the requested turn.
Definition at line 433 of file side_actions.hpp.
References actions_, and wb::side_actions_container::iter_turn().
Referenced by raw_turn_shift().
|
inline |
Definition at line 435 of file side_actions.hpp.
References actions_, and wb::side_actions_container::iter_turn().
side_actions::net_cmd wb::side_actions::make_net_cmd_bump_later | ( | const const_iterator & | pos | ) | const |
Definition at line 915 of file side_actions.cpp.
References actions_, get_turn(), and wb::side_actions_container::position_in_turn().
Referenced by bump_earlier().
side_actions::net_cmd wb::side_actions::make_net_cmd_clear | ( | ) | const |
Definition at line 923 of file side_actions.cpp.
Referenced by wb::manager::on_change_controller().
side_actions::net_cmd wb::side_actions::make_net_cmd_insert | ( | const const_iterator & | pos, |
action_const_ptr | act | ||
) | const |
Definition at line 889 of file side_actions.cpp.
References actions_, begin(), get_turn(), make_net_cmd_insert(), and wb::side_actions_container::position_in_turn().
side_actions::net_cmd wb::side_actions::make_net_cmd_insert | ( | std::size_t | turn_num, |
std::size_t | pos, | ||
action_const_ptr | act | ||
) | const |
Definition at line 880 of file side_actions.cpp.
References config::add_child().
Referenced by make_net_cmd_insert(), make_net_cmd_refresh(), synced_enqueue(), and synced_insert().
side_actions::net_cmd wb::side_actions::make_net_cmd_refresh | ( | ) | const |
Definition at line 929 of file side_actions.cpp.
References actions_, config::add_child(), begin(), end(), get_turn(), make_net_cmd_insert(), and wb::side_actions_container::position_in_turn().
Referenced by synced_turn_shift().
side_actions::net_cmd wb::side_actions::make_net_cmd_remove | ( | const const_iterator & | pos | ) | const |
Definition at line 907 of file side_actions.cpp.
References actions_, get_turn(), and wb::side_actions_container::position_in_turn().
Referenced by synced_erase().
side_actions::net_cmd wb::side_actions::make_net_cmd_replace | ( | const const_iterator & | pos, |
action_const_ptr | act | ||
) | const |
Definition at line 898 of file side_actions.cpp.
References actions_, config::add_child(), get_turn(), and wb::side_actions_container::position_in_turn().
Referenced by execute().
|
inline |
Returns the number of turns that have plans.
If the container holds only one action on turn 1 (that is turn 0 is empty), this function will still returns 2. Indeed, turn 0 has an "empty" plan.
Definition at line 341 of file side_actions.hpp.
References actions_, and wb::side_actions_container::num_turns().
Referenced by wb::operator<<(), and wb::manager::save_recall().
side_actions::iterator wb::side_actions::queue_action | ( | std::size_t | turn_num, |
action_ptr | action | ||
) |
Queues an action to be executed last.
Definition at line 427 of file side_actions.cpp.
References ERR_WB, LOG_WB, synced_enqueue(), and resources::whiteboard.
Referenced by queue_attack(), queue_move(), queue_recall(), queue_recruit(), and queue_suppose_dead().
side_actions::iterator wb::side_actions::queue_attack | ( | std::size_t | turn_num, |
unit & | mover, | ||
const map_location & | target_hex, | ||
int | weapon_choice, | ||
const pathfind::marked_route & | route, | ||
arrow_ptr | arrow, | ||
fake_unit_ptr | fake_unit | ||
) |
Queues an attack or attack-move to be executed last.
Definition at line 756 of file side_actions.cpp.
References hidden_, queue_action(), and team_index().
Referenced by wb::manager::save_temp_attack().
side_actions::iterator wb::side_actions::queue_move | ( | std::size_t | turn_num, |
unit & | mover, | ||
const pathfind::marked_route & | route, | ||
arrow_ptr | arrow, | ||
fake_unit_ptr | fake_unit | ||
) |
Queues a move to be executed last.
Definition at line 750 of file side_actions.cpp.
References hidden_, queue_action(), and team_index().
Referenced by wb::manager::save_temp_move().
side_actions::iterator wb::side_actions::queue_recall | ( | std::size_t | turn_num, |
const unit & | unit, | ||
const map_location & | recall_hex | ||
) |
Queues a recall to be executed last.
Definition at line 768 of file side_actions.cpp.
References hidden_, queue_action(), and team_index().
Referenced by wb::manager::save_recall().
side_actions::iterator wb::side_actions::queue_recruit | ( | std::size_t | turn_num, |
const std::string & | unit_name, | ||
const map_location & | recruit_hex | ||
) |
Queues a recruit to be executed last.
Definition at line 762 of file side_actions.cpp.
References hidden_, queue_action(), team_index(), and unit_name().
Referenced by wb::manager::save_recruit().
side_actions::iterator wb::side_actions::queue_suppose_dead | ( | std::size_t | turn_num, |
unit & | curr_unit, | ||
const map_location & | loc | ||
) |
Queues a suppose_dead to be executed last.
Definition at line 774 of file side_actions.cpp.
References hidden_, queue_action(), and team_index().
Referenced by wb::manager::save_suppose_dead().
void wb::side_actions::raw_turn_shift | ( | ) |
Definition at line 941 of file side_actions.cpp.
References actions_, begin(), end(), wb::side_actions_container::erase(), get_turn(), iter_turn(), safe_insert(), turn_begin(), turn_end(), and wb::side_actions_container::turn_shift().
Referenced by synced_turn_shift().
|
inline |
reverse version of the above
Definition at line 408 of file side_actions.hpp.
References actions_, and wb::side_actions_container::rbegin().
|
inline |
Definition at line 411 of file side_actions.hpp.
References actions_, and wb::side_actions_container::rbegin().
side_actions::iterator wb::side_actions::remove_action | ( | side_actions::iterator | position, |
bool | validate_after_delete = true |
||
) |
Deletes the action at the specified position.
Definition at line 559 of file side_actions.cpp.
References actions_, end(), ERR_WB, resources::gameboard, get_turn(), LOG_WB, wb::side_actions_container::position_in_turn(), safe_erase(), synced_erase(), team_index_, and resources::whiteboard.
Referenced by wb::mapbuilder::process().
|
inline |
reverse version of the above
Definition at line 418 of file side_actions.hpp.
References actions_, and wb::side_actions_container::rend().
|
inline |
Definition at line 421 of file side_actions.hpp.
References actions_, and wb::side_actions_container::rend().
void wb::side_actions::reset_gold_spent | ( | ) |
Set gold spent back to zero.
Definition at line 689 of file side_actions.cpp.
References DBG_WB, gold_spent_, and team_index().
|
inline |
Definition at line 434 of file side_actions.hpp.
References actions_, and wb::side_actions_container::riter_turn().
|
inline |
Definition at line 436 of file side_actions.hpp.
References actions_, and wb::side_actions_container::riter_turn().
|
private |
Definition at line 742 of file side_actions.cpp.
References actions_, wb::side_actions_container::erase(), and resources::whiteboard.
Referenced by execute_net_cmd(), remove_action(), and synced_erase().
|
private |
Definition at line 708 of file side_actions.cpp.
References actions_, wb::side_actions_container::insert(), wb::side_actions_container::push_front(), and turn_begin().
Referenced by execute_net_cmd(), and raw_turn_shift().
void wb::side_actions::set_team_index | ( | std::size_t | team_index | ) |
Must be called only once, right after the team that owns this side_actions is added to the teams vector.
Definition at line 274 of file side_actions.cpp.
References team_index(), team_index_, and team_index_defined_.
void wb::side_actions::show | ( | ) |
Definition at line 402 of file side_actions.cpp.
References hidden_.
|
inline |
Returns the number of actions in the action queue.
Definition at line 332 of file side_actions.hpp.
References actions_, and wb::side_actions_container::size().
|
private |
Definition at line 730 of file side_actions.cpp.
References actions_, end(), make_net_cmd_insert(), wb::side_actions_container::queue(), team_index_, turn_size(), and resources::whiteboard.
Referenced by queue_action().
|
private |
Definition at line 718 of file side_actions.cpp.
References make_net_cmd_remove(), safe_erase(), team_index_, and resources::whiteboard.
Referenced by execute(), and remove_action().
|
private |
Definition at line 724 of file side_actions.cpp.
References actions_, wb::side_actions_container::insert(), make_net_cmd_insert(), team_index_, and resources::whiteboard.
Referenced by insert_action().
void wb::side_actions::synced_turn_shift | ( | ) |
Definition at line 975 of file side_actions.cpp.
References make_net_cmd_refresh(), raw_turn_shift(), team_index(), and resources::whiteboard.
|
inline |
Returns the team index this action queue belongs to.
Definition at line 304 of file side_actions.hpp.
References team_index_, and team_index_defined_.
Referenced by change_gold_spent_by(), get_numbers(), wb::manager::on_change_controller(), queue_attack(), queue_move(), queue_recall(), queue_recruit(), queue_suppose_dead(), reset_gold_spent(), set_team_index(), and synced_turn_shift().
|
inline |
Definition at line 423 of file side_actions.hpp.
References actions_, and wb::side_actions_container::turn_begin().
Referenced by execute_net_cmd(), wb::operator<<(), raw_turn_shift(), and safe_insert().
|
inline |
Definition at line 427 of file side_actions.hpp.
References actions_, and wb::side_actions_container::turn_begin().
|
inline |
Definition at line 424 of file side_actions.hpp.
References actions_, and wb::side_actions_container::turn_end().
Referenced by execute(), wb::operator<<(), and raw_turn_shift().
|
inline |
Definition at line 428 of file side_actions.hpp.
References actions_, and wb::side_actions_container::turn_end().
|
inline |
Definition at line 425 of file side_actions.hpp.
References actions_, and wb::side_actions_container::turn_rbegin().
|
inline |
Definition at line 429 of file side_actions.hpp.
References actions_, and wb::side_actions_container::turn_rbegin().
|
inline |
Definition at line 426 of file side_actions.hpp.
References actions_, and wb::side_actions_container::turn_rend().
|
inline |
Definition at line 430 of file side_actions.hpp.
References actions_, and wb::side_actions_container::turn_rend().
|
inline |
Returns the number of actions planned for turn turn_num.
Definition at line 344 of file side_actions.hpp.
References actions_, and wb::side_actions_container::turn_size().
Referenced by bump_earlier(), wb::operator<<(), and synced_enqueue().
bool wb::side_actions::unit_has_actions | ( | const unit & | unit | ) |
Definition at line 654 of file side_actions.cpp.
References actions_, wb::side_actions_container::get(), and unit::underlying_id().
void wb::side_actions::update_recruited_unit | ( | std::size_t | old_id, |
unit & | new_unit | ||
) |
After a recruit action was executed the id of the unit was changed so we need to update the unitid of all following actions on that unit.
Definition at line 695 of file side_actions.cpp.
References actions_, begin(), end(), wb::side_actions_container::modify(), wb::move::modify_unit(), and p.
|
private |
Definition at line 571 of file side_actions.hpp.
Referenced by actions_of(), begin(), bump_earlier(), clear(), count_actions_of(), empty(), end(), execute(), execute_net_cmd(), find_first_action_at(), find_first_action_of(), find_last_action_of(), get_turn(), insert_action(), iter_turn(), make_net_cmd_bump_later(), make_net_cmd_insert(), make_net_cmd_refresh(), make_net_cmd_remove(), make_net_cmd_replace(), num_turns(), raw_turn_shift(), rbegin(), remove_action(), rend(), riter_turn(), safe_erase(), safe_insert(), size(), synced_enqueue(), synced_insert(), turn_begin(), turn_end(), turn_rbegin(), turn_rend(), turn_size(), unit_has_actions(), and update_recruited_unit().
|
private |
Used to store gold "spent" in planned recruits/recalls when the future unit map is applied.
Definition at line 577 of file side_actions.hpp.
Referenced by change_gold_spent_by(), get_gold_spent(), and reset_gold_spent().
|
private |
Definition at line 579 of file side_actions.hpp.
Referenced by execute_net_cmd(), hidden(), hide(), queue_attack(), queue_move(), queue_recall(), queue_recruit(), queue_suppose_dead(), and show().
|
private |
Definition at line 573 of file side_actions.hpp.
Referenced by bump_earlier(), execute(), remove_action(), set_team_index(), synced_enqueue(), synced_erase(), synced_insert(), and team_index().
|
private |
Definition at line 574 of file side_actions.hpp.
Referenced by set_team_index(), and team_index().