Committed some code beautification patches by Tron
authorChristoph Sommer <mail@christoph-sommer.de>
Tue, 25 Jul 2006 19:48:09 +0000 (19:48 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Tue, 25 Jul 2006 19:48:09 +0000 (19:48 +0000)
SVN-Revision: 4091

12 files changed:
src/audio/sound_manager.hpp
src/control/controller.cpp
src/control/joystickkeyboardcontroller.cpp
src/gui/button.cpp
src/main.cpp
src/moving_object.hpp
src/object/level_time.cpp
src/object/player.cpp
src/object/rock.cpp
src/physic.hpp
src/player_status.cpp
src/trigger/scripttrigger.cpp

index 657ca06..edf9290 100644 (file)
@@ -70,7 +70,7 @@ public:
   bool is_sound_enabled() { return sound_enabled; }
 
   bool is_audio_enabled() {
-      return (device == 0 || context == 0 ? false : true);
+                       return device != 0 && context != 0;
   }
 
   void update();
index 05a33aa..ee7a3e2 100644 (file)
@@ -62,13 +62,13 @@ Controller::hold(Control control)
 bool
 Controller::pressed(Control control)
 {
-  return oldControls[control] == false && controls[control] == true;
+  return !oldControls[control] && controls[control];
 }
 
 bool
 Controller::released(Control control)
 {
-  return oldControls[control] == true && controls[control] == false;
+  return oldControls[control] && !controls[control];
 }
 
 void
index 7bd5961..6f8222a 100644 (file)
@@ -342,8 +342,7 @@ JoystickKeyboardController::process_event(const SDL_Event& event)
         return;
       }
 
-      controls[i->second] =
-        event.type == SDL_JOYBUTTONDOWN ? true : false;
+      controls[i->second] = (event.type == SDL_JOYBUTTONDOWN);
       break;
     }
 
@@ -382,7 +381,7 @@ JoystickKeyboardController::process_key_event(const SDL_Event& event)
     return;
   }
   Control control = key_mapping->second;
-  controls[control] = event.type == SDL_KEYDOWN ? true : false;
+  controls[control] = (event.type == SDL_KEYDOWN);
 }
 
 void
@@ -481,7 +480,7 @@ JoystickKeyboardController::process_menu_key_event(const SDL_Event& event)
       break;
   }
 
-  controls[control] = event.type == SDL_KEYDOWN ? true : false;
+  controls[control] = (event.type == SDL_KEYDOWN);
 }
 
 void
index 05ef76c..4ddaa14 100644 (file)
@@ -162,7 +162,7 @@ for(Buttons::iterator i = buttons.begin(); i != buttons.end(); ++i)
       i->pos.y + i->size.y > (row + buttons_box.y) * buttons_size.y)
     continue;
 
-  i->draw(context, i->id == button_selected ? true : false);
+  i->draw(context, i->id == button_selected);
   }
 context.pop_transform();
 }
index fabccdd..8f1f50d 100644 (file)
@@ -503,7 +503,6 @@ int main(int argc, char** argv)
 
     //init_rand(); PAK: this call might subsume the above 3, but I'm chicken!
     main_loop->run();
-
   } catch(std::exception& e) {
     log_fatal << "Unexpected exception: " << e.what() << std::endl;
     result = 1;
index ae0e1d7..b23302a 100644 (file)
@@ -229,7 +229,7 @@ private:
    * during collision detection
    */
   Rect dest;
-  
+
   bool solid; /**< true if this object should be considered when doing collision detection */
 };
 
index 5911763..233e400 100644 (file)
@@ -71,7 +71,7 @@ LevelTime::draw(DrawingContext& context)
     Surface* time_surf = time_surface.get();
     if (time_surf) {
       float all_width = time_surf->get_width() + white_text->get_text_width(time_text);
-      context.draw_surface(time_surf, Vector((SCREEN_WIDTH - all_width)/2, BORDER_Y + 1), LAYER_FOREGROUND1); 
+      context.draw_surface(time_surf, Vector((SCREEN_WIDTH - all_width)/2, BORDER_Y + 1), LAYER_FOREGROUND1);
       context.draw_text(gold_text, time_text, Vector((SCREEN_WIDTH - all_width)/2 + time_surf->get_width(), BORDER_Y), LEFT_ALLIGN, LAYER_FOREGROUND1);
     }
   }
index 2d7e88c..a80ea94 100644 (file)
@@ -543,8 +543,8 @@ Player::handle_vertical_input()
   /* When Down is not held anymore, disable butt jump */
   if(butt_jump && !controller->hold(Controller::DOWN))
     butt_jump = false;
-  // swimming 
+
+  // swimming
   physic.set_acceleration_y(0);
   if (swimming) {
     if (controller->hold(Controller::UP) || controller->hold(Controller::JUMP)) physic.set_acceleration_y(-2000);
index aa883a1..6c45b0b 100644 (file)
@@ -107,7 +107,6 @@ Rock::grab(MovingObject& , const Vector& pos, Direction)
   set_group( COLGROUP_DISABLED );
   on_ground = true;
   grabbed = true;
-
 }
 
 void
index e05b65f..abfdba5 100644 (file)
@@ -67,10 +67,10 @@ public:
   /// Enables or disables handling of gravity.
   void enable_gravity(bool gravity_enabled);
   bool gravity_enabled() const;
-  
+
   /// Set gravity to apply to object when enabled
   void set_gravity(float gravity);
-  
+
   /// Get gravity to apply to object when enabled
   float get_gravity() const;
 
index f638bca..95f994e 100644 (file)
@@ -152,7 +152,7 @@ PlayerStatus::draw(DrawingContext& context)
 
   Surface* coin_surf = coin_surface.get();
   if (coin_surf) {
-    context.draw_surface(coin_surf, Vector(SCREEN_WIDTH - BORDER_X - coin_surf->get_width() - gold_text->get_text_width(coins_text), BORDER_Y + 1), LAYER_FOREGROUND1); 
+    context.draw_surface(coin_surf, Vector(SCREEN_WIDTH - BORDER_X - coin_surf->get_width() - gold_text->get_text_width(coins_text), BORDER_Y + 1), LAYER_FOREGROUND1);
   }
   context.draw_text(gold_text, coins_text, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y), RIGHT_ALLIGN, LAYER_FOREGROUND1);
 
index afac8ae..6af9b8c 100644 (file)
@@ -74,7 +74,7 @@ ScriptTrigger::write(lisp::Writer& writer)
   writer.write_float("width", bbox.get_width());
   writer.write_float("height", bbox.get_height());
   writer.write_string("script", script);
-  writer.write_bool("button", (triggerevent == EVENT_ACTIVATE) ? true : false);
+  writer.write_bool("button", triggerevent == EVENT_ACTIVATE);
 
   writer.end_list("scripttrigger");
 }