mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-09 04:16:56 +00:00
Changed action::from_config() to do what its comment says it should do.
This commit is contained in:
parent
ccaa6c64be
commit
093ab10fa0
@ -59,18 +59,20 @@ action_ptr action::from_config(config const& cfg, bool hidden)
|
|||||||
{
|
{
|
||||||
std::string type = cfg["type"];
|
std::string type = cfg["type"];
|
||||||
|
|
||||||
if(type=="move")
|
try {
|
||||||
return action_ptr(new move(cfg,hidden));
|
if(type=="move")
|
||||||
else if(type=="attack")
|
return action_ptr(new move(cfg,hidden));
|
||||||
return action_ptr(new attack(cfg,hidden));
|
else if(type=="attack")
|
||||||
else if(type=="recruit")
|
return action_ptr(new attack(cfg,hidden));
|
||||||
return action_ptr(new recruit(cfg,hidden));
|
else if(type=="recruit")
|
||||||
else if(type=="recall")
|
return action_ptr(new recruit(cfg,hidden));
|
||||||
return action_ptr(new recall(cfg,hidden));
|
else if(type=="recall")
|
||||||
else if(type=="suppose_dead")
|
return action_ptr(new recall(cfg,hidden));
|
||||||
return action_ptr(new suppose_dead(cfg,hidden));
|
else if(type=="suppose_dead")
|
||||||
|
return action_ptr(new suppose_dead(cfg,hidden));
|
||||||
|
} catch(action::ctor_err const&) {}
|
||||||
|
|
||||||
throw ctor_err("action: Invalid type");
|
return action_ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
void action::hide()
|
void action::hide()
|
||||||
|
@ -654,10 +654,9 @@ void side_actions::execute_net_cmd(net_cmd const& cmd)
|
|||||||
{
|
{
|
||||||
size_t turn = cmd["turn"].to_int();
|
size_t turn = cmd["turn"].to_int();
|
||||||
size_t pos = cmd["pos"].to_int();
|
size_t pos = cmd["pos"].to_int();
|
||||||
action_ptr act;
|
action_ptr act = action::from_config(cmd.child("action"),hidden_);
|
||||||
try {
|
if(!act)
|
||||||
act = action::from_config(cmd.child("action"),hidden_);
|
{
|
||||||
} catch(action::ctor_err const&) {
|
|
||||||
ERR_WB << "side_actions::execute_network_command(): received invalid action data!\n";
|
ERR_WB << "side_actions::execute_network_command(): received invalid action data!\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user