Minor #include optimization
[supertux.git] / src / trigger / climbable.cpp
index b2a4e49..7ec2af1 100644 (file)
@@ -93,8 +93,8 @@ Climbable::draw(DrawingContext& context)
   if (climbed_by) {
     context.push_transform();
     context.set_translation(Vector(0, 0));
-    Vector pos = Vector(0, SCREEN_HEIGHT/2 - gold_text->get_height()/2);
-    context.draw_center_text(gold_text, "Up we go...", pos, LAYER_GUI);
+    Vector pos = Vector(0, SCREEN_HEIGHT/2 - normal_font->get_height()/2);
+    context.draw_center_text(normal_font, _("Up we go..."), pos, LAYER_GUI, Climbable::text_color);
     context.pop_transform();
   }
 }
@@ -103,16 +103,18 @@ void
 Climbable::event(Player& player, EventType type)
 {
   if ((type == EVENT_ACTIVATE) || (activate_try_timer.started())) {
-    if (may_climb(player)) {
-      climbed_by = &player;
-      player.start_climbing(*this);
-      activate_try_timer.stop();
-    } else {
-      if (type == EVENT_ACTIVATE) activate_try_timer.start(ACTIVATE_TRY_FOR);
-      if (player.get_bbox().p1.x < get_bbox().p1.x - GRACE_DX) player.add_velocity(Vector(POSITION_FIX_AX,0));
-      if (player.get_bbox().p2.x > get_bbox().p2.x + GRACE_DX) player.add_velocity(Vector(-POSITION_FIX_AX,0));
-      if (player.get_bbox().p1.y < get_bbox().p1.y - GRACE_DY) player.add_velocity(Vector(0,POSITION_FIX_AY));
-      if (player.get_bbox().p2.y > get_bbox().p2.y + GRACE_DY) player.add_velocity(Vector(0,-POSITION_FIX_AY));
+    if(player.get_grabbed_object() == NULL){
+      if(may_climb(player)) {
+        climbed_by = &player;
+        player.start_climbing(*this);
+        activate_try_timer.stop();
+      } else {
+        if (type == EVENT_ACTIVATE) activate_try_timer.start(ACTIVATE_TRY_FOR);
+        if (player.get_bbox().p1.x < get_bbox().p1.x - GRACE_DX) player.add_velocity(Vector(POSITION_FIX_AX,0));
+        if (player.get_bbox().p2.x > get_bbox().p2.x + GRACE_DX) player.add_velocity(Vector(-POSITION_FIX_AX,0));
+        if (player.get_bbox().p1.y < get_bbox().p1.y - GRACE_DY) player.add_velocity(Vector(0,POSITION_FIX_AY));
+        if (player.get_bbox().p2.y > get_bbox().p2.y + GRACE_DY) player.add_velocity(Vector(0,-POSITION_FIX_AY));
+      }
     }
   }
   if(type == EVENT_LOSETOUCH) {