1 |
cycrow |
1 |
// X3Data.h: interface for the CX3Data class.
|
|
|
2 |
//
|
|
|
3 |
//////////////////////////////////////////////////////////////////////
|
|
|
4 |
|
|
|
5 |
#if !defined(AFX_X3DATA_H__491F0DBE_1AE5_4956_B262_F2D1B0D0E9FF__INCLUDED_)
|
|
|
6 |
#define AFX_X3DATA_H__491F0DBE_1AE5_4956_B262_F2D1B0D0E9FF__INCLUDED_
|
|
|
7 |
|
242 |
cycrow |
8 |
#include <Utils/WStringList.h>
|
1 |
cycrow |
9 |
|
242 |
cycrow |
10 |
Utils::WString GetEndOfLine(FILE* id, int* line, bool upper);
|
|
|
11 |
|
1 |
cycrow |
12 |
#if _MSC_VER > 1000
|
|
|
13 |
#pragma once
|
|
|
14 |
#endif // _MSC_VER > 1000
|
|
|
15 |
|
|
|
16 |
#define DATA_LOCKED m_bLocked = true;
|
|
|
17 |
#define DATA_UNLOCKED m_bLocked = false;
|
|
|
18 |
|
|
|
19 |
enum Rep { REP_TRADE, REP_FIGHT, REP_ARGON, REP_BORON, REP_SPLIT, REP_PARANID, REP_TELADI, REP_GONER, REP_TERRAN, REP_ATF, REP_PIRATES, REP_YAKI };
|
|
|
20 |
enum ShipClass { CLASS_M1, CLASS_M2, CLASS_M3, CLASS_M4, CLASS_M5, CLASS_M6, CLASS_M7, CLASS_M8, CLASS_TP, CLASS_TS, CLASS_TM, CLASS_TL };
|
|
|
21 |
#define MAXRACEREP 12
|
|
|
22 |
#define MAXSHIPCLASS 12
|
|
|
23 |
|
|
|
24 |
typedef struct SShip {
|
|
|
25 |
void Reset() { sName = sID = sClass = sEnv = ""; iSpeed = 0; }
|
242 |
cycrow |
26 |
Utils::WString sName;
|
|
|
27 |
Utils::WString sID;
|
|
|
28 |
Utils::WString sClass;
|
|
|
29 |
Utils::WString sEnv;
|
1 |
cycrow |
30 |
int iSpeed;
|
|
|
31 |
} SShip;
|
|
|
32 |
|
|
|
33 |
typedef struct STarget : public SShip {
|
|
|
34 |
void Reset() { SShip::Reset(); iShields = iHull = iDist = 0; sRelation = ""; }
|
|
|
35 |
int iShields;
|
|
|
36 |
int iHull;
|
242 |
cycrow |
37 |
Utils::WString sRelation;
|
1 |
cycrow |
38 |
int iDist;
|
|
|
39 |
} STarget;
|
|
|
40 |
|
|
|
41 |
typedef struct SRaceRep {
|
|
|
42 |
void Reset() { sRace = ""; iRep = 0; iRepPct = 0; sRank = ""; bIncludeRace = false; }
|
242 |
cycrow |
43 |
Utils::WString sRace;
|
|
|
44 |
Utils::WString sRank;
|
1 |
cycrow |
45 |
int iRep;
|
|
|
46 |
int iRepPct;
|
|
|
47 |
bool bIncludeRace;
|
|
|
48 |
} SRaceRep;
|
|
|
49 |
|
|
|
50 |
class CX3Data
|
|
|
51 |
{
|
|
|
52 |
public:
|
242 |
cycrow |
53 |
bool readFile(const Utils::WString &, const Utils::WString &);
|
1 |
cycrow |
54 |
|
|
|
55 |
// get strings
|
|
|
56 |
bool IsLocked () { return m_bLocked; }
|
|
|
57 |
SShip &GetShipData () { return m_shipData; }
|
|
|
58 |
STarget &GetTargetData () { return m_targetData; }
|
242 |
cycrow |
59 |
const Utils::WString &pilot () const { return m_sPilot; }
|
|
|
60 |
const Utils::WString &shipId() const { return m_shipData.sID; }
|
1 |
cycrow |
61 |
int GetShipsNum () { return m_iShips; }
|
|
|
62 |
int GetStations () { return m_iStations; }
|
242 |
cycrow |
63 |
const Utils::WString &credits () const { return m_sAccount; }
|
|
|
64 |
const Utils::WString &gameTime () const { return m_sGametime; }
|
|
|
65 |
const Utils::WString &shipName () const { return m_shipData.sName; }
|
|
|
66 |
const Utils::WString &shipEnv () const { return m_shipData.sEnv; }
|
1 |
cycrow |
67 |
int GetShipClass (int s_class) { return m_iShipClass[s_class]; }
|
|
|
68 |
SRaceRep &GetRaceRep (int race) { return m_Rep[race]; }
|
242 |
cycrow |
69 |
bool HasTarget () const { return (m_targetData.sName.empty()) ? false : true; }
|
|
|
70 |
Utils::WString target () const { return (!HasTarget()) ? L"No Target" : m_targetData.sName; }
|
|
|
71 |
const Utils::WString &targetRelation() { return m_targetData.sRelation; }
|
|
|
72 |
Utils::WString GetTargetDistanceStr()
|
1 |
cycrow |
73 |
{
|
|
|
74 |
int dist = m_targetData.iDist;
|
|
|
75 |
if ( dist > 900 )
|
|
|
76 |
{
|
|
|
77 |
float fDist = (float)dist / 1000.0f;
|
242 |
cycrow |
78 |
return Utils::WString::FromFloat(fDist, 1) + L"Km";
|
1 |
cycrow |
79 |
}
|
242 |
cycrow |
80 |
return Utils::WString::Number(dist) + L"m";
|
1 |
cycrow |
81 |
}
|
|
|
82 |
int GetHull () { return m_iHull; }
|
|
|
83 |
int GetShields () { return m_iShields; }
|
|
|
84 |
int GetWeaponEnergy () { return m_iLaserProgress; }
|
|
|
85 |
int GetMySpeed () { return m_shipData.iSpeed; }
|
|
|
86 |
int GetTargetSpeed () { return m_targetData.iSpeed; }
|
|
|
87 |
int GetTargetDistance () { return m_targetData.iDist; }
|
|
|
88 |
int GetTargetHull () { return m_targetData.iHull; }
|
|
|
89 |
int GetTargetShield () { return m_targetData.iShields; }
|
|
|
90 |
int GetEnemies () { return m_iEnemies; }
|
|
|
91 |
int GetEnemies2 () { return m_iEnemies2; }
|
|
|
92 |
int GetMissiles () { return m_iMissiles; }
|
|
|
93 |
int GetInsurance () { return m_iInsurance; }
|
|
|
94 |
int GetVersion () { return m_iVersion; }
|
242 |
cycrow |
95 |
Utils::WString myShip () const { return (m_shipData.sName.empty()) ? L"No Ship" : (m_shipData.sName + L" (" + m_shipData.sID + L") [" + m_shipData.sClass + L"] / " + m_shipData.sEnv); }
|
|
|
96 |
Utils::WString myTarget () const { return (!HasTarget()) ? L"No Target" : (m_targetData.sName + L" (" + m_targetData.sID + L") [" + m_targetData.sClass + L"]"); }
|
1 |
cycrow |
97 |
|
242 |
cycrow |
98 |
const Utils::WStringList &customFiles () const { return _lCustomFile; }
|
|
|
99 |
const Utils::WStringList &customList () const { return _lCustomList; }
|
1 |
cycrow |
100 |
|
|
|
101 |
// set strings
|
|
|
102 |
void Reset ();
|
242 |
cycrow |
103 |
void setGameName(const Utils::WString &name) { m_sGameName = name; }
|
|
|
104 |
void setGameDirectory(const Utils::WString &name) { m_sGameDir = name; }
|
1 |
cycrow |
105 |
|
242 |
cycrow |
106 |
const Utils::WString &GetGameName() const { return m_sGameName; }
|
|
|
107 |
const Utils::WString& GetProgDir() const { return m_sProgDir; }
|
|
|
108 |
const Utils::WString& GetGameDirectory() const { return m_sGameDir; }
|
1 |
cycrow |
109 |
|
242 |
cycrow |
110 |
CX3Data(const Utils::WString &progDir);
|
1 |
cycrow |
111 |
virtual ~CX3Data();
|
|
|
112 |
|
242 |
cycrow |
113 |
void setRaceRep(int rep, const Utils::WString &race, const Utils::WString &rest, bool old = false);
|
1 |
cycrow |
114 |
|
|
|
115 |
private:
|
242 |
cycrow |
116 |
Utils::WString _getRepPercentage(const Utils::WString &rank) const;
|
|
|
117 |
Utils::WString _getRankPercentage(const Utils::WString &rank) const;
|
1 |
cycrow |
118 |
|
|
|
119 |
// data locking
|
|
|
120 |
bool m_bLocked;
|
|
|
121 |
|
|
|
122 |
// my ship data
|
|
|
123 |
SShip m_shipData;
|
|
|
124 |
// my targets data
|
|
|
125 |
STarget m_targetData;
|
|
|
126 |
|
|
|
127 |
// pilot info
|
242 |
cycrow |
128 |
Utils::WString m_sPilot;
|
1 |
cycrow |
129 |
int m_iShips;
|
|
|
130 |
int m_iStations;
|
|
|
131 |
int m_iAccount;
|
|
|
132 |
int m_iInsurance;
|
|
|
133 |
int m_iShipClass[MAXSHIPCLASS];
|
|
|
134 |
// main ship information
|
|
|
135 |
int m_iHull;
|
|
|
136 |
int m_iShields;
|
|
|
137 |
int m_iLaser;
|
|
|
138 |
int m_iMaxLaser;
|
|
|
139 |
int m_iLaserProgress;
|
|
|
140 |
int m_iMissiles;
|
|
|
141 |
int m_iEnemies;
|
|
|
142 |
int m_iEnemies2;
|
|
|
143 |
int m_iVersion;
|
|
|
144 |
int m_iLastUpdate;
|
|
|
145 |
|
242 |
cycrow |
146 |
Utils::WString m_sAccount;
|
|
|
147 |
Utils::WString m_sGametime;
|
|
|
148 |
Utils::WString m_sShipEnv;
|
1 |
cycrow |
149 |
SRaceRep m_Rep[MAXRACEREP];
|
242 |
cycrow |
150 |
Utils::WString m_sGameName;
|
|
|
151 |
Utils::WString m_sGameDir;
|
|
|
152 |
Utils::WString m_sProgDir;
|
1 |
cycrow |
153 |
|
|
|
154 |
bool m_bLoaded;
|
|
|
155 |
|
242 |
cycrow |
156 |
Utils::WStringList _lCustomList;
|
|
|
157 |
Utils::WStringList _lCustomFile;
|
1 |
cycrow |
158 |
};
|
|
|
159 |
|
|
|
160 |
#endif // !defined(AFX_X3DATA_H__491F0DBE_1AE5_4956_B262_F2D1B0D0E9FF__INCLUDED_)
|