mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 16:15:38 +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"];
|
||||
|
||||
if(type=="move")
|
||||
return action_ptr(new move(cfg,hidden));
|
||||
else if(type=="attack")
|
||||
return action_ptr(new attack(cfg,hidden));
|
||||
else if(type=="recruit")
|
||||
return action_ptr(new recruit(cfg,hidden));
|
||||
else if(type=="recall")
|
||||
return action_ptr(new recall(cfg,hidden));
|
||||
else if(type=="suppose_dead")
|
||||
return action_ptr(new suppose_dead(cfg,hidden));
|
||||
try {
|
||||
if(type=="move")
|
||||
return action_ptr(new move(cfg,hidden));
|
||||
else if(type=="attack")
|
||||
return action_ptr(new attack(cfg,hidden));
|
||||
else if(type=="recruit")
|
||||
return action_ptr(new recruit(cfg,hidden));
|
||||
else if(type=="recall")
|
||||
return action_ptr(new recall(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()
|
||||
|
@ -654,10 +654,9 @@ void side_actions::execute_net_cmd(net_cmd const& cmd)
|
||||
{
|
||||
size_t turn = cmd["turn"].to_int();
|
||||
size_t pos = cmd["pos"].to_int();
|
||||
action_ptr act;
|
||||
try {
|
||||
act = action::from_config(cmd.child("action"),hidden_);
|
||||
} catch(action::ctor_err const&) {
|
||||
action_ptr act = action::from_config(cmd.child("action"),hidden_);
|
||||
if(!act)
|
||||
{
|
||||
ERR_WB << "side_actions::execute_network_command(): received invalid action data!\n";
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user