From 68936bd7ba924fb0c2655419ad9802a7e15a2f8c Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Mon, 18 Feb 2008 19:30:28 +0000 Subject: [PATCH] Merged patch for issue 0000298: supertux fails to compile with gcc 4.3 (submitted by "bero") SVN-Revision: 5330 --- src/addon_manager.cpp | 1 + src/console.hpp | 1 + src/lisp/lexer.cpp | 1 + src/object/block.cpp | 6 ++++++ src/object/growup.cpp | 10 +++++++++- src/object/growup.hpp | 1 + src/sprite/sprite_manager.hpp | 1 + src/textscroller.hpp | 1 + src/title.cpp | 1 + src/video/sdl_texture.hpp | 1 + 10 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/addon_manager.cpp b/src/addon_manager.cpp index ae76953ef..b59dde094 100644 --- a/src/addon_manager.cpp +++ b/src/addon_manager.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/src/console.hpp b/src/console.hpp index 59d393486..3543cf62a 100644 --- a/src/console.hpp +++ b/src/console.hpp @@ -26,6 +26,7 @@ #include #include #include +#include #include class Console; diff --git a/src/lisp/lexer.cpp b/src/lisp/lexer.cpp index c9daf4b69..05b52bc09 100644 --- a/src/lisp/lexer.cpp +++ b/src/lisp/lexer.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include diff --git a/src/object/block.cpp b/src/object/block.cpp index 7d0b938a9..68721e8db 100644 --- a/src/object/block.cpp +++ b/src/object/block.cpp @@ -93,6 +93,12 @@ Block::collision(GameObject& other, const CollisionHit& ) if(coin) { coin->collect(); } + + //Eggs get jumped + GrowUp* growup = dynamic_cast (&other); + if(growup) { + growup->do_jump(); + } } diff --git a/src/object/growup.cpp b/src/object/growup.cpp index 1d256dbb7..db8661541 100644 --- a/src/object/growup.cpp +++ b/src/object/growup.cpp @@ -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); +} diff --git a/src/object/growup.hpp b/src/object/growup.hpp index 869b3fe0b..ec7484b6b 100644 --- a/src/object/growup.hpp +++ b/src/object/growup.hpp @@ -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 diff --git a/src/sprite/sprite_manager.hpp b/src/sprite/sprite_manager.hpp index 7b5c1e476..544ee9f07 100644 --- a/src/sprite/sprite_manager.hpp +++ b/src/sprite/sprite_manager.hpp @@ -21,6 +21,7 @@ #define SUPERTUX_SPRITE_MANAGER_H #include +#include class SpriteData; class Sprite; diff --git a/src/textscroller.hpp b/src/textscroller.hpp index a6dafb680..b232b1895 100644 --- a/src/textscroller.hpp +++ b/src/textscroller.hpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "screen.hpp" #include "math/vector.hpp" diff --git a/src/title.cpp b/src/title.cpp index a53f8aba5..6c0c09545 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include "title.hpp" #include "mainloop.hpp" diff --git a/src/video/sdl_texture.hpp b/src/video/sdl_texture.hpp index 34479dbca..be4f2fca1 100644 --- a/src/video/sdl_texture.hpp +++ b/src/video/sdl_texture.hpp @@ -21,6 +21,7 @@ #define __SDL_TEXTURE_HPP__ #include +#include #include -- 2.11.0