Merged patch for issue 0000298: supertux fails to compile with gcc 4.3 (submitted...
authorChristoph Sommer <mail@christoph-sommer.de>
Mon, 18 Feb 2008 19:30:28 +0000 (19:30 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Mon, 18 Feb 2008 19:30:28 +0000 (19:30 +0000)
SVN-Revision: 5330

src/addon_manager.cpp
src/console.hpp
src/lisp/lexer.cpp
src/object/block.cpp
src/object/growup.cpp
src/object/growup.hpp
src/sprite/sprite_manager.hpp
src/textscroller.hpp
src/title.cpp
src/video/sdl_texture.hpp

index ae76953..b59dde0 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <sstream>
 #include <stdexcept>
+#include <cstdlib>
 #include <list>
 #include <physfs.h>
 #include <sys/stat.h>
index 59d3934..3543cf6 100644 (file)
@@ -26,6 +26,7 @@
 #include <string>
 #include <sstream>
 #include <iostream>
+#include <memory>
 #include <squirrel.h>
 
 class Console;
index c9daf4b..05b52bc 100644 (file)
@@ -19,6 +19,7 @@
 #include <config.h>
 
 #include <sstream>
+#include <cstring>
 #include <stdexcept>
 #include <iostream>
 
index 7d0b938..68721e8 100644 (file)
@@ -93,6 +93,12 @@ Block::collision(GameObject& other, const CollisionHit& )
     if(coin) {
       coin->collect();
     }
+    
+    //Eggs get jumped
+    GrowUp* growup = dynamic_cast<GrowUp*> (&other);
+    if(growup) {
+      growup->do_jump();
+    }
 
   }
 
index 1d256db..db86615 100644 (file)
@@ -44,7 +44,9 @@ GrowUp::update(float elapsed_time)
 void
 GrowUp::collision_solid(const CollisionHit& hit)
 {
-  if(hit.top || hit.bottom)
+  if(hit.top)
+    physic.set_velocity_y(0);
+  if(hit.bottom && physic.get_velocity_y() > 0)
     physic.set_velocity_y(0);
   if(hit.left || hit.right)
     physic.set_velocity_x(-physic.get_velocity_x());
@@ -66,3 +68,9 @@ GrowUp::collision(GameObject& other, const CollisionHit& )
 
   return FORCE_MOVE;
 }
+
+void
+GrowUp::do_jump()
+{
+    physic.set_velocity_y(-300);
+}
index 869b3fe..ec7484b 100644 (file)
@@ -33,6 +33,7 @@ public:
   virtual void update(float elapsed_time);
   virtual void collision_solid(const CollisionHit& hit);
   virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
+  void do_jump();
 };
 
 #endif
index 7b5c1e4..544ee9f 100644 (file)
@@ -21,6 +21,7 @@
 #define SUPERTUX_SPRITE_MANAGER_H
 
 #include <map>
+#include <string>
 
 class SpriteData;
 class Sprite;
index a6dafb6..b232b18 100644 (file)
@@ -24,6 +24,7 @@
 #include <vector>
 #include <string>
 #include <map>
+#include <memory>
 
 #include "screen.hpp"
 #include "math/vector.hpp"
index a53f8ab..6c0c095 100644 (file)
@@ -32,6 +32,7 @@
 #include <SDL.h>
 #include <SDL_image.h>
 #include <physfs.h>
+#include <algorithm>
 
 #include "title.hpp"
 #include "mainloop.hpp"
index 34479db..be4f2fc 100644 (file)
@@ -21,6 +21,7 @@
 #define __SDL_TEXTURE_HPP__
 
 #include <config.h>
+#include <algorithm>
 
 #include <SDL.h>