00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00030 #if !defined(FSTypes_h)
00031 #define FSTypes_h
00032
00033 typedef long TechType;
00034 typedef long TransferType;
00035 typedef long HabType;
00036
00037
00038 template<class FwdIter, class ReturnType, class TrinaryOp, class Third> inline
00039 ReturnType accumulate(FwdIter First, FwdIter Last, ReturnType Initial, TrinaryOp func, Third arg)
00040 {for (; First != Last; ++First)
00041 Initial = func(Initial, *First, arg);
00042 return (Initial); }
00043
00044
00045 template <class _RandomAccessIter>
00046 inline void Random_Shuffle(_RandomAccessIter __first,
00047 _RandomAccessIter __last) {
00048 if (__first == __last) return;
00049 for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
00050 iter_swap(__i, __first + genrand_int32() % (__i - __first + 1));
00051 }
00052
00053
00054 #define FREESTARSVERSION 0.1 // overall version
00055 #define HOSTFILEVERSION 0.1 // .hst (host) file format
00056 #define RULESFILEVERSION 0.1 // rules file format
00057 #define TURNFILEVERSION 0.1 // .m (turn file to player) file format
00058 #define ORDERSFILEVERSION 0.1 // .x (orders file from player) file format
00059 #define XYFILEVERSION 0.1 // .xy (galaxy defination) file format
00060 #define RACEFILEVERSION 0.1 // .r (rade defination) file format
00061
00062 #define epsilon 0.00000001 // difference needed for comparing doubles to be not equal
00063
00064 const long PR_SELF = 4;
00065 const long PR_FRIEND = 3;
00066 const long PR_NEUTRAL = 2;
00067 const long PR_ENEMY = 1;
00068
00069 const TechType NEXT_CHEAP = -5;
00070 const TechType RESEARCH_ALCHEMY = -4;
00071 const TechType NEXT_SAME = -3;
00072 const TechType NEXT_LOW = -2;
00073 const TechType TECH_NONE = -1;
00074
00075 const long MAX_TECH_LEVEL = 26;
00076
00077 const TransferType TRANSFER_NOORDER = 0;
00078 const TransferType TRANSFER_LOADALL = 1;
00079 const TransferType TRANSFER_UNLOADALL = 2;
00080 const TransferType TRANSFER_LOADAMT = 3;
00081 const TransferType TRANSFER_UNLOADAMT = 4;
00082 const TransferType TRANSFER_FILLPER = 5;
00083 const TransferType TRANSFER_WAITPER = 6;
00084 const TransferType TRANSFER_LOADDUNN = 7;
00085 const TransferType TRANSFER_AMOUNTTO = 8;
00086 const TransferType TRANSFER_DESTTO = 9;
00087 const TransferType TRANSFER_SETTOPER = 10;
00088 const TransferType TRANSFER_DROPNLOAD = 11;
00089
00090 typedef unsigned long ComponentType;
00091 const ComponentType CT_NONE = 0x00000000;
00092 const ComponentType CT_ARMOR = 0x00000001;
00093 const ComponentType CT_SHIELD = 0x00000002;
00094 const ComponentType CT_WEAPON = 0x00000004;
00095 const ComponentType CT_BOMB = 0x00000008;
00096 const ComponentType CT_ELEC = 0x00000010;
00097 const ComponentType CT_HULL = 0x00000020;
00098 const ComponentType CT_BASE = 0x00000040;
00099 const ComponentType CT_PLANSCAN = 0x00000080;
00100 const ComponentType CT_DEFENSE = 0x00000100;
00101 const ComponentType CT_TERRAFORM = 0x00000200;
00102 const ComponentType CT_ENGINE = 0x00000400;
00103 const ComponentType CT_MINELAY = 0x00000800;
00104 const ComponentType CT_MINER = 0x00001000;
00105 const ComponentType CT_SCANNER = 0x00002000;
00106 const ComponentType CT_MECH = 0x00004000;
00107 const ComponentType CT_ALCHEMY = 0x00008000;
00108 const ComponentType CT_PLANET_SPECIAL = 0x00010000;
00109 const ComponentType CT_GATE = 0x00020000;
00110 const ComponentType CT_DRIVER = 0x00040000;
00111 const ComponentType CT_PLANETARY = CT_PLANSCAN | CT_DEFENSE | CT_TERRAFORM | CT_PLANET_SPECIAL | CT_ALCHEMY;
00112 const ComponentType CT_ORBITAL = CT_DRIVER | CT_GATE;
00113 const ComponentType CT_ALL = ~CT_NONE;
00114 const ComponentType CT_GENERAL = CT_ALL & ~(CT_BOMB | CT_MINER | CT_ENGINE | CT_ORBITAL | CT_PLANETARY | CT_HULL | CT_BASE);
00115
00116 typedef unsigned long HullType;
00117
00118 const HullType HC_NONE = 0x0000;
00119 const HullType HC_SCOUT = 0x0001;
00120 const HullType HC_LAYER = 0x0002;
00121 const HullType HC_MINICOL = 0x0004;
00122 const HullType HC_WARSHIP = 0x0008;
00123 const HullType HC_BOMBER = 0x0010;
00124 const HullType HC_MINER = 0x0020;
00125 const HullType HC_COLONY = 0x0040;
00126 const HullType HC_FREIGHTER = 0x0080;
00127 const HullType HC_UTILITY = 0x0100;
00128 const HullType HC_FUEL = 0x0200;
00129 const HullType HC_SMALLBASE = 0x0400;
00130 const HullType HC_BIGBASE = 0x0800;
00131 const HullType HC_ARMED = 0x1000;
00132 const HullType HC_UNKNOWN = 0x2000;
00133 const HullType HC_BASE = HC_SMALLBASE | HC_BIGBASE;
00134 const HullType HC_UNARMED = HC_COLONY | HC_MINICOL | HC_FREIGHTER | HC_FUEL | HC_MINER;
00135 const HullType HC_COL = HC_COLONY | HC_MINICOL;
00136 const HullType HC_ALL = ~HC_NONE;
00137
00138
00139
00140 const unsigned long RE_NONE = 0x0000;
00141 const unsigned long RE_MT = 0x0001;
00142 const unsigned long RE_ARTIFACT = 0x0002;
00143 const unsigned long RE_COMET = 0x0004;
00144 const unsigned long RE_WORMHOLE = 0x0008;
00145 const unsigned long RE_ALL = ~RE_NONE;
00146
00147
00148 const unsigned long PPS_NONE = 0x0000;
00149 const unsigned long PPS_PLANET = 0x0001;
00150 const unsigned long PPS_BASES = 0x0002;
00151 const unsigned long PPS_UNARM = 0x0004;
00152 const unsigned long PPS_ESCORT = 0x0008;
00153 const unsigned long PPS_CAPSHIP = 0x0010;
00154 const unsigned long PPS_TECH = 0x0020;
00155 const unsigned long PPS_RESOURCE = 0x0040;
00156 const unsigned long PPS_SCORE = 0x0080;
00157 const unsigned long PPS_RANK = 0x0100;
00158 const unsigned long PPS_ALL = ~PPS_NONE;
00159
00160 #endif // !defined(FSTypes_h)