Skip to content

Commit

Permalink
Formula engine: debug_print() now shows in chat if debug mode on
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Mar 18, 2016
1 parent a02b1c1 commit f847636
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/formula_function.cpp
Expand Up @@ -19,6 +19,7 @@
#include "formula_debugger.hpp"
#include "formula_function.hpp"
#include "game_display.hpp"
#include "game_config.hpp"
#include "log.hpp"

#include <boost/foreach.hpp>
Expand Down Expand Up @@ -288,12 +289,18 @@ class debug_print_function : public function_expression {
{
str1 = var1.to_debug_string(NULL, true);
LOG_SF << str1 << std::endl;
if(game_config::debug) {
game_display::get_singleton()->get_chat_manager().add_chat_message(time(NULL), "WFL", 0, str1, events::chat_handler::MESSAGE_PUBLIC, false);
}
return var1;
} else {
str1 = var1.string_cast();
const variant var2 = args()[1]->evaluate(variables,fdb);
str2 = var2.to_debug_string(NULL, true);
LOG_SF << str1 << str2 << std::endl;
if(game_config::debug) {
game_display::get_singleton()->get_chat_manager().add_chat_message(time(NULL), str1, 0, str2, events::chat_handler::MESSAGE_PUBLIC, false);
}
return var2;
}
}
Expand Down

0 comments on commit f847636

Please sign in to comment.