home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / vmsspace / part04 < prev    next >
Internet Message Format  |  1993-06-06  |  40KB

  1. Path: uunet!mcsun!chsun!pega!dr_who
  2. From: dr_who@pegasus.ch (Sysop of PEGASUS)
  3. Newsgroups: vmsnet.sources.games
  4. Subject: SPCEMP.C   PArt 04/06
  5. Message-ID: <1993Jun7.093222.125@pegasus.ch>
  6. Date: 7 Jun 93 09:32:22 +0200
  7. Organization: Pegasus BBS, Switzerland
  8. Lines: 1406
  9. Xref: uunet vmsnet.sources.games:737
  10.  
  11. ----> START OF PART 4 <----
  12.  
  13. /********************************************************************/
  14. /********************************************************************/
  15. /********************************************************************/
  16. battle_stage()
  17. {
  18. int z,z2,x;
  19. char ostring[80],zstring[80];
  20. unsigned long a_dsend,a_csend,a_ssend,ad_lost,ac_lost,as_lost;
  21. unsigned long f_send,s_send,c_send,y_send,sf_send;
  22. unsigned long f_lost,s_lost,c_lost,y_lost,sf_lost;
  23. unsigned long ed_lost,es_lost,ec_lost,ey_lost,em_lost,esf_lost,ea_lost;
  24. unsigned long ewin,ywin,pcap,pcap2;
  25. unsigned long erat,rat;
  26. unsigned long fmax;
  27. double cpercent;
  28. double mval;
  29. unsigned long tchance;
  30. long bonus=0;
  31. long rubbed=0;
  32.  
  33. if(sol_work==1) 
  34.     {
  35.     printf("\nYour armed forces refuse to fight since you didn't pay them");
  36.     printf("enough.\n");
  37.     return;
  38.     }
  39.  
  40. player[pn].protection = 0;
  41.  
  42. if(!((player[pn].soldiers>0)||(player[pn].fighters>0)||(player[pn].cruisers>0))) 
  43.     return;
  44.  
  45. printf("\nYour armed forces want to know who they should attack this round...\n");
  46.  
  47. if(getplayer()!=FALSE) 
  48.     {
  49.     if((player[epn].governp<=0)&&(player[epn].foodp<=0)&&(player[epn].orep<=0)&&(player[epn].tradep<=0)&&(player[epn].tourismp<=0)&&(player[epn].defensep<=0)) 
  50.         {
  51.         printf("\nThis player has no planets. You can't attack him!\n");
  52.         battle_stage();
  53.         return;
  54.         }
  55.     if(player[epn].protection>0) 
  56.         {
  57.         printf("\nThat player is still under protection.  Attack someone else.\n");
  58.         battle_stage();
  59.         return;
  60.         }
  61.     printf("\nAre you sure you want to attack %s? [y/N] ",player[epn].player);
  62.     gets(ostring);
  63.     ostring[0]=toupper(ostring[0]);
  64.     if(ostring[0]!='Y') 
  65.         {
  66.         battle_stage();
  67.         return;
  68.         }
  69.     f_send=0;
  70.     s_send=0;
  71.     c_send=0;
  72.     y_send=0;
  73.     sf_send=0;
  74.  
  75.     attacking=FALSE;
  76.  
  77.     if(player[pn].soldiers>0) 
  78.         {
  79.         do
  80.          {
  81.           printf("Send how many infantry troops (Maximum of %ld): ",player[pn].soldiers);
  82.           gets(ostring);
  83.           if(strlen(ostring)!=1) 
  84.             sscanf(ostring,"%ld",&s_send);
  85.          }
  86.         while(s_send>player[pn].soldiers);
  87.         }
  88.  
  89.     if( (player[pn].fighters>0) && (player[pn].carriers>0) ) 
  90.         {
  91.         do
  92.          {
  93.           printf("You have %ld carriers, and each may carry 100 fighters.\n",player[pn].carriers);
  94.           fmax = (player[pn].carriers * 100);
  95.           if( fmax > player[pn].fighters ) 
  96.             fmax = player[pn].fighters;
  97.           printf("Send how many X-Wing fighters (Maximum of %ld): ",fmax);
  98.           gets(ostring);
  99.           if(strlen(ostring)!=1) 
  100.             sscanf(ostring,"%ld",&f_send);
  101.          }
  102.         while(f_send>player[pn].fighters);
  103.         }
  104.     
  105.     if((player[pn].ywings>0)&&(player[pn].tech_level>4)) 
  106.         {
  107.         do
  108.          {
  109.           printf("Send how many Y-Wing fighters (Maximum of %ld): ",player[pn].ywings);
  110.           gets(ostring);
  111.           if(strlen(ostring)!=1) 
  112.             sscanf(ostring,"%ld",&y_send);
  113.          }
  114.         while(y_send>player[pn].ywings);
  115.         }
  116.     
  117.     if((player[pn].cruisers>0)&&(player[pn].tech_level>0)) 
  118.         {
  119.         do
  120.          {
  121.           printf("Send how many cruisers (Maximum of %ld): ",player[pn].cruisers);
  122.           gets(ostring);
  123.           if(strlen(ostring)!=1) 
  124.             sscanf(ostring,"%ld",&c_send);
  125.          }
  126.         while(c_send>player[pn].cruisers);
  127.         }
  128.     if((player[pn].starfighters>0)&&(player[pn].tech_level>70-(race[player[pn].race].knowledge*3))) 
  129.         {
  130.         do
  131.          {
  132.           printf("Send how many Imperial Starfighters (Maximum of %ld): ",player[pn].starfighters);
  133.           gets(ostring);
  134.           if(strlen(ostring)!=1) 
  135.             sscanf(ostring,"%ld",&sf_send);
  136.          }
  137.         while(sf_send>player[pn].starfighters);
  138.         }
  139.  
  140.  
  141.     printf("\nYour army's morale is %s.\n",harmony_level(1,player[pn].morale));
  142.  
  143.     /* Base calculations */
  144.  
  145.     ywin = y_send*3 + c_send*4 + f_send*2 + s_send + player[pn].defensep*20 + player[pn].starfighters*10;
  146.     ewin = player[epn].ywings*4 + player[epn].cruisers*4 + player[epn].defense*2 + player[epn].soldiers + player[epn].defensep*22 + 50 + player[epn].starfighters*10;
  147.     if (player[epn].tech_level>10)
  148.         ewin=ewin+(player[epn].defense*3);
  149.     if (player[epn].tech_level>20)
  150.         ewin=ewin+(player[epn].defense*3);
  151.  
  152.  
  153.     /* Soldiers vs. other weapons adjustment. */
  154.  
  155.     if(s_send < (c_send+f_send+y_send+sf_send*100)) 
  156.         ywin = ywin - ((c_send+f_send+y_send)-s_send-(sf_send*8));
  157.     if(player[epn].soldiers < (player[epn].cruisers+player[epn].defense+player[epn].ywings+player[epn].starfighters*100)) 
  158.         ewin = ewin - ((player[epn].cruisers+player[epn].defense+player[epn].ywings)-player[epn].soldiers-(player[epn].starfighters*8));
  159.  
  160.     /* Mutual defense forces adjustment */
  161. /*****
  162.     if(e_team_num!=0) 
  163.         {
  164.         a_ssend=team[player[z].team_num].team_soldiers;
  165.         a_csend=team[player[z].team_num].team_cruisers;
  166.         a_dsend=team[player[z].team_num].team_defense;
  167.         if(a_ssend>0L) a_ssend = a_ssend/team[player[z].team_num].members;
  168.         if(a_csend>0L) a_ssend = a_csend/team[player[z].team_num].members;
  169.         if(a_dsend>0L) a_ssend = a_dsend/team[player[z].team_num].members;
  170.         if((a_ssend>0L)&&(a_csend>0L)&&(a_dsend>0L)) 
  171.             {
  172.             sendmessage("Defense forces from your enemy's alliance arrive!",1);
  173.             ewin = ewin + (a_csend*4L) + (a_dsend*2L) + (a_ssend);
  174.             }
  175.         }
  176. *****/
  177.     /* Morale adjustment */
  178.  
  179.     mval = (100 + player[pn].morale) * 0.01;
  180.     if(mval<0.5) mval = 0.5;
  181.     if(mval>2.0) mval = 2.0;
  182.     ywin = ywin * mval;
  183.     ywin =( ywin * ((race[player[pn].race].strength+race[player[pn].race].knowledge)))/10;   /*RACE*/
  184.  
  185.     /* death-star adjustments - each makes the army 10 % stronger */
  186.     ywin =  ((10+player[pn].deathstars)*ywin)/10;
  187.  
  188.     mval = (100 + player[epn].morale) * 0.01;
  189.     if(mval<0.5) mval = 0.5;
  190.     if(mval>2.0) mval = 2.0;
  191.     ewin = ewin * mval;
  192.     ewin = (ewin * ((race[player[epn].race].strength+race[player[epn].race].knowledge)))/10;   /*RACE*/
  193.  
  194.     /* death-star adjustments - each makes the army 10 % stronger */
  195.     ewin =  ((10+player[pn].deathstars)*ewin)/10;
  196.  
  197.     /* Element of chance calculation */
  198.  
  199.     if(ewin<1) ewin=1;
  200.     if(ywin<1) ywin=1;
  201.  
  202.     if(ywin>ewin) 
  203.         {
  204.         cpercent =  ewin / ywin / 5.0;
  205.         tchance = cpercent * ywin;
  206.         } 
  207.      else 
  208.         {
  209.         cpercent =  ywin / ewin / 5.0;
  210.         tchance = cpercent * ewin;
  211.         }
  212.     if(tchance>32767) tchance=32767;
  213.     if(tchance<1) tchance=1;
  214.  
  215.     ewin = ewin + rnd(tchance+1);
  216.     ywin = ywin + rnd(tchance+1);
  217.  
  218.     printf("\nYour forces are off to battle.");
  219.     for(z2=0; z2<5; z2++) 
  220.         {
  221.         for (x=90000;x!=0;x--);  /*** ? ***/
  222.         printf(" .");
  223.         }
  224.  
  225.     printf(" .\n");
  226.  
  227.     /* Resolution */
  228.  
  229.     if(ywin>ewin) 
  230.         {
  231.         printf("\nYou were victorious!\n");
  232.         player_msg(1,"");
  233.         news(1,""); 
  234.         erat = 6;
  235.         rat  = 7;
  236.         player[pn].score_modifier = player[pn].score_modifier + 500;
  237.         player[pn].morale = player[pn].morale + 1;
  238.  
  239.         player[epn].score_modifier = player[epn].score_modifier - 100;
  240.         if(player[epn].health>-2)
  241.             player[epn].health = player[epn].health - 1;
  242.         if(player[epn].health>10)
  243.             player[epn].health = player[epn].health - 1;
  244.         } 
  245.       else 
  246.         {
  247.         printf("\nYou lost...\n");
  248.         if(s_send<50)
  249.         {
  250.             printf("It was stupid to attack someone with less then 50 troops...\n\n");
  251.             player[pn].morale = player[pn].morale-1;
  252.             player[pn].harmony = player[pn].harmony-2;
  253.  
  254.             player[epn].morale = player[epn].morale+1;
  255.         }
  256.         player_msg(2,"");
  257.         news(2,""); 
  258.         erat = 7;
  259.         rat  = 6;
  260.         player[pn].morale = player[pn].morale - 1;
  261.         player[pn].score_modifier = player[pn].score_modifier - 100;
  262.  
  263.         player[epn].morale = player[epn].morale + 1;
  264.         player[epn].score_modifier = player[epn].score_modifier + 200;
  265.     }
  266.  
  267.     if(ywin>(ewin*16)) 
  268.         { 
  269.         erat = 3; 
  270.         rat = 16; 
  271.         }
  272.         else
  273.     if(ywin>(ewin*8)) 
  274.         { 
  275.         erat = 4; 
  276.         rat = 12; 
  277.         }
  278.         else
  279.     if(ywin>(ewin*2)) 
  280.         { 
  281.         erat = 5; 
  282.         rat = 8; 
  283.         }
  284.         else
  285.     if(ewin>(ywin*16)) 
  286.         { 
  287.         rat = 3; 
  288.         erat = 16; 
  289.         }
  290.         else
  291.     if(ewin>(ywin*8)) 
  292.         {
  293.         rat = 4; 
  294.         erat = 12; 
  295.         }
  296.         else
  297.     if(ewin>(ywin*2)) 
  298.         {
  299.         rat = 5; 
  300.         erat = 8; 
  301.         }
  302.  
  303.     s_lost=0;
  304.     f_lost=0;
  305.     c_lost=0;
  306.     y_lost=0;
  307.     sf_lost=0;
  308.     em_lost=0;
  309.     ed_lost=0;
  310.     ec_lost=0;
  311.     es_lost=0;
  312.     ey_lost=0;
  313.     esf_lost=0;
  314.     ea_lost=0;
  315.     as_lost=0;
  316.     ac_lost=0;
  317.     ad_lost=0;
  318.  
  319.     if(s_send>0) 
  320.         s_lost = s_send/rat;
  321.     if(f_send>0) 
  322.         f_lost = f_send/rat;
  323.     if(c_send>0) 
  324.         c_lost = c_send/rat;
  325.     if(y_send>0) 
  326.         y_lost = y_send/rat;
  327.     if(sf_send>0) 
  328.         sf_lost = sf_send/rat;
  329.  
  330.     if(player[epn].defense>0) ed_lost = player[epn].defense/erat;
  331.     if((ed_lost>f_send)&&(f_send<200)) ed_lost=f_send;
  332.     if(player[epn].cruisers>0) ec_lost = player[epn].cruisers/erat;
  333.     if((ec_lost>c_send)&&(c_send<200)) ec_lost=c_send;
  334.     if(player[epn].soldiers>0) es_lost = player[epn].soldiers/erat;
  335.     if((es_lost>s_send)&&(s_send<200)) es_lost=s_send;
  336.     if(player[epn].ywings>0) em_lost = player[epn].missiledefense/rat;
  337.     if((ey_lost>y_send)&&(y_send<200)) es_lost=y_send;
  338.     if(player[epn].starfighters>0) esf_lost = player[epn].starfighters/erat;
  339.     if((esf_lost>sf_send)&&(sf_send<200)) esf_lost=sf_send;
  340.  
  341.     if(player[epn].agents>0) ea_lost = player[epn].agents/10;
  342.  
  343.     player[pn].soldiers    = player[pn].soldiers     - s_lost;
  344.     player[pn].fighters    = player[pn].fighters     - f_lost;
  345.     player[pn].cruisers    = player[pn].cruisers     - c_lost;
  346.     player[pn].ywings      = player[pn].ywings       - y_lost;
  347.     player[pn].starfighters= player[pn].starfighters - sf_lost;
  348.  
  349.     player[epn].defense     = player[epn].defense     - ed_lost;
  350.     player[epn].cruisers    = player[epn].cruisers    - ec_lost;
  351.     player[epn].soldiers    = player[epn].soldiers    - es_lost;
  352.     player[epn].ywings      = player[epn].ywings      - ey_lost;
  353.     player[epn].starfighters= player[epn].starfighters - esf_lost;
  354.     player[epn].agents      = player[epn].agents      - ea_lost;
  355. /*
  356.     if((a_ssend>0)&&(a_csend>0)&&(a_dsend>0)) 
  357.         {
  358.         team[player[z].team_num].team_soldiers=0L;
  359.         team[player[z].team_num].team_cruisers=0L;
  360.         team[player[z].team_num].team_defense=0L;
  361.         for(x=0; x!=26; x++) 
  362.             {
  363.             if(player[x].team_num==player[z].team_num) 
  364.                 {
  365.                 if(player[x].team_defense>0L) 
  366.                     {
  367.                     ad_lost = ad_lost + player[x].steam_defense/erat;
  368.                     player[x].team_defense = player[x].team_defense - player[x].team_defense/erat;
  369.                     team[player[z].team_num].team_defense = team[player[z].team_num].team_defense + player[x].team_defense;
  370.                     ac_lost = ac_lost + player[x].team_cruisers/erat;
  371.                     player[x].team_cruisers = player[x].team_cruisers - player[x].team_cruisers/erat;
  372.                     team[player[z].team_num].team_cruisers = team[player[z].team_num].team_cruisers + player[x].team_cruisers;
  373.                     as_lost = as_lost + player[x].team_soldiers/erat;
  374.                     player[x].team_soldiers = player[x].team_soldiers - player[x].team_soldiers/erat;
  375.                     team[player[z].team_num].team_soldiers = team[player[z].team_num].team_soldiers + player[x].team_soldiers;
  376.                     }
  377.                 }
  378.             }
  379.         }
  380. */ /*** ? ***/
  381.  
  382.     printf("\n                              DESTRUCTION REPORT\n");
  383.     printf(" ---------------------------------------------------------------------------\n");
  384.     printf("|             | Soldier | X-Wing | Y-Wing | Cruiser | Starfighter | Defense |\n");
  385.     printf("|---------------------------------------------------------------------------|\n");
  386.     printf("| YOU LOST    | %7ld | %6ld | %6ld |  %6ld |     %7ld |  -----  |\n",s_lost,f_lost,y_lost,c_lost,sf_lost);
  387.     printf("|---------------------------------------------------------------------------|\n");
  388.     printf("| ENEMY LOST  | %7ld | ------ | %6ld |  %6ld |     %7ld |  %6ld |\n",es_lost,ey_lost,ec_lost,esf_lost,ed_lost);
  389.     printf(" ---------------------------------------------------------------------------\n");
  390.     printf("              | ENEMY AGENTS KILLED IN BATTLE: %4ld |\n",ea_lost);
  391.     printf("               -------------------------------------\n");
  392.  
  393. /*    printf("You lost %ld soldiers, %ld x-wings, ",s_lost,f_lost);
  394.     if(player[pn].tech_level>0)
  395.         printf("%ld cruisers, ",c_lost);
  396.     if(player[pn].tech_level>4)
  397.         printf("and %ld y-wings ",y_lost);
  398.     if(player[pn].tech_level>70-(race[player[pn].race].knowledge*3))
  399.         printf("\nand %ld Imperial Starfighters",sf_lost);
  400.     printf(".\n");
  401.  
  402.     printf("Your enemy lost %ld soldiers, %ld defense stations, ",es_lost,ed_lost);
  403.     if(player[pn].tech_level>0)
  404.         printf("%ld cruisers, ",ec_lost);
  405.     if(player[pn].tech_level>4)
  406.         printf("\nand %ld y-wings ",ey_lost);
  407.     if(player[pn].tech_level>70-(race[player[pn].race].knowledge*3))
  408.         printf("\nand %ld Imperial Starfighters",esf_lost);
  409.  
  410.     printf(".\n");
  411. */
  412.     printf("\n");
  413.  
  414. /*
  415.     if((a_ssend>0)&&(a_csend>0)&&(a_dsend>0)) 
  416.         printf("Your enemy's alliance lost %ld soldiers, %ld defense stations, and %ld cruisers.\n",as_lost,ad_lost,ac_lost);
  417. */
  418.     if(ywin>ewin) 
  419.         {
  420.         pcap = 0;
  421.  
  422.         if(player[epn].defensep>0) 
  423.             {
  424.             pcap2 = player[epn].defensep/10 + 1;
  425.             player[epn].defensep = player[epn].defensep - pcap2;
  426.             if(player[epn].defensep<0) 
  427.                 player[epn].defensep=0;
  428.             pcap = pcap + pcap2;
  429.             }
  430.         if(player[epn].orep>0) 
  431.             {
  432.             pcap2 = player[epn].orep/10 + 1;
  433.             player[epn].orep = player[epn].orep - pcap2;
  434.             if(player[epn].orep<0) 
  435.                 player[epn].orep=0;
  436.             pcap = pcap + pcap2;
  437.             }
  438.         if(player[epn].foodp>0) 
  439.             {
  440.             pcap2 = player[epn].foodp/10 + 1;
  441.             player[epn].foodp = player[epn].foodp - pcap2;
  442.             if(player[epn].foodp<0) 
  443.                 player[epn].foodp=0;
  444.             pcap = pcap + pcap2;
  445.             }
  446.         if(player[epn].tradep>0) 
  447.             {
  448.             pcap2 = player[epn].governp/10 + 1;
  449.             player[epn].tradep = player[epn].tradep - pcap2;
  450.             if(player[epn].tradep<0) 
  451.                 player[epn].tradep=0;
  452.             pcap = pcap + pcap2;
  453.             }
  454.         if(player[epn].tourismp>0) 
  455.             {
  456.             pcap2 = player[epn].governp/10 + 1;
  457.             player[epn].tourismp = player[epn].tourismp - pcap2;
  458.             if(player[epn].tourismp<0) 
  459.                 player[epn].tourismp=0;
  460.             pcap = pcap + pcap2;
  461.             }
  462.         if(player[epn].governp>0) 
  463.             {
  464.             pcap2 = player[epn].governp/10 + 1;
  465.             player[epn].governp = player[epn].governp - pcap2;
  466.             if(player[epn].governp<0) 
  467.                 player[epn].governp=0;
  468.             pcap = pcap + pcap2;
  469.             }
  470.  
  471.         if(player[epn].acredits>10000) 
  472.             {
  473.             rubbed=(player[epn].acredits/10)+1;
  474.             if(rubbed>1000000)
  475.                 rubbed=1000000;
  476.             player[pn].acredits = player[pn].acredits + rubbed;
  477.             player[epn].acredits = player[epn].acredits - rubbed;
  478.             if(player[epn].acredits<0) 
  479.                 player[epn].acredits=0;
  480.             }
  481.         if(player[epn].missiledefense>0)
  482.             player[epn].missiledefense=player[epn].missiledefense-(player[epn].missiledefense/10);
  483.  
  484.  
  485.         put_datas(pn);
  486.         printf("You captured %ld planets !\n",pcap);
  487.  
  488.         if(rubbed>0)
  489.             printf("You got also %ld credits from %s's bank account !\n",rubbed,player[epn].player);
  490.  
  491.         if((player[epn].governp<=0)&&(player[epn].foodp<=0)&&(player[epn].orep<=0)&&(player[epn].tradep<=0)&&(player[epn].tourismp<=0)&&(player[epn].defensep<=0)) 
  492.             {
  493.             printf("\nYou have crushed your enemy!\n");
  494.             bonus=player[pn].governp*30000;
  495.             printf("You got a special bonus of %ld credits!\n",bonus);
  496.             if(player[epn].acredits>0)
  497.                 {
  498.                 player[pn].acredits=player[pn].acredits+player[epn].acredits;
  499.                 printf("You get also the money of %s`s bank-account (%ld credits)\n",player[epn].player,player[epn].acredits);
  500.                 }
  501.             news(3,""); 
  502.             player[pn].morale = player[pn].morale + 2;
  503.             player[pn].harmony = player[pn].harmony + 1;
  504.             player[pn].credits= player[pn].credits + bonus;
  505.             e_points(2); 
  506.             /*
  507.             if(e_team_num==pn) 
  508.                 { 
  509.                 dissolve_team(e_team_num);
  510.                 }
  511.               else 
  512.                 if(player[z].team_num!=0) 
  513.                     team[player[z].team_num].members--;
  514.             */ /*** ? ***/
  515.             } 
  516.  
  517.         giveplanets(pcap);
  518.         }
  519.     put_datas(epn);
  520.     }
  521. }
  522.  
  523. /********************************************************************/
  524.  
  525. bank_menu()
  526. {
  527. cls();
  528. printf("\n\n%s\n",BankName);
  529. printf("-------------------------------------------------------\n");
  530. printf(" Your account status : %d\n",player[pn].acredits);
  531. printf(" Credits Cash        : %d\n",player[pn].credits);
  532. printf("\n1) Put in some money\n");
  533. printf("2) Take out some money\n");
  534. printf("3) Transfer money to another account \n");
  535. printf("   -> limited to %ld credits each day \n",max_transfer);
  536. printf("------------------------------------[0] for Mainmenu---\n\n");
  537. }
  538.  
  539. /********************************************************************/
  540.  
  541. bank_stage()
  542. {
  543. char ostring[80];
  544. long n=0;
  545.  
  546. bank_menu();
  547.  
  548. do 
  549. {
  550.  printf("Which would you like to do ? [?] BankMenu  ");
  551.  gets(ostring);
  552.  sscanf(ostring,"%d",&n);
  553.  if(strlen(ostring)<1)
  554.     n=0; 
  555.  if(ostring[0]=='?') 
  556.     {
  557.         bank_menu();
  558.     n=255; 
  559.     }
  560.  if((n>0)&&(n<4)) 
  561.    {
  562.    if(n==1)
  563.     {
  564.     printf("How much do you want to put in ?");
  565.      gets(ostring);
  566.      sscanf(ostring,"%d",&n);
  567.     if ((n>player[pn].credits)||(n<0))
  568.         printf("You cant put in %ld credits !\n",n);
  569.     else
  570.         {
  571.         player[pn].acredits=player[pn].acredits+n;
  572.         player[pn].credits=player[pn].credits-n;
  573.         }
  574.     }
  575.    if(n==2)    
  576.     {
  577.     printf("How much do you want to take out ?");
  578.      gets(ostring);
  579.      sscanf(ostring,"%d",&n);
  580.     if (n>player[pn].acredits)
  581.         printf("You dont have as much money !\n");
  582.     else
  583.         {
  584.         if(n<0)
  585.             printf("Do you want to cheat ?\n");
  586.         else
  587.             {
  588.             player[pn].acredits=player[pn].acredits-n;
  589.             player[pn].credits=player[pn].credits+n;
  590.             }
  591.         }
  592.     }
  593.    if(n==3)    
  594.     {
  595.     if(player[pn].acredits==0)
  596.         printf("You don't have money on your bank account !\n");
  597.     else
  598.         {
  599.         if (getplayer()==TRUE)
  600.             {
  601.             printf("How much do you want to transfer ?");
  602.              gets(ostring);
  603.              sscanf(ostring,"%d",&n);
  604.             if ((n>max_transfer)||(n<0))
  605.                 printf("Money Transfer limited to %ld credits !\n",max_transfer);
  606.             else
  607.                 {
  608.                 sprintf(ostring,"credits to %s",player[epn].player);
  609.                 if (check_stringinfile("SPCEMP:NEWS.TXT",ostring)==TRUE) 
  610.                     printf("This Player allready received some money today. \n");
  611.                 else
  612.                     {
  613.                     if (n>player[pn].acredits)
  614.                         printf("You dont have as much money !\n");
  615.                     else
  616.                         {
  617.                         player[pn].acredits=player[pn].acredits-n;
  618.                         player[epn].acredits=player[epn].acredits+n;
  619.                         put_datas(epn);
  620.                         sprintf(ostring," %ld ",n);
  621.                         player_msg(20,ostring);
  622.                         news(20,ostring);
  623.                         }
  624.                     }    
  625.                 }
  626.             }
  627.         }
  628.     }
  629.    }
  630. } while (n!=0);
  631.  
  632. printf("\n");
  633. }
  634.  
  635. /********************************************************************/
  636.  
  637. option_menu()
  638. {
  639. cls();
  640. printf("\n\nOption menu\n");
  641. printf("--------------------------------------------------\n");
  642. if(lottery_turn!=0)
  643.  {
  644.   printf("1) Buy a lottery ticket\n");
  645.   printf("2) View Lottery\n");
  646.  }
  647. printf("3) Change tax\n");
  648. printf("\n9) Change terminal(emulation)\n");
  649. printf("-------------------------------[0] for Mainmenu---\n\n");
  650. }
  651.  
  652. /********************************************************************/
  653.  
  654. option_stage()
  655. {
  656. char ostring[80];
  657. int lottery_count=0;
  658. long n=0;
  659. FILE *fp;
  660.  
  661. option_menu();
  662.  
  663. do 
  664. {
  665.  printf("Which would you like to do ? [?] OptionMenu  ");
  666.  gets(ostring);
  667.  sscanf(ostring,"%d",&n);
  668.  if(strlen(ostring)<1)
  669.     n=0; 
  670.  if(ostring[0]=='?') 
  671.     {
  672.         option_menu();
  673.     n=255; 
  674.     }
  675.  if((n>0)&&(n<10)) 
  676.    {
  677.    if((n==1)&&(lottery_turn!=0))
  678.     {
  679.     n=0;
  680.     printf("How many tickets do you want to buy ? Max [%d] ",(player[pn].credits/1000));
  681.      gets(ostring);
  682.      sscanf(ostring,"%d",&n);
  683.     if ((n*1000)>player[pn].credits)
  684.         printf("You dont have as much money !\n");
  685.     else
  686.       if(n>0)
  687.         {
  688.         player[pn].credits=player[pn].credits-(n*1000);
  689.                 if (check_file("SPCEMP:LOTTERY.USER")==FALSE)
  690.                   fp=fopen("SPCEMP:LOTTERY.USER","w");
  691.          else
  692.                   fp=fopen("SPCEMP:LOTTERY.USER","a");
  693.                 sprintf(ostring,"%-26s %-18ld",player[pn].player,n);
  694.                 fprintf(fp,"%s\n",ostring);
  695.                 printf("You buy %d lottery tickets.\n",n);
  696.                 fclose(fp);
  697.         }
  698.     n=1;
  699.     }
  700.    if((n==2)&&(lottery_turn!=0))
  701.     {
  702.         if (check_file("SPCEMP:LOTTERY.DAT")==TRUE)
  703.          {
  704.           fp=fopen("SPCEMP:LOTTERY.DAT","r");
  705.              fgets(ostring,60,fp);
  706.              sscanf(ostring,"%d",&lottery_count);
  707.           fclose(fp);
  708.           if((lottery_turn-lottery_count)==1)
  709.             printf("Next lottery will be tomorrow.\n\n");
  710.            else
  711.             printf("Next lottery will be in %d days.\n\n",(lottery_turn-lottery_count));
  712.           printf("Username                   Tickets\n");
  713.           printf("----------------------------------\n");
  714.       display_file("SPCEMP:LOTTERY.USER",NO_MORE);
  715.          }
  716.     }
  717.    if(n==3)
  718.     {
  719.          n=player[pn].tax;
  720.      do {
  721.              printf("How much tax do you want (5-15) ? [%d%%] at the moment ",player[pn].tax);
  722.              gets(ostring);
  723.              sscanf(ostring,"%d",&n);
  724.         } while ((n<5)||(n>15));
  725.           if(n==player[pn].tax)
  726.            printf("Leave tax unchanged.\n");
  727.           else
  728.            printf("Change the tax to %d%%.\n",n);
  729.          player[pn].harmony=player[pn].harmony+player[pn].tax-n;
  730.          player[pn].tax=n;
  731.          n=3;
  732.     }
  733. /*   if(n==8)  Don't work !!!
  734.     {
  735.          def_stage();
  736.         }
  737. */
  738.    if(n==9)
  739.     {
  740.          n=player[pn].terminal;
  741.          printf("Witch terminal(emulation) do you prefer ? ");
  742.          switch(n) {
  743.            case 0 : {
  744.              printf("ASCII");
  745.              break;
  746.             }
  747.            case 1 : {
  748.              printf("ANSI(DEC)");
  749.              break;
  750.             }
  751.            case 2 : {
  752.                      printf("ANSI(IBM)");
  753.              break;
  754.             }
  755.              }
  756.          printf(" now.\n0=ASCII 1=ANSI(DEC) 2=ANSI(IBM) [RETURN]=Unchanged : ");
  757.          gets(ostring);
  758.          sscanf(ostring,"%d",&n);
  759.          if(n==player[pn].terminal)
  760.            printf("Leave terminal unchanged.\n");
  761.           else
  762.            {
  763.            printf("Change the terminal to ");
  764.            switch(n) {
  765.              case 0 : {
  766.                printf("ASCII");
  767.                break;
  768.               }
  769.              case 1 : {
  770.                printf("ANSI(DEC)");
  771.                break;
  772.               }
  773.              case 2 : {
  774.                        printf("ANSI(IBM)");
  775.                break;
  776.               }
  777.              }
  778.            printf(".\n");
  779.            }
  780.          player[pn].terminal=n;
  781.          n=9;
  782.     }
  783.    }
  784. } while (n!=0);
  785.  
  786. printf("\n");
  787. }
  788.  
  789. /********************************************************************/
  790. /********************************************************************/
  791.  
  792. team_menu()
  793. {
  794. printf("\n\nAlliances -- THIS STUFF IS NOT YET INCLUDED -- \n");
  795. printf("--------------------------------------------------\n");
  796. if(player[pn].team_num==0) 
  797.     printf("You are not a member of any alliance.\n");
  798. else
  799.     printf("You are a member of the %s alliance.\n",player[pn].teamname);
  800. if(player[pn].teamleader==TRUE)
  801.     printf("You are the leader of that alliance.\n");
  802. printf("\n");
  803.  
  804. printf("1) List alliances\n");
  805. if(player[pn].team_num==0)
  806.     {
  807.     printf("2) Start new alliance\n");
  808.     printf("3) Join an alliance\n");
  809.     }
  810. else
  811.     printf("4) Withdraw from alliance\n");
  812. printf("\n");
  813. if(player[pn].team_num!=0)
  814.     {
  815.     printf("5) Info on your alliance\n");
  816.     printf("6) Review defense forces\n");
  817.     }
  818. if(player[pn].teamleader==TRUE)
  819.     {
  820.     printf("7) Expell empire from alliance\n");
  821.     printf("8) Dissolve alliance\n");
  822.     }
  823. printf("-------------------------------[0] to continue----\n\n");
  824. }
  825.  
  826. /********************************************************************/
  827. team_round()
  828. {
  829. char ostring[80];
  830. char zstring[80];
  831. int x,n;
  832. unsigned long putin;
  833.  
  834. team_menu();
  835.  
  836. do 
  837. {
  838.  printf("Which would you like to do? [?] for List ");
  839.  gets(ostring);
  840.  sscanf(ostring,"%d",&n);
  841.  if(strlen(ostring)<1)
  842.     n=0; 
  843.  if(ostring[0]=='?')
  844.     team_menu();
  845.  
  846.  if((n>0)&&(n<12)) 
  847.     {
  848.     if(n==1)
  849.         {
  850.         display_file("SPCEMP:teams.dat",NO_MORE);
  851.         }
  852.     if((n==2)&&(player[pn].team_num==0))
  853.         {
  854.         printf("Start new alliance\n");
  855.         }
  856.     if((n==3)&&(player[pn].team_num==0))
  857.         {
  858.         printf("Join an alliance\n");
  859.         }
  860.     if((n==4)&&(player[pn].team_num!=0))
  861.         {
  862.         printf("Withdraw from alliance\n");
  863.         }
  864.     if((n==5)&&(player[pn].team_num!=0))
  865.         {
  866.         printf("Info on your alliance\n");
  867.         }
  868.     if((n==6)&&(player[pn].team_num!=0))
  869.         {
  870.         printf("Review defense forces\n");
  871.         }
  872.     if((n==7)&&(player[pn].teamleader==TRUE))
  873.         {
  874.         printf("Expell empire from alliance\n");
  875.         }
  876.     if((n==8)&&(player[pn].teamleader==TRUE))
  877.         {
  878.         printf("Dissolve alliance\n");
  879.         }
  880.     }
  881. while (n!=0);
  882.  
  883. printf("\n");
  884.  
  885. /*
  886. if(player[pn].team_num==0)
  887.  
  888.     sendmessage("\r\nAlliance round\r\n-------- -----",1);
  889.  
  890.     if(player[pn].team_num==0) {
  891.         sendmessage("\r\nYou are not a member of any alliance.\r\n",1);
  892.     } else {
  893.         if(pn!=player[pn].team_num) {
  894.             sprintf(ostring,"\r\nYou are a member of the %s alliance.\r\n",team[player[pn].team_num].name);
  895.             sendmessage(ostring,1);
  896.         } else {
  897.             sprintf(ostring,"\r\nYou are the leader of the %s alliance.\r\n",team[player[pn].team_num].name);
  898.             sendmessage(ostring,1);
  899.             for(x=0; x!=26; x++) {
  900.                 if(player[x].team_apply==pn) {
  901.                     player[x].team_apply = 0;
  902.                     sprintf(ostring,"%s would like to join your alliance.",player[x].pname);
  903.                     sendmessage(ostring,1);
  904.                     DROP;
  905.                     if((boolean("\r\nLet him join?",2)==1)) {
  906.                         DROP;
  907.                         player[x].team_num = pn;
  908.                         team[pn].members++;
  909.                         player_msg(x,pn,7);
  910.                         news(x,pn,7);
  911.                     } else {
  912.                         player_msg(x,pn,10);
  913.                     }
  914.                 }
  915.             }
  916.         }
  917.     }
  918.  
  919.     choices:
  920.     DROP;
  921.     sendmessage("",1);
  922.     if( (player[pn].team_num!=0) && (player[pn].team_num==pn) ) {
  923.         sendmessage("[D]issolve alliance",1);
  924.         sendmessage("[E]xpell empire from alliance",1);
  925.     }
  926.     if(player[pn].team_num!=0)
  927.         sendmessage("[I]nfo on your alliance",1);
  928.     if(player[pn].team_num==0)
  929.         sendmessage("[J]oin an alliance",1);
  930.     sendmessage("[L]ist existing alliances",1);
  931.     sendmessage("[Q]uit",1);
  932.     if(player[pn].team_num!=0)
  933.         sendmessage("[R]eview defense forces",1);
  934.     if(player[pn].team_num==0)
  935.         sendmessage("[S]tart a new alliance",1);
  936.     if( (player[pn].team_num!=0) && (player[pn].team_num!=pn) )
  937.         sendmessage("[W]ithdraw from alliance",1);
  938.     sendmessage("",1);
  939.  
  940.     DROP;
  941.     hotkey("Choice: ",ostring);
  942.     DROP;
  943.     ostring[0]=toupper(ostring[0]);
  944.     switch(ostring[0]) {
  945.         case 'D':
  946.             if(!( (player[pn].team_num!=0) && (player[pn].team_num==pn) )) goto choices;
  947.             sendmessage("Dissolve alliance\r\n",1);
  948.             DROP;
  949.             if((boolean("Are you sure?",2)==1)) {
  950.                 DROP;
  951.                 dissolve_team(pn);
  952.             }
  953.             break;
  954.         case 'E':
  955.             if(!( (player[pn].team_num!=0) && (player[pn].team_num==pn) )) goto choices;
  956.             sendmessage("Expell empire from alliance",1);
  957.             x=getplayer(1);
  958.             if(x==-1) break;
  959.             DROP;
  960.             if((boolean("Are you sure?",2)==1)) {
  961.                 DROP;
  962.                 news(x,pn,12);
  963.                 player_msg(x,pn,12);
  964.                 player[x].team_num=0;
  965.                 player[x].team_apply=0;
  966.                 player[x].defense = player[pn].defense + player[pn].team_defense;
  967.                 player[x].soldiers = player[pn].soldiers + player[pn].team_soldiers;
  968.                 player[x].cruisers = player[pn].cruisers + player[pn].team_cruisers;
  969.                 team[pn].members--;
  970.             }
  971.             break;
  972.         case 'I':
  973.             if(player[pn].team_num==0) goto choices;
  974.             sendmessage("Info on your alliance",1);
  975.             show_team(player[pn].team_num);
  976.             break;
  977.         case 'J':
  978.             if(player[pn].team_num!=0) goto choices;
  979.             sendmessage("Join an alliance\r\n",1);
  980.             if(player[pn].team_apply!=0) {
  981.                 sendmessage("You have already applied to join an alliance.",1);
  982.                 DROP;
  983.                 if((boolean("Revoke your application?",2)==2)) goto choices;
  984.             }
  985.             relist: list_alliances();
  986.             prompt("\r\nWhich alliance do you wish to join? ",ostring,4);
  987.             DROP;
  988.             sscanf(ostring,"%d",&x);
  989.             if((x<1)||(x>25)) break;
  990.             if(team[x].members<1) {
  991.                 sendmessage("\r\nThat is not an alliance.\r\n",1);
  992.                 goto relist;
  993.             }
  994.             player[pn].team_apply=x;
  995.             sendmessage("\r\nThe leader of the alliance will review your application.\r\n",1);
  996.             break;
  997.         case 'L':
  998.             sendmessage("List existing alliances",1);
  999.             list_alliances();
  1000.             break;
  1001.         case 'Q':
  1002.             sendmessage("Quit",1);
  1003.             return;
  1004.             break;
  1005.         case 'R':
  1006.             if(player[pn].team_num==0) goto choices;
  1007.             sendmessage("Review defense forces",1);
  1008.             show_team(player[pn].team_num);
  1009.             player[pn].soldiers = player[pn].soldiers + player[pn].team_soldiers;
  1010.             team[player[pn].team_num].team_soldiers = team[player[pn].team_num].team_soldiers - player[pn].team_soldiers;
  1011.             player[pn].team_soldiers=0L;
  1012.             player[pn].defense = player[pn].defense + player[pn].team_defense;
  1013.             team[player[pn].team_num].team_defense = team[player[pn].team_num].team_defense - player[pn].team_defense;
  1014.             player[pn].team_defense=0L;
  1015.             player[pn].cruisers = player[pn].cruisers + player[pn].team_cruisers;
  1016.             team[player[pn].team_num].team_cruisers = team[player[pn].team_num].team_cruisers - player[pn].team_cruisers;
  1017.             player[pn].team_cruisers=0L;
  1018.             sendmessage("",1);
  1019.  
  1020.             redoit1: sprintf(zstring,"How many of your soldier troops would you like to put in? (max %ld) ",player[pn].soldiers);
  1021.             prompt(zstring,ostring,19);
  1022.             DROP;
  1023.             sscanf(ostring,"%ld",&putin);
  1024.             if(putin>player[pn].soldiers) goto redoit1;
  1025.             player[pn].team_soldiers=putin;
  1026.             team[player[pn].team_num].team_soldiers=putin;
  1027.             player[pn].soldiers=player[pn].soldiers-putin;
  1028.  
  1029.             redoit2: sprintf(zstring,"How many of your defense stations would you like to put in? (max %ld) ",player[pn].defense);
  1030.             prompt(zstring,ostring,19);
  1031.             DROP;
  1032.             sscanf(ostring,"%ld",&putin);
  1033.             if(putin>player[pn].defense) goto redoit2;
  1034.             player[pn].team_defense=putin;
  1035.             team[player[pn].team_num].team_defense=putin;
  1036.             player[pn].defense=player[pn].defense-putin;
  1037.  
  1038.             redoit3: sprintf(zstring,"How many of your cruisers would you like to put in? (max %ld) ",player[pn].cruisers);
  1039.             prompt(zstring,ostring,19);
  1040.             DROP;
  1041.             sscanf(ostring,"%ld",&putin);
  1042.             if(putin>player[pn].cruisers) goto redoit1;
  1043.             player[pn].team_cruisers=putin;
  1044.             team[player[pn].team_num].team_cruisers=putin;
  1045.             player[pn].cruisers=player[pn].cruisers-putin;
  1046.  
  1047.             sendmessage("",1);
  1048.             break;
  1049.  
  1050.         case 'S':
  1051.             if(player[pn].team_num!=0) goto choices;
  1052.             sendmessage("Start new alliance",1);
  1053.             prompt("\r\nWhat shall you call your alliance? ",team[pn].name,19);
  1054.             DROP;
  1055.             strtoup(team[pn].name);
  1056.             player[pn].team_num=pn;
  1057.             player[pn].team_apply=0;
  1058.             team[pn].members=1;
  1059.             team[pn].team_defense=0L;
  1060.             team[pn].team_soldiers=0L;
  1061.             team[pn].team_cruisers=0L;
  1062.             break;
  1063.         case 'W':
  1064.             if(!( (player[pn].team_num!=0) && (player[pn].team_num!=pn) )) goto choices;
  1065.             sendmessage("Withdraw from alliance",1);
  1066.             if((boolean("Are you sure?",2)==1)) {
  1067.                 DROP;
  1068.                 news(player[pn].team_num,pn,8);
  1069.                 team[player[pn].team_num].members--;
  1070.                 player[pn].team_num=0;
  1071.                 player[pn].team_apply=0;
  1072.                 player[pn].defense = player[pn].defense + player[pn].team_defense;
  1073.                 player[pn].soldiers = player[pn].soldiers + player[pn].team_soldiers;
  1074.                 player[pn].cruisers = player[pn].cruisers + player[pn].team_cruisers;
  1075.             }
  1076.             break;
  1077.         default: goto choices; break;
  1078.  
  1079.     }
  1080.     goto choices;
  1081. */
  1082. }
  1083.  
  1084. /********************************************************************/
  1085. dissolve_team(int z)
  1086. {
  1087. /*
  1088. int x;
  1089.  
  1090.     news(z,z,9);
  1091.     team[z].members=0;
  1092.     for(x=0; x!=26; x++) {
  1093.             if(player[x].team_num==z) {
  1094.             player[x].team_num=0;
  1095.             player[x].team_apply=0;
  1096.             player[x].defense = player[x].defense + player[z].team_defense;
  1097.             player[x].soldiers = player[x].soldiers + player[z].team_soldiers;
  1098.             player[x].cruisers = player[x].cruisers + player[z].team_cruisers;
  1099.         }
  1100.     }
  1101. */
  1102. }
  1103.  
  1104. /********************************************************************/
  1105. int getplayer()
  1106. {
  1107. time_t current_time;
  1108. double diffsec;
  1109. long   newmoves;
  1110. long   diffhours;
  1111.  
  1112. do
  1113.   {
  1114.     printf("Which player ([ENTER]=Cancel/?=List)");
  1115.     gets(player[epn].player);
  1116.     strtoup(player[epn].player);
  1117.  
  1118.     if(player[epn].player[0]=='?')
  1119.         display_users();
  1120.     if(strcmp(player[epn].player,player[pn].player)==0)
  1121.         {
  1122.         printf("\n\nYou can't do that to yourself !!! \n");
  1123.         player[epn].player[0]='?';
  1124.         player[epn].player[1]='\0';
  1125.         }
  1126.     if((check_player(player[epn].player)==TRUE)&&(strlen(player[epn].player)>3))
  1127.         {
  1128.         get_datas(epn);
  1129.  
  1130.         current_time = time (¤t_time);
  1131.         diffsec      = difftime(current_time,player[epn].last_time);
  1132.         diffhours    = diffsec/(60*60);
  1133.  
  1134.         if(diffhours>((24*3)-1))
  1135.             {
  1136.             printf("\n\n Your enemy lost his protection because he did not play for more than 3 days.\n");
  1137.             player[epn].protection=0;
  1138.             put_datas(epn);
  1139.             }
  1140.  
  1141.         if(player[epn].protection>0)
  1142.             {
  1143.             printf("%s is still under protection !\n",player[epn].player);
  1144.             strcpy(player[epn].player,"N");
  1145.             }
  1146.         else     
  1147.             {
  1148.             put_datas(pn);
  1149.             return(TRUE);
  1150.             }
  1151.         }
  1152.     if(strlen(player[epn].player)<1)
  1153.         {
  1154.         strcpy(player[epn].player,"NOBODY");
  1155.         return(FALSE);
  1156.         }
  1157.     if(strlen(player[epn].player)>2)
  1158.         printf("Pardon ?\n");
  1159.   } while (player[epn].player[0]!=0);
  1160.  
  1161. return(FALSE);
  1162. }
  1163.  
  1164. /********************************************************************/
  1165. rest()
  1166. {
  1167. long deserters,pop_migration;
  1168. float pval;
  1169.  
  1170. if(player[pn].soldiers>0) 
  1171.     {
  1172.     if(player[pn].morale<-5) {
  1173.         deserters = player[pn].soldiers/(-1 * player[pn].morale );
  1174.         printf("%ld troops of soldiers have deserted.\n",deserters);
  1175.         player[pn].soldiers = player[pn].soldiers - deserters;
  1176.     }
  1177. }
  1178.  
  1179. if((player[pn].population>50)&&(player[pn].population<32000)) 
  1180.     {
  1181.     pval = player[pn].harmony * 0.01;
  1182.     if(pval<-0.25) 
  1183.         pval = -0.25;
  1184.     if(pval>0.25) 
  1185.         pval = 0.25;
  1186.     if(pval<0.0) 
  1187.         pval = pval - 1.0;
  1188.     if(pval>0.0) 
  1189.         pval = pval + 1.0;
  1190.     pop_migration = ((rnd(player[pn].population/25)) * pval);
  1191.     pop_migration = pop_migration + pop_increase;
  1192.     player[pn].population = player[pn].population + pop_migration;
  1193.     if(pop_migration>0)
  1194.         printf("\nYour population increased by %d million.\n",pop_migration);
  1195.     if(pop_migration==0)
  1196.         printf("\nYour population remains unchanged.\n");
  1197.     if(pop_migration<0)
  1198.         printf("\nYour population decreased by %d million.\n",(pop_migration*-1));
  1199.     }
  1200.  
  1201. strife(player[pn].harmony);
  1202. }
  1203.  
  1204. /********************************************************************/
  1205. strife(long h)
  1206. {
  1207. long sc;
  1208. long x;
  1209.  
  1210. if(h>-3) return;
  1211. sc = h + ((-1) * rnd((h*-1)));
  1212. x=0;
  1213. while((x<1)||(x>3)) 
  1214.     x = rnd(4);
  1215. if(sc<-16) 
  1216.     { 
  1217.     x=x+6; 
  1218.     }
  1219. else
  1220. if(sc<-9) 
  1221.     { 
  1222.     x=x+3; 
  1223.     }
  1224.  
  1225. switch(x) {
  1226.     case 1:
  1227.     printf("\nStudent protesters wreak havok in major cities.\n");
  1228.     break;
  1229.     case 2:
  1230.     printf("\nA high ranking official in your government was recently assassinated.\n");
  1231.     break;
  1232.     case 3:
  1233.     printf("\nPrisons become overpopulated with political prisoners.\n");
  1234.     break;
  1235.     case 4:
  1236.     printf("\nCivil strife errupts at frontier planets.\n");
  1237.     player[pn].morale = player[pn].morale - 1;
  1238.     break;
  1239.     case 5:
  1240.     printf("\nRebels confront military in scattered skirmishes.\n");
  1241.     player[pn].morale = player[pn].morale - 1;
  1242.     break;
  1243.     case 6:
  1244.     if(player[pn].governp>0) {
  1245.         printf("\nAnti-matter bomb detonated by rebels on a governing planet.\n");
  1246.         player[pn].governp = player[pn].governp - 1;
  1247.     }
  1248.     break;
  1249.     case 7:
  1250.     case 8:
  1251.     case 9:
  1252.     printf("\nCivil war breaks out across your empire!");
  1253.     printf("\nYour empire is torn in half!\n");
  1254.     player[pn].harmony = 0;
  1255.     player[pn].morale = -3;
  1256.     player[pn].protection = player[pn].protection + 2; /*VMS SPECIAL*/
  1257.     player[pn].tech_level = 0;
  1258.     player[pn].health = -1;
  1259.     if(player[pn].soldiers>0) 
  1260.         player[pn].soldiers = player[pn].soldiers/2;
  1261.     if(player[pn].defensep>0) 
  1262.         player[pn].defensep = player[pn].defensep/2;
  1263.     if(player[pn].fighters>0) 
  1264.         player[pn].fighters = player[pn].fighters/2;
  1265.     if(player[pn].carriers>0) 
  1266.         player[pn].carriers = player[pn].carriers/2;
  1267.     if(player[pn].pilots>0) 
  1268.         player[pn].pilots = player[pn].pilots/2;
  1269.     if(player[pn].orep>0) 
  1270.         player[pn].freighters = player[pn].freighters/2;
  1271.     if(player[pn].orep>0) 
  1272.         player[pn].orep = player[pn].orep/2;
  1273.     if(player[pn].foodp>0) 
  1274.         player[pn].foodp = player[pn].foodp/2;
  1275.     if(player[pn].tradep>0) 
  1276.         player[pn].tradep = player[pn].tradep/2;
  1277.     if(player[pn].foodp>0) 
  1278.         player[pn].tourismp = player[pn].tourismp/2;
  1279.     if(player[pn].governp>0) 
  1280.         player[pn].governp = player[pn].governp/2;
  1281.     if(player[pn].acredits>0) 
  1282.         player[pn].acredits = player[pn].acredits/3;
  1283.     player[pn].population = player[pn].population/2 + 1;
  1284.     player[pn].food = (11 * player[pn].population);
  1285.     if((player[pn].governp+player[pn].foodp+player[pn].orep+player[pn].defensep+player[pn].tradep+player[pn].tourismp)==0)
  1286.         {
  1287.         remove_player();
  1288.         news(51,"");
  1289.         printf("\n\nYour citizens did not like your ruling style !\n");
  1290.         printf("Some terrorists entered your room and killed you, when you were sleeping. \n");
  1291.         printf("You may start again. \n\n");
  1292.         player[pn].moves=0;
  1293.         press_return();
  1294.         put_datas(pn);
  1295.         exit(0);
  1296.         }
  1297.     else
  1298.         news(6,"");
  1299.     break;
  1300.     }
  1301. }
  1302.  
  1303. /********************************************************************/
  1304. player_msg(int msg,char string[80])
  1305. {
  1306. char ostring[80],zstring[80];
  1307.  
  1308. sprintf(zstring,"SPCEMP_PLAYERS:MSG_%s.TXT",player[epn].player);
  1309.  
  1310. switch(msg) 
  1311.     {
  1312.     case 1: sprintf(ostring,"%s defeated you!",player[pn].player);
  1313.         optlog(ostring,zstring);
  1314.                 page(player[epn].player,ostring);
  1315.         break;
  1316.     case 2:    sprintf(ostring,"You repelled an attack from %s!",player[pn].player);
  1317.         optlog(ostring,zstring);
  1318.                 page(player[epn].player,ostring);
  1319.         break;
  1320.     case 4: sprintf(ostring,"%s tried to steal your Starfighters or Freighters with the result \n               that you got some of his now!",player[pn].player);
  1321.         optlog(ostring,zstring);
  1322.                 page(player[epn].player,ostring);
  1323.         break;
  1324.     case 5: sprintf(ostring,"%s spied on you!",player[pn].player);
  1325.         optlog(ostring,zstring);
  1326.                 page(player[epn].player,ostring);
  1327.         break;
  1328.     case 7: sprintf(ostring,"%s accepted your application.",player[pn].player);
  1329.         optlog(ostring,zstring);
  1330.                 page(player[epn].player,ostring);
  1331.         break;
  1332.     case 10:sprintf(ostring,"%s rejected your application.",player[pn].player);
  1333.         optlog(ostring,zstring);
  1334.                 page(player[epn].player,ostring);
  1335.         break;
  1336.     case 11:sprintf(ostring,"%s: %s",player[pn].player,string);
  1337.         optlog(ostring,zstring);
  1338.                 page(player[epn].player,ostring);
  1339.         break;
  1340.     case 12:sprintf(ostring,"You were expelled from the %s alliance.",player[pn].teamname);
  1341.         optlog(ostring,zstring);
  1342.                 page(player[epn].player,ostring);
  1343.         break;
  1344.     case 20:sprintf(ostring,"%s transferd %s credits to your account.",player[pn].player,string);
  1345.         optlog(ostring,zstring);
  1346.                 page(player[epn].player,ostring);
  1347.         break;
  1348.     case 41:sprintf(ostring,"%s tried to steal your Freighters !",player[pn].player,player[epn].player);
  1349.         optlog(ostring,zstring);
  1350.         break;
  1351.     case 40:sprintf(ostring,"%s tried to steal your Y-Wing-Fighters !",player[pn].player,player[epn].player);
  1352.         optlog(ostring,zstring);
  1353.         break;
  1354.     case 46:sprintf(ostring,"%s stole %s of your Freighters !",player[pn].player,string,player[epn].player);
  1355.         optlog(ostring,zstring);
  1356.         break;
  1357.     case 45:sprintf(ostring,"%s stole %s of your Y-Wing-Fighters !",player[pn].player,string,player[epn].player);
  1358.         optlog(ostring,zstring);
  1359.         break;
  1360.     case 102:sprintf(ostring,"An Anti-Matter Bomb from %s exploded and \n destroyed 1 Government Planet.",player[pn].player);
  1361.         optlog(ostring,zstring);
  1362.                 page(player[epn].player,ostring);
  1363.         break;
  1364.     case 103:sprintf(ostring,"%s, sent missiles and destroyed 30 %% of your citizen.",player[pn].player);
  1365.         optlog(ostring,zstring);
  1366.                 page(player[epn].player,ostring);
  1367.         break;
  1368.     case 104:sprintf(ostring,"%s, sent missiles and destroyed 100 %% of your foodproduction units.",player[pn].player);
  1369.         optlog(ostring,zstring);
  1370.                 page(player[epn].player,ostring);
  1371.         break;
  1372.     case 105:sprintf(ostring,"%s, sent missiles and destroyed 50 %% of your army.",player[pn].player);
  1373.         optlog(ostring,zstring);
  1374.                 page(player[epn].player,ostring);
  1375.         break;
  1376.     case 106:sprintf(ostring,"%s, sent missiles and destroyed 50 %% of your Gov. Planets .",player[pn].player);
  1377.         optlog(ostring,zstring);
  1378.                 page(player[epn].player,ostring);
  1379.         break;
  1380.     case 108:sprintf(ostring,"You got a traitor from %s under your soilders.",player[pn].player);
  1381.         optlog(ostring,zstring);
  1382.                 page(player[epn].player,ostring);
  1383.         break;
  1384.     case 109:sprintf(ostring,"You got a mole from %s under your citizen.",player[pn].player);
  1385.         optlog(ostring,zstring);
  1386.                 page(player[epn].player,ostring);
  1387.         break;
  1388.     case 153:sprintf(ostring,"You repelled a thermonuclear missile attack from %s.",player[pn].player);
  1389.         optlog(ostring,zstring);
  1390.         break;
  1391.     case 154:sprintf(ostring,"You repelled a chemical missile attack from %s.",player[pn].player);
  1392.         optlog(ostring,zstring);
  1393.         break;
  1394.     case 155:sprintf(ostring,"You repelled a convetional missile attack from %s.",player[pn].player);
  1395.         optlog(ostring,zstring);
  1396.         break;
  1397.     case 156:sprintf(ostring,"You repelled a anti-matter missile attack from %s.",player[pn].player);
  1398.         optlog(ostring,zstring);
  1399.         break;
  1400.     case 201:sprintf(ostring,"%s throw you down from the uridium throne.",player[pn].player);
  1401.         optlog(ostring,zstring);
  1402.                 page(player[epn].player,ostring);
  1403.         break;
  1404.     }
  1405. }
  1406.  
  1407.  
  1408. ----> END OF PART 4 <----
  1409. -- 
  1410.       Internet: Dr_who@pegasus.ch         __
  1411.       Phone   : ++41-71-71 70 42         ///
  1412.       FAX     : ++41-71-71 27 87    __  ///    "I'M THE DOCTORE BECAUSE 
  1413.                                     \\\///      IT'S FUN FUN FUN ! "
  1414.      BBS Phone: ++41-71-71 55 77     \XX/       - TOM BAKER 
  1415.       X.25    : +228 4752 1 2574        
  1416.