--- a/src/PhysicsWorld.cc Thu Dec 04 21:59:23 2008 +0000
+++ b/src/PhysicsWorld.cc Thu Dec 04 22:02:20 2008 +0000
@@ -14,7 +14,7 @@
players.push_back(object);
}
-void PhysicsWorld::addProjectile (Shot *projectile) {
+void PhysicsWorld::addProjectile (Projectile *projectile) {
projectiles.push_back(projectile);
}
@@ -22,7 +22,7 @@
* Function pointer used to clear the projectile list
* from those that have already been destroyd.
*/
-bool isDestroyedProjectile (Shot* po) { return (*po).isDestroyed(); }
+bool isDestroyedProjectile (Projectile* po) { return (*po).isDestroyed(); }
void PhysicsWorld::tick () {
// Engine::log(DEBUG, "physics.apply_force") << "*tick*";
@@ -31,12 +31,12 @@
(*i)->tick();
}
- for (std::list<Shot*>::iterator i = projectiles.begin(); i != projectiles.end(); i++) {
+ for (std::list<Projectile*>::iterator i = projectiles.begin(); i != projectiles.end(); i++) {
(*i)->tick();
}
// Delete destroyed projectiles
- std::list<Shot*>::iterator new_end = remove_if(projectiles.begin(), projectiles.end(), isDestroyedProjectile);
+ std::list<Projectile*>::iterator new_end = remove_if(projectiles.begin(), projectiles.end(), isDestroyedProjectile);
projectiles.erase(new_end, projectiles.end());
tick_counter++;
@@ -54,7 +54,7 @@
(*it)->draw(gc);
}
// Draw projectiles
- for (std::list<Shot*>::iterator it = projectiles.begin(); it != projectiles.end(); it++) {
+ for (std::list<Projectile*>::iterator it = projectiles.begin(); it != projectiles.end(); it++) {
(*it)->draw(gc);
}
}
--- a/src/PhysicsWorld.hh Thu Dec 04 21:59:23 2008 +0000
+++ b/src/PhysicsWorld.hh Thu Dec 04 22:02:20 2008 +0000
@@ -32,7 +32,7 @@
protected:
std::list<PhysicsObject*> players;
- std::list<Shot*> projectiles;
+ std::list<Projectile*> projectiles;
// std::vector<PhysicsObject*> objects;
// Contains connections between signals and slots
@@ -59,7 +59,7 @@
*/
void addPlayerObject(PhysicsObject *object);
- void addProjectile(Shot *projectile);
+ void addProjectile(Projectile *projectile);
/**
* Advance one time step in physics simulation.
--- a/src/Player.cc Thu Dec 04 21:59:23 2008 +0000
+++ b/src/Player.cc Thu Dec 04 22:02:20 2008 +0000
@@ -29,7 +29,7 @@
float shotspeed = 100*PHYSICS_TICK_MS;
Vector shotRelativeVelocity = unitVectorAim * shotspeed;
Vector shotVelocity = this->velocity + shotRelativeVelocity;
- world.addProjectile(new Shot(this->state, this->position, shotVelocity, true));
+ world.addProjectile(new Projectile(this->state, this->position, shotVelocity, true));
}
void Player::handleMove (PlayerInput_Move input) {
@@ -59,10 +59,10 @@
}
if (input & INPUT_MOVE_DIG) {
- // Should create Shot which destroys ground, but also should be destroyed then,
+ // Should create Projectile which destroys ground, but also should be destroyed then,
// but it doesn't.
// But this now just segfaults
-// world.addObject(new Shot(state, position, true));
+// world.addObject(new Projectile(state, position, true));
handleDig(position, 15);
}
--- a/src/Projectile.cc Thu Dec 04 21:59:23 2008 +0000
+++ b/src/Projectile.cc Thu Dec 04 22:02:20 2008 +0000
@@ -1,6 +1,6 @@
#include "Projectile.hh"
-Shot::Shot(GameState &state, Vector position, Vector velocity, bool visible) :
+Projectile::Projectile(GameState &state, Vector position, Vector velocity, bool visible) :
PhysicsObject(state.world, PLAYER_MASS, position, velocity), state(state), visible(visible), destroyed(false) {
// Looks kind of dumb, for ammunition to have shape
std::vector<Vector> shape(4);
@@ -15,16 +15,16 @@
}
-void Shot::onCollision() {
+void Projectile::onCollision() {
world.removeGround(position, 20);
this->destroyed = true;
}
-bool Shot::isDestroyed (void) {
+bool Projectile::isDestroyed (void) {
return this->destroyed;
}
-void Shot::draw(CL_GraphicContext *gc) {
+void Projectile::draw(CL_GraphicContext *gc) {
CL_Quad player(
--- a/src/Projectile.hh Thu Dec 04 21:59:23 2008 +0000
+++ b/src/Projectile.hh Thu Dec 04 22:02:20 2008 +0000
@@ -1,12 +1,12 @@
#ifndef PROJECTILE_HH
#define PROJECTILE_HH
-class Shot;
+class Projectile;
#include "PhysicsObject.hh"
#include "GameState.hh"
-class Shot : public PhysicsObject {
+class Projectile : public PhysicsObject {
protected:
GameState &state;
bool visible;
@@ -15,7 +15,7 @@
bool target_visible;
bool destroyed;
public:
- Shot(GameState &state, Vector position, Vector velocity, bool visible);
+ Projectile(GameState &state, Vector position, Vector velocity, bool visible);
bool isDestroyed (void);
virtual void draw(CL_GraphicContext *gc);