space.h
rogue25b3/src/space.h · 4.1 KB
From the archive rogue25b3.tar.gz
Download the archive « Back to the archive contents
/***************************************************************************\
[*] ___ ____ ____ __ __ ____ [*] ROGUE: ROM With Attitude [*]
[*] /#/ ) /#/ ) /#/ ) /#/ /#/ /#/ [*] All rights reserved [*]
[*] /#/ < /#/ / /#/ _ /#/ /#/ /#/-- [*] Copyright(C) 2000-2001 [*]
[*] /#/ \(#(__/ (#(__/ (#(__/#/ (#(___ [*] Kenneth Conley (Mendanbar) [*]
[*] Expression of Digital Creativity.. [*] roguemud@yahoogroups.com [*]
[-]---------------------------------------+-+-----------------------------[-]
[*] File: space.h [*]
[*] Usage: Space and Vehicle Module [*]
\***************************************************************************/
#include "stl.llist.h"
// Definitions
#define MAX_SHIP_ROOMS 25
// Types
enum StellarObjectType {
Star,
Planet,
SpacePlatform
};
// Class Data
class ShipData {
public:
ShipData(void);
~ShipData(void);
ROOM_INDEX_DATA * in_room;
ROOM_INDEX_DATA * pilotseat;
ROOM_INDEX_DATA * gunseat;
ROOM_INDEX_DATA * viewscreen;
ROOM_INDEX_DATA * engine;
ROOM_INDEX_DATA * entrance;
ShipData * target;
ShipData * following;
StarSystem * jumpSystem;
StarSystem * starsystem;
char * name;
char * home;
char * owner;
char * pilot;
char * copilot;
char * filename;
char * destination;
char * description[MAX_SHIP_ROOMS];
SInt8 age;
SInt32 type; // mob, player, public
SInt32 size; // fighter, frigate, capital
SInt32 model; // starfighter, transport
SInt32 shipclass; // spacecraft, vehicle, station
SInt16 realSpeed;
SInt16 hyperSpeed;
SInt16 hyperDistance;
SInt16 speed;
SInt32 state;
SInt32 manuever;
bool hatch;
bool purged;
float vx, vy, vz;
float hx, hy, hz;
float jx, jy, jz;
SInt32 hull;
SInt32 maxhull;
SInt32 shield;
SInt32 maxshield;
SInt32 energy;
SInt32 maxenergy;
SInt32 lastdoc;
SInt32 shipyard;
SInt32 location;
VNum clan;
Flags flags;
LList<ROOM_INDEX_DATA *> rooms;
// Utility Functions
inline void Purge() { purged = true; }
bool Purged() { return this->purged; }
inline void ToggleHatch() { hatch = !hatch; }
bool IsCloaked(void);
bool CanSee(ShipData *target);
bool AutoPilot(void);
void Move(void);
void Update(void);
void Appear(void);
void Extract(void);
void Land(void);
void Hyper(void);
void Launch(void);
void Destroy(void);
void SetTarget(ShipData *target);
double Distance(ShipData *target);
double Distance(StellarObject *target);
bool load(FILE *fl);
void save(void);
void SaveQue(void);
bool ToRoom(ROOM_INDEX_DATA *room);
void FromRoom(void);
void ToSystem(StarSystem *system);
void FromSystem(void);
SInt32 Send(const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
SInt32 SendCockpit(const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
SInt32 SendComputer(const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
protected:
void Init(void);
};
class StarSystem {
public:
StarSystem(void);
~StarSystem(void);
LList<ShipData *> ships;
LList<StellarObject *> objects;
char * name;
char * filename;
VNum holder; // which clan holds it?
void Update(void);
SInt32 Send(const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
protected:
void Init(void);
};
class StellarObject {
public:
StellarObject(StellarObjectType objectType = SpacePlatform);
~StellarObject(void);
char * name;
char * filename;
VNum clan;
VNum zone;
float size;
StellarObjectType type;
SInt32 habitat;
float gravity;
float x, y, z;
StarSystem * starsystem;
void Update(void);
protected:
void Init(void);
};
void MoveShips(void);
void UpdateSpace(void);
extern LList<ShipData *>ship_list;