feuerkraft-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Feuerkraft-CVS] rev 302 - in trunk/src: . buildings scripting vehicles


From: Ingo Ruhnke
Subject: [Feuerkraft-CVS] rev 302 - in trunk/src: . buildings scripting vehicles
Date: Sat, 06 Dec 2003 15:49:01 +0100

Author: grumbel
Date: 2003-12-06 15:49:01 +0100 (Sat, 06 Dec 2003)
New Revision: 302

Added:
   trunk/src/vehicles/vehicle.cxx
   trunk/src/vehicles/vehicle.hxx
Removed:
   trunk/src/vehicle.cxx
   trunk/src/vehicle.hxx
Modified:
   trunk/src/Makefile.am
   trunk/src/ai_vehicle.hxx
   trunk/src/buildings/ammotent.cxx
   trunk/src/buildings/building.hxx
   trunk/src/buildings/fuelstation.cxx
   trunk/src/buildings/tower.cxx
   trunk/src/buildings/tower.hxx
   trunk/src/buildings/wall_door.cxx
   trunk/src/projectile.cxx
   trunk/src/radar.cxx
   trunk/src/robot_tank.hxx
   trunk/src/rocket.cxx
   trunk/src/rocket.hxx
   trunk/src/scripting/gameobj_commands.cxx
   trunk/src/scripting/vehicle_commands.cxx
   trunk/src/vehicle_ai.cxx
   trunk/src/vehicle_ai.hxx
   trunk/src/vehicle_status.cxx
   trunk/src/vehicle_view.hxx
   trunk/src/vehicles/Makefile.am
   trunk/src/vehicles/helicopter.hxx
   trunk/src/vehicles/jeep.hxx
   trunk/src/vehicles/tank.hxx
Log:
- moved vehicles.?xx to vehicles/ subdirectory
- added building destruction via rocket

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am       2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/Makefile.am       2003-12-06 14:49:01 UTC (rev 302)
@@ -157,8 +157,6 @@
 unit.cxx \
 vector2d.hxx \
 vector2d.cxx \
-vehicle.cxx \
-vehicle.hxx \
 vehicle_ai.cxx \
 vehicle_ai.hxx \
 vehicle_status.cxx \

Modified: trunk/src/ai_vehicle.hxx
===================================================================
--- trunk/src/ai_vehicle.hxx    2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/ai_vehicle.hxx    2003-12-06 14:49:01 UTC (rev 302)
@@ -27,7 +27,7 @@
 #include "energie.hxx"
 #include "line_segments.hxx"
 #include "sequence_manager.hxx"
-#include "vehicle.hxx"
+#include "vehicles/vehicle.hxx"
 
 class SmokeEmitter;
 class LevelMap;

Modified: trunk/src/buildings/ammotent.cxx
===================================================================
--- trunk/src/buildings/ammotent.cxx    2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/buildings/ammotent.cxx    2003-12-06 14:49:01 UTC (rev 302)
@@ -21,8 +21,8 @@
 #include "../color.hxx"
 #include "../game_obj_manager.hxx"
 #include "../radar.hxx"
-#include "../vehicle.hxx"
 #include "../resource_manager.hxx"
+#include "../vehicles/vehicle.hxx"
 #include "ammotent.hxx"
 
 Ammotent::Ammotent (const AList& lst)

Modified: trunk/src/buildings/building.hxx
===================================================================
--- trunk/src/buildings/building.hxx    2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/buildings/building.hxx    2003-12-06 14:49:01 UTC (rev 302)
@@ -75,6 +75,8 @@
 
   virtual void collide (Projectile*) {}
 
+  virtual void collide (int energie) {}
+
   /** is_at() can be overwritten to provide a more detailed building
       'resolution', so that buildings can be subgrid large 
       FIXME: Looks a bit hack like and doesn't work at polygon level  */

Modified: trunk/src/buildings/fuelstation.cxx
===================================================================
--- trunk/src/buildings/fuelstation.cxx 2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/buildings/fuelstation.cxx 2003-12-06 14:49:01 UTC (rev 302)
@@ -21,7 +21,7 @@
 #include "../game_obj_manager.hxx"
 #include "../color.hxx"
 #include "../radar.hxx"
-#include "../vehicle.hxx"
+#include "../vehicles/vehicle.hxx"
 #include "../resource_manager.hxx"
 #include "fuelstation.hxx"
 

Modified: trunk/src/buildings/tower.cxx
===================================================================
--- trunk/src/buildings/tower.cxx       2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/buildings/tower.cxx       2003-12-06 14:49:01 UTC (rev 302)
@@ -111,13 +111,24 @@
   steering = controller.get_axis_state(ORIENTATION_AXIS);
 }
 
+void
+Tower::collide (int hits)
+{
+  energie -= hits;
+  if (!destroyed && !(energie > 0))
+    {
+      GameWorld::current()->add (new Explosion (pos, Explosion::LARGE));
+      destroyed = true;
+    }
+}
+
 void 
 Tower::collide (Projectile*)
 {
   energie -= 5;   
   if (!destroyed && !(energie > 0))
     {
-      GameWorld::current()->add (new Explosion (pos, Explosion::MEDIUM));
+      GameWorld::current()->add (new Explosion (pos, Explosion::LARGE));
       destroyed = true;
     }
 }

Modified: trunk/src/buildings/tower.hxx
===================================================================
--- trunk/src/buildings/tower.hxx       2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/buildings/tower.hxx       2003-12-06 14:49:01 UTC (rev 302)
@@ -61,6 +61,7 @@
   int get_map_height () { return 2; }
 
   void collide (Projectile*);
+  void collide (int energie);
 
   float get_orientation() const { return orientation; }
   bool alive ();

Modified: trunk/src/buildings/wall_door.cxx
===================================================================
--- trunk/src/buildings/wall_door.cxx   2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/buildings/wall_door.cxx   2003-12-06 14:49:01 UTC (rev 302)
@@ -17,7 +17,7 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#include "../vehicle.hxx"
+#include "../vehicles/vehicle.hxx"
 #include "../view.hxx"
 #include "../game_obj_manager.hxx"
 #include "../resource_manager.hxx"

Modified: trunk/src/projectile.cxx
===================================================================
--- trunk/src/projectile.cxx    2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/projectile.cxx    2003-12-06 14:49:01 UTC (rev 302)
@@ -26,7 +26,7 @@
 #include "buildings/building_map.hxx"
 #include "game_obj_manager.hxx"
 #include "projectile.hxx"
-#include "vehicle.hxx"
+#include "vehicles/vehicle.hxx"
 #include "resource_manager.hxx"
 
 Projectile::Projectile (GameObj* p,

Modified: trunk/src/radar.cxx
===================================================================
--- trunk/src/radar.cxx 2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/radar.cxx 2003-12-06 14:49:01 UTC (rev 302)
@@ -23,7 +23,7 @@
 #include "radar.hxx"
 #include "math.hxx"
 #include "player.hxx"
-#include "vehicle.hxx"
+#include "vehicles/vehicle.hxx"
 #include "resource_manager.hxx"
 
 Radar::Radar(const FloatVector2d& arg_pos, 

Modified: trunk/src/robot_tank.hxx
===================================================================
--- trunk/src/robot_tank.hxx    2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/robot_tank.hxx    2003-12-06 14:49:01 UTC (rev 302)
@@ -21,7 +21,7 @@
 #define HEADER_ROBOT_TANK_HXX
 
 #include "vector2d.hxx"
-#include "vehicle.hxx"
+#include "vehicles/vehicle.hxx"
 
 /** */
 class RobotTank : public Vehicle

Modified: trunk/src/rocket.cxx
===================================================================
--- trunk/src/rocket.cxx        2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/rocket.cxx        2003-12-06 14:49:01 UTC (rev 302)
@@ -22,13 +22,15 @@
 #include "explosion.hxx"
 #include "particles/rocket_smoke_particle.hxx"
 #include "view.hxx"
+#include "buildings/building.hxx"
 #include "rocket.hxx"
 
 Rocket::Rocket(const FloatVector2d& pos, float orientation)
   : pos(pos),
     orientation(orientation),
     velocity(10.0f),
-    max_velocity(50.0f)
+    max_velocity(50.0f),
+    life_time(0)
 {
   sprite = resources->get_sprite("feuerkraft/rocket");
   smoke  = resources->get_sprite("feuerkraft/rocket_smoke");
@@ -56,11 +58,17 @@
   CollisionManager::current()->add_point(get_id(), pos.x, pos.y);
 
   GameWorld::current()->add(new RocketSmokeParticle(pos));
+  life_time += delta;
+  if (life_time > 2.0f)
+    {
+      detonate();
+    }
 }
 
 void
 Rocket::on_collision_with_building(Building* building)
 {
+  building->collide(35);
   detonate();
 }
 

Modified: trunk/src/rocket.hxx
===================================================================
--- trunk/src/rocket.hxx        2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/rocket.hxx        2003-12-06 14:49:01 UTC (rev 302)
@@ -33,6 +33,7 @@
   float orientation;
   float velocity;
   float max_velocity;
+  float life_time;
 public:
   Rocket(const FloatVector2d& pos, float orientation);
   ~Rocket();

Modified: trunk/src/scripting/gameobj_commands.cxx
===================================================================
--- trunk/src/scripting/gameobj_commands.cxx    2003-12-06 14:03:36 UTC (rev 
301)
+++ trunk/src/scripting/gameobj_commands.cxx    2003-12-06 14:49:01 UTC (rev 
302)
@@ -23,7 +23,7 @@
 
 #include "../satchel_charge.hxx"
 #include "../soldier.hxx"
-#include "../vehicle.hxx"
+#include "../vehicles/vehicle.hxx"
 #include "../vehicles/helicopter.hxx"
 #include "../unit.hxx"
 

Modified: trunk/src/scripting/vehicle_commands.cxx
===================================================================
--- trunk/src/scripting/vehicle_commands.cxx    2003-12-06 14:03:36 UTC (rev 
301)
+++ trunk/src/scripting/vehicle_commands.cxx    2003-12-06 14:49:01 UTC (rev 
302)
@@ -18,7 +18,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "../vehicles/helicopter.hxx"
-#include "../vehicle.hxx"
+#include "../vehicles/vehicle.hxx"
 #include "../game_obj_manager.hxx"
 #include "vehicle_commands.hxx"
 

Deleted: trunk/src/vehicle.cxx
===================================================================
--- trunk/src/vehicle.cxx       2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/vehicle.cxx       2003-12-06 14:49:01 UTC (rev 302)
@@ -1,73 +0,0 @@
-//  $Id: vehicle.cxx,v 1.11 2003/10/31 23:24:41 grumbel Exp $
-//
-//  Feuerkraft - A Tank Battle Game
-//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-//  This program is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU General Public License
-//  as published by the Free Software Foundation; either version 2
-//  of the License, or (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#include <iostream>
-#include "input/controller.hxx"
-#include "vehicle.hxx"
-
-Vehicle::Vehicle ()
-  : ammo (1.0f), 
-    fuel (1.0f)
-{
-  acceleration = 0;
-  steering = 0;
-  strafe_steering = 0;
-  firing = false;
-}
-
-float 
-Vehicle::get_ammo ()
-{
-  return ammo;
-}
-
-float 
-Vehicle::get_fuel ()
-{
-  return fuel;
-}
-
-void 
-Vehicle::refuel (float delta)
-{
-  fuel += 0.003 * delta;
-
-  if (fuel > 1.0f)
-    fuel = 1.0f;
-}
-
-void 
-Vehicle::reload_ammo (float delta)
-{
-  ammo += 0.003 * delta;
-
-  if (ammo > 1.0f)
-    ammo = 1.0f;
-}
-
-void
-Vehicle::update_controlls(const Controller& controller)
-{
-  acceleration = -controller.get_axis_state(ACCELERATE_AXIS);
-  steering     = controller.get_axis_state(ORIENTATION_AXIS);
-  strafe_steering = controller.get_axis_state(STRAFE_AXIS);
-  firing       = controller.get_button_state(PRIMARY_FIRE_BUTTON);
-}
-
-/* EOF */

Deleted: trunk/src/vehicle.hxx
===================================================================
--- trunk/src/vehicle.hxx       2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/vehicle.hxx       2003-12-06 14:49:01 UTC (rev 302)
@@ -1,72 +0,0 @@
-//  $Id: vehicle.hxx,v 1.13 2003/06/18 21:43:50 grumbel Exp $
-// 
-//  Feuerkraft - A Tank Battle Game
-//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
-//
-//  This program is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU General Public License
-//  as published by the Free Software Foundation; either version 2
-//  of the License, or (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-// 
-//  You should have received a copy of the GNU General Public License
-//  along with this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#ifndef VEHICLE_HH
-#define VEHICLE_HH
-
-#include "unit.hxx"
-
-class Controller;
-class Projectile;
-
-class Vehicle : public Unit
-{
-protected:
-  float velocity;
-
-  float ammo;
-  float fuel;
-
-  // Controll variables
-  float acceleration;
-  float steering;
-  float strafe_steering;
-  
-  bool firing;
-public:
-  Vehicle ();
-  virtual ~Vehicle () {}
-
-  virtual void update_controlls(const Controller&);
-
-  virtual float get_velocity() { return velocity; }
-
-  /** Sets the current turn of the vehicle, \a turn needs to be in
-      range of [-1.0, 1.0] */
-  void set_turn(float turn);
-
-  /** Sets the current acceleration, \a accel must be in range of
-      [-1.0, 1.0] (full break, full acceleration) */
-  void set_acceleration(float accel);
-
-  virtual float get_ammo();
-  virtual float get_fuel();
-
-  virtual void  refuel(float delta);
-  virtual void  reload_ammo(float delta);
-
-  virtual void collide (Projectile*) {}
-};
-
-typedef Vehicle* VehiclePtr;
-
-#endif
-
-/* EOF */
-

Modified: trunk/src/vehicle_ai.cxx
===================================================================
--- trunk/src/vehicle_ai.cxx    2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/vehicle_ai.cxx    2003-12-06 14:49:01 UTC (rev 302)
@@ -18,7 +18,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "math.hxx"
-#include "vehicle.hxx"
+#include "vehicles/vehicle.hxx"
 #include "vehicle_ai.hxx"
 
 VehicleAI::VehicleAI(Vehicle* arg_vehicle)

Modified: trunk/src/vehicle_ai.hxx
===================================================================
--- trunk/src/vehicle_ai.hxx    2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/vehicle_ai.hxx    2003-12-06 14:49:01 UTC (rev 302)
@@ -23,7 +23,7 @@
 #include "line_segments.hxx"
 #include "input/controller.hxx"
 #include "ai.hxx"
-#include "vehicle.hxx"
+#include "vehicles/vehicle.hxx"
 
 /** class for AI driven vehicles */
 class VehicleAI : public AI

Modified: trunk/src/vehicle_status.cxx
===================================================================
--- trunk/src/vehicle_status.cxx        2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/vehicle_status.cxx        2003-12-06 14:49:01 UTC (rev 302)
@@ -20,7 +20,7 @@
 #include <ClanLib/Display/display.h>
 #include "resource_manager.hxx"
 #include "player.hxx"
-#include "vehicle.hxx"
+#include "vehicles/vehicle.hxx"
 #include "vehicle_status.hxx"
 
 extern Player* player;

Modified: trunk/src/vehicle_view.hxx
===================================================================
--- trunk/src/vehicle_view.hxx  2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/vehicle_view.hxx  2003-12-06 14:49:01 UTC (rev 302)
@@ -20,7 +20,7 @@
 #ifndef HEADER_FEUERKRAFT_VEHICLEVIEWUPDATER_HH
 #define HEADER_FEUERKRAFT_VEHICLEVIEWUPDATER_HH
 
-#include "vehicle.hxx"
+#include "vehicles/vehicle.hxx"
 #include "view.hxx"
 
 // FIXME: Rename to UnitViewUpdater

Modified: trunk/src/vehicles/Makefile.am
===================================================================
--- trunk/src/vehicles/Makefile.am      2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/vehicles/Makefile.am      2003-12-06 14:49:01 UTC (rev 302)
@@ -5,6 +5,8 @@
   helicopter.cxx helicopter.hxx \
   jeep.cxx   jeep.hxx \
   turret.cxx turret.hxx \
-  rotor.cxx  rotor.hxx
+  rotor.cxx  rotor.hxx \
+  vehicle.cxx \
+  vehicle.hxx
 
 # EOF #

Modified: trunk/src/vehicles/helicopter.hxx
===================================================================
--- trunk/src/vehicles/helicopter.hxx   2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/vehicles/helicopter.hxx   2003-12-06 14:49:01 UTC (rev 302)
@@ -22,7 +22,7 @@
 
 #include <ClanLib/Display/sprite.h>
 #include "../energie.hxx"
-#include "../vehicle.hxx"
+#include "vehicle.hxx"
 #include "rotor.hxx"
 
 class VehicleAI;

Modified: trunk/src/vehicles/jeep.hxx
===================================================================
--- trunk/src/vehicles/jeep.hxx 2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/vehicles/jeep.hxx 2003-12-06 14:49:01 UTC (rev 302)
@@ -22,8 +22,8 @@
 
 #include <ClanLib/Display/sprite.h>
 
-#include "../vehicle.hxx"
 #include "../energie.hxx"
+#include "vehicle.hxx"
 
 class Projectile;
 

Modified: trunk/src/vehicles/tank.hxx
===================================================================
--- trunk/src/vehicles/tank.hxx 2003-12-06 14:03:36 UTC (rev 301)
+++ trunk/src/vehicles/tank.hxx 2003-12-06 14:49:01 UTC (rev 302)
@@ -26,7 +26,7 @@
 
 #include "../mine.hxx"
 #include "../energie.hxx"
-#include "../vehicle.hxx"
+#include "vehicle.hxx"
 
 /** \defgroup units Units - Player Controllable GameObjs */
 

Copied: trunk/src/vehicles/vehicle.cxx (from rev 298, trunk/src/vehicle.cxx)
===================================================================
--- trunk/src/vehicle.cxx       2003-12-01 23:38:25 UTC (rev 298)
+++ trunk/src/vehicles/vehicle.cxx      2003-12-06 14:49:01 UTC (rev 302)
@@ -0,0 +1,73 @@
+//  $Id: vehicle.cxx,v 1.11 2003/10/31 23:24:41 grumbel Exp $
+//
+//  Feuerkraft - A Tank Battle Game
+//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#include <iostream>
+#include "../input/controller.hxx"
+#include "vehicle.hxx"
+
+Vehicle::Vehicle ()
+  : ammo (1.0f), 
+    fuel (1.0f)
+{
+  acceleration = 0;
+  steering = 0;
+  strafe_steering = 0;
+  firing = false;
+}
+
+float 
+Vehicle::get_ammo ()
+{
+  return ammo;
+}
+
+float 
+Vehicle::get_fuel ()
+{
+  return fuel;
+}
+
+void 
+Vehicle::refuel (float delta)
+{
+  fuel += 0.003 * delta;
+
+  if (fuel > 1.0f)
+    fuel = 1.0f;
+}
+
+void 
+Vehicle::reload_ammo (float delta)
+{
+  ammo += 0.003 * delta;
+
+  if (ammo > 1.0f)
+    ammo = 1.0f;
+}
+
+void
+Vehicle::update_controlls(const Controller& controller)
+{
+  acceleration = -controller.get_axis_state(ACCELERATE_AXIS);
+  steering     = controller.get_axis_state(ORIENTATION_AXIS);
+  strafe_steering = controller.get_axis_state(STRAFE_AXIS);
+  firing       = controller.get_button_state(PRIMARY_FIRE_BUTTON);
+}
+
+/* EOF */

Copied: trunk/src/vehicles/vehicle.hxx (from rev 298, trunk/src/vehicle.hxx)
===================================================================
--- trunk/src/vehicle.hxx       2003-12-01 23:38:25 UTC (rev 298)
+++ trunk/src/vehicles/vehicle.hxx      2003-12-06 14:49:01 UTC (rev 302)
@@ -0,0 +1,72 @@
+//  $Id: vehicle.hxx,v 1.13 2003/06/18 21:43:50 grumbel Exp $
+// 
+//  Feuerkraft - A Tank Battle Game
+//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#ifndef VEHICLE_HH
+#define VEHICLE_HH
+
+#include "../unit.hxx"
+
+class Controller;
+class Projectile;
+
+class Vehicle : public Unit
+{
+protected:
+  float velocity;
+
+  float ammo;
+  float fuel;
+
+  // Controll variables
+  float acceleration;
+  float steering;
+  float strafe_steering;
+  
+  bool firing;
+public:
+  Vehicle ();
+  virtual ~Vehicle () {}
+
+  virtual void update_controlls(const Controller&);
+
+  virtual float get_velocity() { return velocity; }
+
+  /** Sets the current turn of the vehicle, \a turn needs to be in
+      range of [-1.0, 1.0] */
+  void set_turn(float turn);
+
+  /** Sets the current acceleration, \a accel must be in range of
+      [-1.0, 1.0] (full break, full acceleration) */
+  void set_acceleration(float accel);
+
+  virtual float get_ammo();
+  virtual float get_fuel();
+
+  virtual void  refuel(float delta);
+  virtual void  reload_ammo(float delta);
+
+  virtual void collide (Projectile*) {}
+};
+
+typedef Vehicle* VehiclePtr;
+
+#endif
+
+/* EOF */
+





reply via email to

[Prev in Thread] Current Thread [Next in Thread]