The Battle for Wesnoth
1.19.7+dev
actions
undo_update_shroud_action.cpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2017 - 2024
3
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY.
11
12
See the COPYING file for more details.
13
*/
14
15
#include "
actions/undo_update_shroud_action.hpp
"
16
17
#include "
play_controller.hpp
"
18
#include "
resources.hpp
"
// for screen, teams, units, etc
19
#include "
synced_context.hpp
"
// for set_scontext_synced
20
#include "
team.hpp
"
// for team
21
22
namespace
actions::undo
23
{
24
/**
25
* Writes this into the provided config.
26
*/
27
void
auto_shroud_action::write
(
config
& cfg)
const
28
{
29
undo_action::write
(cfg);
30
cfg[
"active"
] =
active
;
31
}
32
33
bool
auto_shroud_action::undo
(
int
)
34
{
35
resources::controller
->
current_team
().
set_auto_shroud_updates
(!
active
);
36
return
true
;
37
}
38
39
static
auto
reg_auto_shroud
=
undo_action_container::subaction_factory<auto_shroud_action>
();
40
41
}
config
A config object defines a single node in a WML file, with access to child nodes.
Definition:
config.hpp:172
play_controller::current_team
team & current_team()
Definition:
play_controller.cpp:751
team::set_auto_shroud_updates
void set_auto_shroud_updates(bool value)
Definition:
team.hpp:325
actions::undo
Definition:
undo_dismiss_action.cpp:22
actions::undo::reg_auto_shroud
static auto reg_auto_shroud
Definition:
undo_update_shroud_action.cpp:39
resources::controller
play_controller * controller
Definition:
resources.cpp:21
play_controller.hpp
resources.hpp
actions::undo::auto_shroud_action::write
virtual void write(config &cfg) const
Writes this into the provided config.
Definition:
undo_update_shroud_action.cpp:27
actions::undo::auto_shroud_action::active
bool active
Definition:
undo_update_shroud_action.hpp:22
actions::undo::auto_shroud_action::undo
virtual bool undo(int)
Undoes this action.
Definition:
undo_update_shroud_action.cpp:33
actions::undo_action_container::subaction_factory
Definition:
undo_action.hpp:63
actions::undo_action::write
virtual void write(config &cfg) const
Writes this into the provided config.
Definition:
undo_action.hpp:91
synced_context.hpp
team.hpp
undo_update_shroud_action.hpp
Generated by
1.9.1