Skip to content

Commit

Permalink
fix some indention
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Mar 22, 2015
1 parent 4872b1d commit 280dd8e
Show file tree
Hide file tree
Showing 37 changed files with 139 additions and 137 deletions.
24 changes: 12 additions & 12 deletions src/ai/actions.cpp
Expand Up @@ -1123,31 +1123,31 @@ void sim_gamestate_changed(action_result *result, bool gamestate_changed){


std::ostream &operator<<(std::ostream &s, ai::attack_result const &r) {
s << r.do_describe();
return s;
s << r.do_describe();
return s;
}

std::ostream &operator<<(std::ostream &s, ai::move_result const &r) {
s << r.do_describe();
return s;
s << r.do_describe();
return s;
}

std::ostream &operator<<(std::ostream &s, ai::recall_result const &r) {
s << r.do_describe();
return s;
s << r.do_describe();
return s;
}

std::ostream &operator<<(std::ostream &s, ai::recruit_result const &r) {
s << r.do_describe();
return s;
s << r.do_describe();
return s;
}

std::ostream &operator<<(std::ostream &s, ai::stopunit_result const &r) {
s << r.do_describe();
return s;
s << r.do_describe();
return s;
}

std::ostream &operator<<(std::ostream &s, ai::synced_command_result const &r) {
s << r.do_describe();
return s;
s << r.do_describe();
return s;
}
6 changes: 3 additions & 3 deletions src/ai/default/attack.cpp
Expand Up @@ -37,9 +37,9 @@ static lg::log_domain log_ai("ai/attack");
namespace ai {

void attack_analysis::analyze(const gamemap& map, unit_map& units,
const readonly_context& ai_obj,
const move_map& dstsrc, const move_map& srcdst,
const move_map& enemy_dstsrc, double aggression)
const readonly_context& ai_obj,
const move_map& dstsrc, const move_map& srcdst,
const move_map& enemy_dstsrc, double aggression)
{
const unit_map::const_iterator defend_it = units.find(target);
assert(defend_it != units.end());
Expand Down
2 changes: 1 addition & 1 deletion src/callable_objects.hpp
Expand Up @@ -75,7 +75,7 @@ class terrain_callable : public game_logic::formula_callable {
variant get_value(const std::string& key) const;
void get_inputs(std::vector<game_logic::formula_input>* inputs) const;

int do_compare(const formula_callable* callable) const;
int do_compare(const formula_callable* callable) const;
private:
const location loc_;
const terrain_type &t_;
Expand Down
4 changes: 2 additions & 2 deletions src/cursor.cpp
Expand Up @@ -168,9 +168,9 @@ void set(CURSOR_TYPE type)

// Causes problem on Mac:
//if (cursor_image != NULL && cursor_image != SDL_GetCursor())
SDL_SetCursor(cursor_image);
SDL_SetCursor(cursor_image);

SDL_ShowCursor(SDL_ENABLE);
SDL_ShowCursor(SDL_ENABLE);
}

void set_dragging(bool drag)
Expand Down
33 changes: 16 additions & 17 deletions src/formula.cpp
Expand Up @@ -31,8 +31,7 @@ void formula_callable::set_value(const std::string& key, const variant& /*value*
}


map_formula_callable::map_formula_callable(
const formula_callable* fallback) :
map_formula_callable::map_formula_callable(const formula_callable* fallback) :
formula_callable(false),
values_(),
fallback_(fallback)
Expand Down Expand Up @@ -249,16 +248,16 @@ class dot_callable : public formula_callable {
const formula_callable& global_, &local_;

void get_inputs(std::vector<formula_input>* inputs) const {
return local_.get_inputs(inputs);
return local_.get_inputs(inputs);
}

variant get_value(const std::string& key) const {
variant v = local_.query_value(key);
variant v = local_.query_value(key);

if ( v == variant() )
return global_.query_value(key);
else
return v;
if ( v == variant() )
return global_.query_value(key);
else
return v;
}
};

Expand All @@ -278,17 +277,17 @@ class dot_expression : public formula_expression {
const variant left = left_->evaluate(variables,add_debug_info(fdb,0,"left."));
if(!left.is_callable()) {
if(left.is_list()) {
list_callable list_call(left);
dot_callable callable(variables, list_call);
list_callable list_call(left);
dot_callable callable(variables, list_call);
return right_->evaluate(callable,fdb);
}

return left;
}

dot_callable callable(variables, *left.as_callable());
return right_->evaluate(callable,add_debug_info(fdb,1,".right"));
}
dot_callable callable(variables, *left.as_callable());
return right_->evaluate(callable,add_debug_info(fdb,1,".right"));
}

expression_ptr left_, right_;
};
Expand Down Expand Up @@ -852,7 +851,7 @@ expression_ptr parse_expression(const token* i1, const token* i2, function_symbo
operator_precedence(*i)) ) {
op = i;
}
operator_group = true;
operator_group = true;
} else {
operator_group = false;
}
Expand All @@ -864,15 +863,15 @@ expression_ptr parse_expression(const token* i1, const token* i2, function_symbo
} else if( (i2-1)->type == TOKEN_RSQUARE) { //check if there is [ ] : either a list/map definition, or a operator
const token* tok = i2-2;
int square_parens = 0;
bool is_map = false;
bool is_map = false;
while ( (tok->type != TOKEN_LSQUARE || square_parens) && tok != i1) {
if (tok->type == TOKEN_RSQUARE) {
square_parens++;
} else if(tok->type == TOKEN_LSQUARE) {
square_parens--;
} else if( (tok->type == TOKEN_POINTER) && !square_parens ) {
is_map = true;
}
is_map = true;
}
--tok;
}
if (tok->type == TOKEN_LSQUARE) {
Expand Down
10 changes: 5 additions & 5 deletions src/formula_callable.hpp
Expand Up @@ -63,7 +63,7 @@ class formula_callable : public reference_counted_object {

virtual void get_inputs(std::vector<formula_input>* /*inputs*/) const {}

//note: this function should NOT overwrite str, but append text to it!
//note: this function should NOT overwrite str, but append text to it!
void serialize(std::string& str) const {
serialize_to_string(str);
}
Expand All @@ -85,18 +85,18 @@ class formula_callable : public reference_counted_object {
return this < callable ? -1 : (this == callable ? 0 : 1);
}

//note: this function should NOT overwrite str, but append text to it!
//note: this function should NOT overwrite str, but append text to it!
virtual void serialize_to_string(std::string& /*str*/) const {
throw type_error("Tried to serialize type which cannot be serialized");
}

//priority for objects that are derived from this class, used in do_compare
//when comparing objects of different types
//for example: formula_callable < terrain_callable < unit_type_callable ...
enum TYPE { FORMULA_C, TERRAIN_C, LOCATION_C, UNIT_TYPE_C, UNIT_C,
ATTACK_TYPE_C, MOVE_PARTIAL_C, MOVE_C, ATTACK_C, MOVE_MAP_C };
enum TYPE { FORMULA_C, TERRAIN_C, LOCATION_C, UNIT_TYPE_C, UNIT_C,
ATTACK_TYPE_C, MOVE_PARTIAL_C, MOVE_C, ATTACK_C, MOVE_MAP_C };

TYPE type_;
TYPE type_;
private:
virtual variant get_value(const std::string& key) const = 0;
bool has_self_;
Expand Down
4 changes: 2 additions & 2 deletions src/formula_debugger.cpp
Expand Up @@ -86,7 +86,7 @@ bool debug_info::evaluated() const

void debug_info::set_evaluated(bool evaluated)
{
evaluated_ = evaluated;
evaluated_ = evaluated;
}


Expand Down Expand Up @@ -370,7 +370,7 @@ void formula_debugger::add_breakpoint_continue_to_end()

void formula_debugger::add_breakpoint_step_into()
{
breakpoints_.push_back(breakpoint_ptr(new step_in_breakpoint(*this)));
breakpoints_.push_back(breakpoint_ptr(new step_in_breakpoint(*this)));
LOG_FDB << "added 'step into' breakpoint"<< std::endl;
}

Expand Down
2 changes: 1 addition & 1 deletion src/formula_function.hpp
Expand Up @@ -40,7 +40,7 @@ class formula_expression {
private:
virtual variant execute(const formula_callable& variables, formula_debugger *fdb = NULL) const = 0;
const char* name_;
friend class formula_debugger;
friend class formula_debugger;
};

typedef boost::shared_ptr<formula_expression> expression_ptr;
Expand Down
2 changes: 1 addition & 1 deletion src/game_board.hpp
Expand Up @@ -127,7 +127,7 @@ class game_board : public display_context {
void overlay_map (const gamemap & o, const config & cfg, map_location loc, bool border);

bool change_terrain(const map_location &loc, const std::string &t,
const std::string & mode, bool replace_if_failed); //used only by lua
const std::string & mode, bool replace_if_failed); //used only by lua

// Global accessor from unit.hpp

Expand Down
4 changes: 2 additions & 2 deletions src/game_config.hpp
Expand Up @@ -84,9 +84,9 @@ namespace game_config

namespace images {
extern std::string game_title,
game_title_background,
game_title_background,
// orbs and hp/xp bar
orb,
orb,
energy,
// flags
flag,
Expand Down
5 changes: 3 additions & 2 deletions src/game_events/action_wml.cpp
Expand Up @@ -550,8 +550,9 @@ WML_HANDLER_FUNCTION(do_command, /*event_info*/, cfg)
/*data*/ i.get_child().get_parsed_config(),
/*use_undo*/ true,
/*show*/ true,
/*error_handler*/ &on_replay_error);
}
/*error_handler*/ &on_replay_error
);
}
}

/// Experimental data persistence
Expand Down
4 changes: 2 additions & 2 deletions src/hotkey/hotkey_item.hpp
Expand Up @@ -27,7 +27,7 @@ class hotkey_item {

explicit hotkey_item(const std::string& command) :
command_(command),
shift_(false), ctrl_(false), cmd_(false), alt_(false),
shift_(false), ctrl_(false), cmd_(false), alt_(false),
character_(-1), keycode_(-1),
joystick_(-1), mouse_(-1),
button_(-1), hat_(-1), value_(-1),
Expand All @@ -36,7 +36,7 @@ class hotkey_item {

explicit hotkey_item(const config& cfg, bool is_default):
command_("null"),
shift_(false), ctrl_(false), cmd_(false), alt_(false),
shift_(false), ctrl_(false), cmd_(false), alt_(false),
character_(-1), keycode_(-1),
joystick_(-1), mouse_(-1),
button_(-1), hat_(-1), value_(-1),
Expand Down
4 changes: 2 additions & 2 deletions src/image.cpp
Expand Up @@ -1291,15 +1291,15 @@ std::string describe_versions()
ss << "Compiled with SDL_image version: "
<< static_cast<int> (compile_version.major) << "."
<< static_cast<int> (compile_version.minor) << "."
<< static_cast<int> (compile_version.patch) << " \n";
<< static_cast<int> (compile_version.patch) << " \n";
#endif

#ifdef Image_Linked_Version
const SDL_version *link_version=Image_Linked_Version();
ss << "Running with SDL_image version: "
<< static_cast<int> (link_version->major) << "."
<< static_cast<int> (link_version->minor) << "."
<< static_cast<int> (link_version->patch) << " .\n";
<< static_cast<int> (link_version->patch) << " .\n";
#endif

return ss.str();
Expand Down
1 change: 1 addition & 0 deletions src/image_modifications.cpp
Expand Up @@ -557,6 +557,7 @@ namespace {
* @param type The modification type to be registered (unquoted)
* @param args_var The name for the string argument provided
*/
//FIXME: simplyfy this macro like WML_HANDLER_FUNCTION.
#define REGISTER_MOD_PARSER(type, args_var) \
modification* parse_##type##_mod(const std::string&); \
struct parse_##type##_mod_registration \
Expand Down
6 changes: 3 additions & 3 deletions src/leader_scroll_dialog.cpp
Expand Up @@ -136,9 +136,9 @@ void status_table(display& gui, int selected)
str << utils::half_signed_value(data.gold) << COLUMN_SEPARATOR;
}
str << data.villages;
if(!(viewing_team.uses_fog() || viewing_team.uses_shroud())) {
str << "/" << map.villages().size();
}
if(!(viewing_team.uses_fog() || viewing_team.uses_shroud())) {
str << "/" << map.villages().size();
}
str << COLUMN_SEPARATOR
<< data.units << COLUMN_SEPARATOR << data.upkeep << COLUMN_SEPARATOR
<< (data.net_income < 0 ? font::BAD_TEXT : font::NULL_MARKUP) << utils::signed_value(data.net_income);
Expand Down
19 changes: 9 additions & 10 deletions src/menu_events.cpp
Expand Up @@ -295,9 +295,9 @@ void menu_handler::status_table(int selected)
str << utils::half_signed_value(data.gold) << COLUMN_SEPARATOR;
}
str << data.villages;
if(!(viewing_team.uses_fog() || viewing_team.uses_shroud())) {
str << "/" << map().villages().size();
}
if(!(viewing_team.uses_fog() || viewing_team.uses_shroud())) {
str << "/" << map().villages().size();
}
str << COLUMN_SEPARATOR
<< data.units << COLUMN_SEPARATOR << data.upkeep << COLUMN_SEPARATOR
<< (data.net_income < 0 ? font::BAD_TEXT : font::NULL_MARKUP) << utils::signed_value(data.net_income);
Expand Down Expand Up @@ -512,13 +512,12 @@ void menu_handler::preferences()

void menu_handler::show_chat_log()
{
config c;
c["name"] = "prototype of chat log";
gui2::tchat_log chat_log_dialog(vconfig(c), resources::recorder);
chat_log_dialog.show(gui_->video());
//std::string text = resources::recorder->build_chat_log();
//gui::show_dialog(*gui_,NULL,_("Chat Log"),"",gui::CLOSE_ONLY,NULL,NULL,"",&text);

config c;
c["name"] = "prototype of chat log";
gui2::tchat_log chat_log_dialog(vconfig(c), resources::recorder);
chat_log_dialog.show(gui_->video());
//std::string text = resources::recorder->build_chat_log();
//gui::show_dialog(*gui_,NULL,_("Chat Log"),"",gui::CLOSE_ONLY,NULL,NULL,"",&text);
}

void menu_handler::show_help()
Expand Down
8 changes: 4 additions & 4 deletions src/preferences.cpp
Expand Up @@ -93,11 +93,11 @@ base_manager::~base_manager()

void write_preferences()
{
#ifndef _WIN32
#ifndef _WIN32

bool prefs_file_existed = access(filesystem::get_prefs_file().c_str(), F_OK) == 0;

#endif
#endif

try {
filesystem::scoped_ostream prefs_file = filesystem::ostream_file(filesystem::get_prefs_file());
Expand All @@ -107,7 +107,7 @@ void write_preferences()
}


#ifndef _WIN32
#ifndef _WIN32

if(!prefs_file_existed) {

Expand All @@ -117,7 +117,7 @@ void write_preferences()

}

#endif
#endif


}
Expand Down
6 changes: 3 additions & 3 deletions src/replay_controller.cpp
Expand Up @@ -393,7 +393,7 @@ void replay_controller::replay_next_turn()

play_turn();

if (!is_skipping_replay() || !is_playing_){
if (!is_skipping_replay() || !is_playing_) {
gui_->scroll_to_leader(player_number_,game_display::ONSCREEN,false);
}

Expand All @@ -407,10 +407,10 @@ void replay_controller::replay_next_move_or_side(bool one_move)

play_move_or_side(one_move);
while (current_team().is_empty()) {
play_move_or_side(one_move);
play_move_or_side(one_move);
}

if ( (!is_skipping_replay() || !is_playing_) && (last_replay_action == REPLAY_FOUND_END_TURN) ){
if ( (!is_skipping_replay() || !is_playing_) && (last_replay_action == REPLAY_FOUND_END_TURN) ){
gui_->scroll_to_leader(player_number_,game_display::ONSCREEN,false);
}

Expand Down

0 comments on commit 280dd8e

Please sign in to comment.