VehicleSprite.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 5 -*- */
00002 
00003 /*
00004  * Combination of a first person action and a real time strategy battle game.
00005  */
00006  
00007 /*
00008  * VehicleSprite.h
00009  * MetalWarriors
00010  * $Revision: 1.9 $
00011  *
00012  * Created by Daniel Aarno on Thu Oct 30 2003.
00013  * Copyright (c) 2003 Daniel Aarno and Erik Ytterberg - All rights reserved.
00014  *
00015  *     This program is free software; you can redistribute it and/or modify
00016  *     it under the terms of the GNU General Public License as published by
00017  *     the Free Software Foundation; either version 2 of the License, or
00018  *     (at your option) any later version.
00019  *
00020  *     This program is distributed in the hope that it will be useful,
00021  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *     GNU General Public License for more details.
00024  *
00025  *     You should have received a copy of the GNU General Public License
00026  *     along with this program; if not, write to the Free Software
00027  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00028  */
00029 
00030 #ifndef VEHICLESPRITE_H
00031 #define VEHICLESPRITE_H
00032 
00033 #include "Sprite.h"
00034 #include "Driver.h"
00035 
00036 class VehicleSprite : public Sprite
00037 {
00038 protected:
00039      class KeyDriver *driver;
00040      class VehicleGroup *group;
00041      std::string name;
00042  
00043 public:
00044      float health;
00045 
00046      VehicleSprite(void) : driver(NULL), group(NULL) {} 
00047      virtual void setAccelerate(bool b) = 0;
00048      virtual void setSlowDown(bool b) = 0;
00049      virtual void setTurnLeft(bool b) = 0;
00050      virtual void setTurnRight(bool b) = 0;
00051      virtual void stop();
00052   
00053      virtual class VehicleGroup *getGroup(void) {return group;}
00054      virtual void setGroup(class VehicleGroup *new_group) {group = new_group;}
00055 
00056      virtual class KeyDriver *allocDriver(void)
00057      {driver = new class KeyDriver; return driver;}
00058      virtual class KeyDriver *getDriver(void) {return driver;}
00059 
00060      virtual class AutoDriver *getAutoDriver(void) {return new AutoDriver;}
00061      virtual class AutoGunner *getAutoGunner(void) {return NULL;}
00062 
00063      // Returns the desired size of the hud, 0 means use default size.
00064      virtual void getHudSize(int *w, int *h) {*w = 0; *h = 0;}
00065      // Returns number of newlines in hudString, 0 indicates that the vehicle
00066      // will paint the hud itself.
00067      virtual int paintHud(std::string &hudString) {return 0;}
00068      virtual std::string getName() {return name;}
00069      virtual void setName(std::string new_name) {name = new_name;}
00070 };
00071 
00072 inline void VehicleSprite::stop()
00073 {
00074      setAccelerate(false);
00075      setTurnRight(false);
00076      setTurnLeft(false);
00077 }
00078 
00079 #endif /*VEHICLESPRITE_H*/

Generated on Sun Mar 11 15:33:23 2007 for MetalWarriors by  doxygen 1.4.7