diff options
author | megamage <none@none> | 2009-04-21 12:55:26 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-21 12:55:26 -0500 |
commit | 4e1143c990154e2dc52ddacdc522f89e455338cc (patch) | |
tree | ce87b2c4db3e7978330cc759fc344992e994c5b9 /src/game/Vehicle.h | |
parent | 9e46994506616bc4ffd6aa84267c785e833bbc87 (diff) |
*Fix a crash of vehicle.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Vehicle.h')
-rw-r--r-- | src/game/Vehicle.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/game/Vehicle.h b/src/game/Vehicle.h index c01ca027670..a4dffa9ea03 100644 --- a/src/game/Vehicle.h +++ b/src/game/Vehicle.h @@ -33,7 +33,7 @@ struct VehicleSeat Unit* passenger; }; -typedef std::map<uint32, VehicleSeat> SeatMap; +typedef std::map<int8, VehicleSeat> SeatMap; class Vehicle : public Creature { @@ -52,7 +52,13 @@ class Vehicle : public Creature VehicleEntry const *GetVehicleInfo() { return m_vehicleInfo; } void SetVehicleId(uint32 vehicleid); - void AddPassenger(Unit *passenger); + bool HasEmptySeat(int8 seatNum) const + { + SeatMap::const_iterator seat = m_Seats.find(seatNum); + if(seat == m_Seats.end()) return false; + return !seat->second.passenger; + } + bool AddPassenger(Unit *passenger, int8 seatNum = -1); void RemovePassenger(Unit *passenger); void Dismiss(); @@ -62,6 +68,8 @@ class Vehicle : public Creature protected: VehicleEntry const *m_vehicleInfo; + void RemoveAllPassengers(); + private: void SaveToDB(uint32, uint8) // overwrited of Creature::SaveToDB - don't must be called { |