home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / tw!21120.zip / TW2.H < prev    next >
C/C++ Source or Header  |  1992-09-22  |  18KB  |  350 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. //      TW2.H -- Tradewars 2 C header file.                                //
  3. //                                                                         //
  4. //      Selected portions of the TW2.H file.                               //
  5. //                                                                         //
  6. //      9/92  More explicit on variable types... ie.  Made sure that       //
  7. //            the 32-bit compiler still uses a word sized integer in most  //
  8. //            cases.                                                       //
  9. //                                                                         //
  10. /////////////////////////////////////////////////////////////////////////////
  11.  
  12. typedef unsigned char Uchar;
  13. typedef unsigned short Uint;
  14. typedef unsigned long Ulong;
  15.  
  16. // 'killed by' definitions..
  17. #define CABAL   -1
  18. #define DELETED -2
  19. #define UNKNOWN -3
  20. #define MINE    -4
  21. #define ACTIVE  -5
  22. #define PIRATES -6
  23.  
  24. /* struct _PLYROPTS
  25.  
  26.     -- boolean switches in player records -- used in struct _PLAYER
  27.  
  28. */
  29.     struct _PLYROPTS
  30.     {
  31.         Uint        Kloak:    1;             // cloaking device
  32.         Uint        Graphics: 2;             // graphics (None, Color,
  33.                                              // C/G w/o msc, C/G w/ music)
  34.         Uint        RTOnNow:  1;             // REAL TIME: using TW now
  35.         Uint        Banished: 1;             // Restricted from plane 0
  36.         Uint        MailWaiting: 1;          // has mail waiting
  37.     };
  38.  
  39. // union _WASCABAL_ used in _TWMAIN (formerly..  prior to ver 11)
  40.  
  41. union _WASCABAL_
  42.     {
  43.         char FreeForUse[23];
  44.         struct _OLDCABAL
  45.             {
  46.                 Uint        regen;           // cabal regeneration
  47.                 Uint        hq;              // cabal HQ location
  48.                 Uint        Secndry;         // secondary force location
  49.                 Uint        loc1;            // location around base #1
  50.                 Uint        loc2;            // location around base #2
  51.                 Uint        loc3;            // location around base #3
  52.                 Uint        loc4;            // location around base #4
  53.                 Uint        loc5;            // location around base #5
  54.                 Uint        loc6;            // location around base #6
  55.                 Uint        type2;           // number of cabal group 2 ftrs
  56.                 Uint        type3;           // number of cabal group 3 ftrs
  57.                 char        strength;        // cabal strength level 1 - 10
  58.             } OldCabal;
  59.     };
  60.  
  61. // union _WASOPTIONS_  formerly used in _TWMAIN - NOT USED!
  62.  
  63. union _WASOPTIONS_
  64.     {
  65.         int Unused;
  66.         struct _OLDOPTIONS
  67.             {
  68.                 Uint        aliases:  1;     // aliases on/off
  69.                 Uint        network:  1;     // network on/off
  70.                 Uint        news:     1;     // galactic news on/off
  71.                 Uint        debug:    1;     // debug on/off
  72.                 Uint        bbs_type: 4;     // bbs interface type
  73.                 Uint        GMon:     1;     // using GMon??
  74.                 Uint        externm:  1;     // external maintenance
  75.                 Uint        local_password: 1; // ask for local password?
  76.                 Uint        sales:    1;     // sales allowed??
  77.                 Uint        surr:     1;     // surrender allowed?
  78.                 Uint        show_dead: 1;    // show dead in rankings?
  79.                 Uint        MoreThan1K: 1;   // More than 1K sectors?
  80.                 Uint        Restricted: 1;   // restricted access for studs
  81.             } Option;
  82.     };
  83.  
  84. /* struct _TWMAIN
  85.  
  86.     -- file structure of main TW data file
  87.  
  88. */
  89. struct _TWMAIN
  90.     {
  91.         char        EditorPassword[13];      // password used to enter TWEDT
  92.         Uint        StartingYear;            // starting year of game
  93.         Uint        TurnsPerDay;             // turns per day allowed
  94.         Uint        StartingFighters;        // starting fghter amount
  95.         Uint        StartingCredits;         // starting credit amount
  96.         Uint        StartingHolds;           // starting hold amount
  97.         Uint        DaysInactive;            // max days of inactivity
  98.         Uint        LastMaintenance;         // last day of maintenance
  99.         Uint        NewsDays;                // days to save newspaper
  100.         Uint        NewsDeleted;             // last day paper deleted
  101.         float       BankInterest;            // todays bank interest
  102.         Uint        MaxHolds;                // maximum holds allowed in TW
  103.         Uint        MaxOre;                  // max planet prod of ore
  104.         Uint        MaxOrg;                  // max planet prod of org
  105.         Uint        MaxEqp;                  // max planet prod of eqp
  106.         Uint        FighterPrice;            // todays fighter price
  107.         union       _WASOPTIONS_ Old;        //
  108.         Uint        CabalBounty;             // todays cabal bounty
  109.         union       _WASCABAL_ Was;          //
  110.         Uint        AutoLogOff;              // time in minutes before tmout
  111.         Uint        MaxTime;                 // max time in minutes no montr
  112.         char        BBSInfoFile[65];         // file to get BBS info from
  113.         char        RankFileName[65];        // file for player rankings
  114.         char        BBSSysopName[32];        // BBS SysOp name       (n-a-u)
  115.         char        BBSName[41];             // BBS name (not always used)
  116.         char        PortNumber;              // port num (not always used)
  117.         Uint        ModemLockSpeed;          // speed of locked port (n-a-u)
  118.         short       BBSMode;                 // running in bbs mode? y/n (n-u)
  119.         char        ReservedPortionA[67];    // Reserved for use by TW2
  120.         short       TW2Version;              // version number of tw
  121.         char        MaxNodes;                // number of nodes (for chat)
  122.         short       PlanetRecords;           // records in planet file
  123.         short       PlayerRecords;           // records in user file
  124.         short       TeamRecords;             // records in team file
  125.         char        Language[4];             // language file extension
  126.         Uchar       BBSType;                 // BBS type
  127.         Ulong       TWOptions;               // home of options
  128.         long        BanishValue;             // if restrict studs, this Value
  129.         char        TWDirectory[65];         // directory TW data files are in
  130.         short       MaxPlayers;              // maximum player total
  131.         short       InputBuffer;             // input comm buffer
  132.         short       OutputBuffer;            // output comm buffer
  133.         char        NetDirectory[65];        // area for TW2NET.DAT/TW2NET.INC
  134.         char        MsgDirectory[65];        // TW msg base directory
  135.         Uchar       NetNode;                 // TW network node number
  136.         short       Net;                     // Regular network #
  137.         short       Node;                    // Regular node #
  138.         short       NodesInNet;              // Nodes in the network
  139.         char        PackerName[13];          // Network packer filename
  140.         char        PackerOptions[10];       // Packer command options
  141.         char        ChatFileDirectory[65];   // Drive/Directory for chat file
  142.         char        ReservedPortionB[30];    // Reserved for use by TW2
  143.         char        Unused[300];             // not currently in use..
  144.     };
  145.  
  146. /*  struct _PLAYER
  147.  
  148.     -- structure for each record of TWPLAYER.DAT
  149.  
  150. */
  151. struct _PLAYER
  152.     {
  153.         char        RealName[31];            // players real (BBS) name
  154.         char        Alias[31];               // players alias name (if any)
  155.         char        Password[9];             // local password
  156.         struct      _PLYROPTS Options;       // use: Player.Options.etc
  157.         Uint        LastOn;                  // last day on
  158.         short       DestroyedBy;             // player killed by
  159.         Uint        TurnsLeft;               // turns left on last day
  160.         Uint        SectorIn;                // current sector in
  161.         Uint        LastSectorIn;            // last sector in
  162.         Ulong       BankCredits;             // banked credits
  163.         Ulong       Credits;                 // trading credits
  164.         Uint        Fighters;                // fighters w/ ship
  165.         Uint        Mines;                   // mines w/ ship
  166.         Uint        Kloak;                   // cloak days left (if any)
  167.         Uint        Probes;                  // probes w/ ship
  168.         Uint        Holds;                   // holds w/ ship
  169.         Uint        Ore;                     // ore in holds
  170.         Uint        Org;                     // organics in holds
  171.         Uint        Eqp;                     // equipment in holds
  172.         Uint        TeamIn;                  // team in (if any)
  173.         Uint        DayQuitTeam;             // day player quit team
  174.         Uint        TimeUsed;                // time used today
  175.         short       RTAttackBy;              // REAL TIME: attacked by
  176.         Uint        UnusedInt;               // pointer to next lower player
  177.         long        UnusedLong;              // value of player
  178.         Uint        SuperSearch;             // super sector finder onboard
  179.         Uint        RTMessage;               // REAL TIME: radio msg
  180.         Uint        LastMsgRead;             // Last message number read
  181.         char        JustPlainUnused[36];     // not currently in use..
  182.     };
  183.  
  184. /*  struct _SECTOR
  185.  
  186.     -- structure for each record of TWSECTOR.DAT
  187.  
  188. */
  189. struct _SECTOR
  190.     {
  191.         Uint        DefenseForce;            // sector defense force ftr #
  192.         short       DFOwner;                 // owner of those fighters
  193.         Uint        Port;                    // port in sector (if any)
  194.         Uint        Planet;                  // planet in sector (if any)
  195.         Uint        Mine;                    // mine in sector (if any)
  196.         char        InUnion;                 // is sector in union??
  197.         Uint        DefenseOptions;          // Defense Force options
  198.         Uint        OptionWork;              // Work Integer For above
  199.         Uint        MineOptions;             // Mine Programming Options
  200.         Uint        MOWork;                  // Mine Option Work
  201.         char        Unused[31];              // not currently in use..
  202.     };
  203.  
  204. /*  struct _PORT
  205.  
  206.     -- structure for each record of TWPORT.DAT
  207.  
  208. */
  209. struct _PORT
  210.     {
  211.         char        Name[30];                // name of port
  212.         char        Class;                   // class of port 0, 1, 2, 3
  213.         Uint        RecalcDay;               // last day materials recalc'd
  214.         Uint        RecalcMin;               // last min materials recalc'd
  215.         short       OreUnits;                // units of ore
  216.         short       OrgUnits;                // units of organics
  217.         short       EqpUnits;                // units of equipment
  218.         Uint        OreProd;                 // productivity of ore per day
  219.         Uint        OrgProd;                 // productivity of org per day
  220.         Uint        EqpProd;                 // productivity of eqp per day
  221.         short       OreCost;                 // cost of ore %/thsnd units
  222.         short       OrgCost;                 // cost of org %/thsnd units
  223.         short       EqpCost;                 // cost of eqp %/thsnd units
  224.         Uint        OreFract;                // 1/10000's units of ore
  225.         Uint        OrgFract;                // 1/10000's units of organics
  226.         Uint        EqpFract;                // 1/10000's units of eqp
  227.         char        Unused[20];              // not currently in use..
  228.     };
  229.  
  230. /*  struct _PLANET
  231.  
  232.     -- structure for each record of the TWPLANET.DAT file
  233.  
  234. */
  235. struct _PLANET
  236.     {
  237.         char        Name[30];                // name of planet
  238.         Uint        Owner;                   // owner of planet
  239.         Uint        RecalcDay;               // last day materials recalc'd
  240.         Uint        RecalcMin;               // last min materials recalc'd
  241.         Uint        OreUnits;                // amount of ore
  242.         Uint        OrgUnits;                // amount of organics
  243.         Uint        EqpUnits;                // amount of equipment
  244.         Uint        OreProd;                 // productivity of ore
  245.         Uint        OrgProd;                 // productivity of organics
  246.         Uint        EqpProd;                 // productivity of equipment
  247.         Uint        OreFract;                // 1/10000's units of ore
  248.         Uint        OrgFract;                // 1/10000's units of org
  249.         Uint        EqpFract;                // 1/10000's units of eqp
  250.         char        Factory;                 // factory  yes/no
  251.         Uint        Workers;                 // number of workers
  252.         Uint        Pay;                     // pay for each worker per day
  253.         long        Cash;                    // factory cash available
  254.         Uint        FactoryOre;              // factory ore supply
  255.         Uint        FactoryOrg;              // factory organics supply
  256.         Uint        FactoryEqp;              // factory equipment supply
  257.         Uint        FactoryFighters;         // fighter supply
  258.         Uint        DefenseForce;            // Planetary Defense force
  259.         short       DefenseOwner;            // Defense force owner
  260.         Uint        DefenseOptions;          // DF Options
  261.         Uint        OptionWork;              // Option work area
  262.         char        Unused[22];              // not currently in use..
  263.     };
  264.  
  265. struct twcabal    // used in struct _CABAL_
  266.     {
  267.         Uint        Location;                // location of this group
  268.         Uint        Goal;                    // goal of this cabal group
  269.         Uint        Fighters;                // fighters in this group
  270.     };
  271.  
  272. /*  struct _CABAL_
  273.  
  274.     -- file structure for each record of TWCABAL.DAT
  275.  
  276. */
  277. struct _CABAL_
  278.     {
  279.         Uint        Regeneration;            // cabal regeneration
  280.         Uint        Hq;                      // cabal HQ location
  281.         Uint        Secondary;               // secondary force location
  282.         Uint        Location1;               // location around base #1
  283.         Uint        Location2;               // location around base #2
  284.         Uint        Location3;               // location around base #3
  285.         Uint        Location4;               // location around base #4
  286.         Uint        Location5;               // location around base #5
  287.         Uint        Location6;               // location around base #6
  288.         Uint        GroupType2;              // number of cabal group 2 ftrs
  289.         Uint        GroupType3;              // number of cabal group 3 ftrs
  290.         char        Strength;                // cabal strength level 1 - 10
  291.         struct      twcabal Group[50];       // Array of all 50 group locs
  292.     };
  293.  
  294. /*  struct _PLYRMSG
  295.  
  296.     -- file structure for each record of TWPMESS.DAT
  297.  
  298. */
  299. struct _PLYRMSG
  300.     {
  301.         Uint        To;                      // player msg is to and total #
  302.         Uint        Active;                  // is msg active?
  303.         short       From;                    // player who killed above ftrs
  304.         Uint        Destroyed;               // fighters destroyed by above
  305.     };
  306.  
  307. /*  struct _TEAM
  308.  
  309.     -- file structure for each record of TWTEAM.DAT
  310.  
  311. */
  312. struct _TEAM
  313.     {
  314.         char        Name[30];                // name of team
  315.         char        Password[9];             // password to join team
  316.         Uint        Players;                 // number of players on team
  317.         Uint        Captain;                 // active/team captain
  318.     };
  319.  
  320. // General TW2 options  used in _TWMAIN.TWOptions
  321.  
  322. #define ALIASES         0x00000001           // Aliases
  323. #define NETWORK         0x00000002           // Networking
  324. #define NEWS            0x00000004           // News/MsgstoSysop
  325. #define DEBUG           0x00000008           // Debug mode
  326. #define GMON            0x00000010           // GMon
  327. #define EXTERNM         0x00000020           // External Maintenance
  328. #define LOCALPW         0x00000040           // Password entry
  329. #define SALES           0x00000080           // Sales of products
  330. #define SURRENDER       0x00000100           // Surrendering?
  331. #define SHOWDEAD        0x00000200           // Show dead in rankings?
  332. #define RESERVED1       0x00000400
  333. #define RESTRICTED      0x00000800           // restrict good players from plane 0
  334. #define ALLOWKLOAK      0x00001000           // Allow kloaking?
  335. #define KEEPSAVINGS     0x00002000           // keep savings when killed?
  336. #define RESERVED2       0x00004000
  337. #define ISNETWORKED     0x00008000           // in TW network mode?
  338. #define ISNETHOST       0x00010000           // TW network host?
  339. #define NOUNIONATTACKS  0x00020000           // no attacks allowed in Union
  340. #define MUZAKOK         0x00040000           // Local muzak okay??
  341. #define GGGRAPHICSOK    0x00080000           // Local Graphics Okay?
  342. #define COMMITDATA      0x00100000           // commit data to disk?
  343.  
  344. // defense force options - used in Sector & Planet Defense force options
  345. #define TEAMDF      0x0001                   // team defense force
  346. #define ATTACKALL   0x0002                   // Defense force attacks anyone
  347. #define ATTACKNONE  0x0004                   // attacks no one
  348. #define ATTACKTEAM  0x0008                   // attack certain team
  349. #define ATTACKPLYR  0x0010                   // attack certain player
  350.