Skip to content

Commit

Permalink
move rarely used fcn from game_events to a support namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Dec 13, 2014
1 parent 38881e8 commit 1e2a6ff
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
5 changes: 5 additions & 0 deletions src/game_events/action_wml.cpp
Expand Up @@ -53,6 +53,7 @@
#include "replay.hpp"
#include "random_new.hpp"
#include "resources.hpp"
#include "scripting/game_lua_kernel.hpp"
#include "side_filter.hpp"
#include "sound.hpp"
#include "soundsource.hpp"
Expand Down Expand Up @@ -502,6 +503,10 @@ namespace { // Support functions
resources::screen->invalidate_all();
}

void handle_event_commands(const queued_event& event_info, const vconfig &cfg) {
assert(resources::lua_kernel);
resources::lua_kernel->run_wml_action("command", cfg, event_info);
}
} // end anonymous namespace (support functions)

void handle_deprecated_message(const config& cfg)
Expand Down
4 changes: 3 additions & 1 deletion src/game_events/handlers.cpp
Expand Up @@ -469,8 +469,10 @@ void event_handler::handle_event(const queued_event& event_info, handler_ptr& ha
handler_p.reset();
}
// *WARNING*: At this point, dereferencing this could be a memory violation!
// ^ this comment does not refer to resources::lua_kernel below, but to the vconfig

handle_event_commands(event_info, vcfg);
assert(resources::lua_kernel);
resources::lua_kernel->run_wml_action("command", vcfg, event_info);
}

bool event_handler::matches_name(const std::string &name) const
Expand Down
6 changes: 0 additions & 6 deletions src/game_events/pump.cpp
Expand Up @@ -425,12 +425,6 @@ void put_wml_message(const std::string& logger, const std::string& message, bool
}
}

void handle_event_commands(const queued_event& event_info, const vconfig &cfg)
{
assert(resources::lua_kernel);
resources::lua_kernel->run_wml_action("command", cfg, event_info);
}

bool fire(const std::string& event,
const entity_location& loc1,
const entity_location& loc2,
Expand Down
5 changes: 0 additions & 5 deletions src/game_events/pump.hpp
Expand Up @@ -99,11 +99,6 @@ namespace game_events
/// really be pushed into the wml_messages_stream, and does it.
void put_wml_message(const std::string& logger, const std::string& message, bool in_chat);

/**
* Runs the action handler associated to the command sequence @a cfg.
*/
void handle_event_commands(const queued_event &event_info, const vconfig &cfg);

/**
* Function to fire an event.
*
Expand Down

0 comments on commit 1e2a6ff

Please sign in to comment.