From: Ricardo Cruz Date: Wed, 21 Apr 2004 22:48:43 +0000 (+0000) Subject: Limitated the number of bullets to be shot at the same time. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=8d960ae1cab474260a82a53a2101aa6269825ca2;p=supertux.git Limitated the number of bullets to be shot at the same time. I have made 2 bullets to be the maximum... if you don't agree tell me. anyway, you can easily change them in defines.h SVN-Revision: 617 --- diff --git a/src/defines.h b/src/defines.h index 7d9173f39..258d7869f 100644 --- a/src/defines.h +++ b/src/defines.h @@ -70,6 +70,8 @@ enum DyingType { #define RUN_SPEED 1.5 #define JUMP_SPEED 1.2 +#define MAX_BULLETS 2 + #define GRAVITY 1.0 #define YM_FOR_JUMP 6.0 #define WALK_ACCELERATION_X 0.03 diff --git a/src/world.cpp b/src/world.cpp index f43d3e1ca..e9c5bb194 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -399,6 +399,9 @@ World::add_upgrade(float x, float y, Direction dir, UpgradeKind kind) void World::add_bullet(float x, float y, float xm, Direction dir) { + if(bullets.size() > MAX_BULLETS-1) + return; + Bullet new_bullet; new_bullet.init(x,y,xm,dir); bullets.push_back(new_bullet);