home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / prog_oth / monopoly.lzh / monopoly_source.LZH / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-06  |  3.3 KB  |  132 lines

  1.  
  2.  
  3.  
  4. #include "mono:defines"    /*  has all #includes & #defines  */
  5. #include "mono:variables"  /*  has all global variables      */ 
  6.  
  7.  
  8. main()
  9. {
  10. struct FileHandle *file;
  11.  
  12. IFFP iffp = NO_FILE;
  13.  
  14. srand(time(NULL)); /*  randomize using current time  */
  15. isinjail[0]=isinjail[1]=isinjail[2]=isinjail[3]=FALSE;/*  no one IN JAIL   */
  16. free_parking=FALSE;  /*   default to standard rule   */
  17. bankroll[0]=bankroll[1]=bankroll[2]=bankroll[3]=1500L; /*  $1500 to start  */
  18. bankroll[4]=0L;
  19. bankroll[5]=999999L;
  20. building=mortgaging=FALSE;
  21.  
  22.  
  23. if(!(GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",GRAPHICS_REV)))
  24.       cleanexit("Can't open graphics library\n");
  25.  
  26. if(!(IntuitionBase=
  27.      (struct IntuitionBase *)OpenLibrary("intuition.library",INTUITION_REV)))
  28.       cleanexit("Can't open graphics library\n");
  29.  
  30. shuffle(0);
  31. shuffle(1);
  32. fillattr();
  33. fill_instruct_text();
  34.  
  35. if (file = Open(&picture_file[0], MODE_OLDFILE))
  36.    {
  37.    iffp = ReadPicture(file);
  38.    Close(file);
  39.    if (iffp == IFF_DONE)
  40.       {
  41.       error = DisplayPic(&ilbmFrame);
  42.       if(error)  cleanexit("Can't open screen or window\n");
  43.       Delay(150);   /*   SHOW BOARD AS INTRO ART   */     
  44.       getplayerinfo();
  45.       nsp=ntp;
  46.       (VOID) random_start();
  47.       makemenu();
  48.       SetMenuStrip(boardwindow, &Menu0);
  49.       OffMenu(boardwindow, 35);  /*  M3I1S0  jail  */
  50.       OffMenu(boardwindow, 67);  /*  M3I2S0   "    */
  51.       OffMenu(boardwindow, 99);  /*  M3I3S0   "    */
  52.  
  53.       fixmenu();
  54.       cname.BackPen=0;
  55.       cname.DrawMode=JAM1;
  56.       cname.LeftEdge=5;
  57.       cname.TopEdge=8;
  58.       cname.ITextFont=NULL;
  59.       cname.NextText=NULL;
  60.       cname.FrontPen=25;
  61.       cname.IText=&name0[0];
  62.       writeyourturn();
  63.       
  64.       if (ntp == 2) 
  65.          {
  66.      notplaying[0]=FALSE;
  67.          notplaying[1]=FALSE;
  68.      notplaying[2]=TRUE;
  69.      notplaying[3]=TRUE;
  70.      }
  71.       if (ntp == 3) 
  72.          {
  73.      notplaying[0]=FALSE;
  74.          notplaying[1]=FALSE;
  75.      notplaying[2]=FALSE;
  76.      notplaying[3]=TRUE;
  77.      }
  78.       if (ntp == 4) 
  79.          {
  80.      notplaying[0]=FALSE;
  81.          notplaying[1]=FALSE;
  82.      notplaying[2]=FALSE;
  83.      notplaying[3]=FALSE;
  84.      }
  85.       bob();
  86.       REDX=   go[0][0];
  87.       REDY=   go[1][0];
  88.       GREENX= go[0][1];
  89.       GREENY= go[1][1];
  90.       if ((ntp == 3) || (ntp ==4))
  91.          {
  92.          BLUEX=  go[0][2];
  93.          BLUEY=  go[1][2];
  94.      }
  95.       if (ntp == 4)
  96.          {
  97.          YELLOWX=go[0][3];
  98.          YELLOWY=go[1][3];
  99.      } 
  100.       WaitTOF();
  101.       DrawGels();
  102.  
  103.          done = FALSE;      /* Close flag       */
  104.          while (!done)
  105.             {
  106.             if (1<<boardwindow->UserPort->mp_SigBit)   ckmanemsg();
  107.             }
  108.  
  109.  
  110. printf("FINAL TOTALS:\n");
  111. ahead();
  112. if (!notplaying[0])  printf("%s had %ld\n", &name0, net_worth[0]);
  113. if (!notplaying[1]) printf("%s had %ld\n", &name1, net_worth[1]);
  114. if (!notplaying[2]) printf("%s had %ld\n", &name2, net_worth[2]);
  115. if (!notplaying[3]) printf("%s had %ld\n", &name3, net_worth[3]);  
  116. if (ahead() == 0) printf("%s wins with %ld\n", &name0, net_worth[0]);
  117. if (ahead() == 1) printf("%s wins with %ld\n", &name1, net_worth[1]);
  118. if (ahead() == 2) printf("%s wins with %ld\n", &name2, net_worth[2]);
  119. if (ahead() == 3) printf("%s wins with %ld\n", &name3, net_worth[3]);
  120. if (ahead() == 5) printf("no one wins -- TIE\n");
  121.          }
  122.       else cleanexit(IFFPMessages[-iffp]);
  123.       }
  124.    else cleanexit("Picture file not found.\n");
  125.  
  126. cleanup();
  127. return(0);
  128. }       /*  end of main()   */
  129.  
  130.  
  131.  
  132.