home *** CD-ROM | disk | FTP | other *** search
- /* f17.c contains: offerbuy() */
-
- #include "mono:defines"
- #include "mono:xvariables"
-
- VOID offerbuy()
- {
- ULONG obclass, cost;
- BOOL picked, donebuying;
- USHORT buyprop, buyer, seller, obcode, hold_line;
- struct IntuiText address, msg0, msg1, msg2, msg3, msg4, msg5, msg6,
- msg7, msg8, msg9, dollar, msg10, msgY, msgN, msgC;
- struct Gadget offerbgag;
- struct StringInfo offerbinfo;
- obclass=0;
- obcode=0;
- picked=FALSE;
-
- address.BackPen=black;
- address.DrawMode=JAM1;
- address.TopEdge=0;
- address.LeftEdge=5;
- address.ITextFont=NULL;
- address.NextText=&msg0;
-
- msg0.FrontPen=dk_maroon;
- msg0.BackPen=black;
- msg0.DrawMode=JAM1;
- msg0.TopEdge=10;
- msg0.LeftEdge=5;
- msg0.IText=(UBYTE *)"Use the MENU to";
- msg0.ITextFont=NULL;
- msg0.NextText=&msg1;
-
- msg1.FrontPen=dk_maroon;
- msg1.BackPen=black;
- msg1.DrawMode=JAM1;
- msg1.TopEdge=20;
- msg1.LeftEdge=5;
- msg1.IText=(UBYTE *)"select the name of";
- msg1.ITextFont=NULL;
- msg1.NextText=&msg2;
-
- msg2.FrontPen=dk_maroon;
- msg2.BackPen=black;
- msg2.DrawMode=JAM1;
- msg2.TopEdge=30;
- msg2.LeftEdge=5;
- msg2.IText=(UBYTE *)"the buyer, or select";
- msg2.ITextFont=NULL;
- msg2.NextText=&msg3;
-
- msg3.FrontPen=dk_maroon;
- msg3.BackPen=black;
- msg3.DrawMode=JAM1;
- msg3.TopEdge=40;
- msg3.LeftEdge=5;
- msg3.IText=(UBYTE *)"CONTINUE to buy";
- msg3.ITextFont=NULL;
- msg3.NextText=&msg4;
-
- msg4.FrontPen=dk_maroon;
- msg4.BackPen=black;
- msg4.DrawMode=JAM1;
- msg4.TopEdge=50;
- msg4.LeftEdge=5;
- msg4.IText=(UBYTE *)"nothing and return";
- msg4.ITextFont=NULL;
- msg4.NextText=&msg5;
-
- msg5.FrontPen=dk_maroon;
- msg5.BackPen=black;
- msg5.DrawMode=JAM1;
- msg5.TopEdge=60;
- msg5.LeftEdge=5;
- msg5.IText=(UBYTE *)"to the game.";
- msg5.ITextFont=NULL;
- msg5.NextText=NULL;
-
- msg6.FrontPen=dk_maroon;
- msg6.BackPen=black;
- msg6.DrawMode=JAM1;
- msg6.TopEdge=70;
- msg6.LeftEdge=5;
- msg6.ITextFont=NULL;
- msg6.NextText=NULL;
-
- msg7.FrontPen=dk_maroon;
- msg7.BackPen=black;
- msg7.DrawMode=JAM1;
- msg7.TopEdge=80;
- msg7.LeftEdge=5;
- msg7.ITextFont=NULL;
- msg7.NextText=NULL;
-
- msg8.FrontPen=dk_maroon;
- msg8.BackPen=black;
- msg8.DrawMode=JAM1;
- msg8.TopEdge=89;
- msg8.LeftEdge=5;
- msg8.ITextFont=NULL;
- msg8.NextText=NULL;
-
- msg9.FrontPen=dk_maroon;
- msg9.BackPen=black;
- msg9.DrawMode=JAM1;
- msg9.TopEdge=98;
- msg9.LeftEdge=5;
- msg9.ITextFont=NULL;
- msg9.NextText=NULL;
-
- dollar.FrontPen=red;
- dollar.BackPen=black;
- dollar.DrawMode=JAM2;
- dollar.TopEdge=109;
- dollar.LeftEdge=41;
- dollar.IText=(UBYTE *)"$";
- dollar.ITextFont=NULL;
- dollar.NextText=NULL;
-
- msg10.IText=(UBYTE *)"Is this acceptable?";
- msg10.FrontPen=brite_green;
- msg10.BackPen=black;
- msg10.DrawMode=JAM1;
- msg10.TopEdge=110;
- msg10.LeftEdge=16;
- msg10.ITextFont=NULL;
- msg10.NextText=NULL;
-
- msgY.IText=(UBYTE *)"YES";
- msgY.FrontPen=green;
- msgY.BackPen=black;
- msgY.DrawMode=JAM1;
- msgY.TopEdge=80;
- msgY.LeftEdge=133;
- msgY.ITextFont=NULL;
- msgY.NextText=NULL;
-
- msgN.IText=(UBYTE *)"NO";
- msgN.FrontPen=red;
- msgN.BackPen=black;
- msgN.DrawMode=JAM1;
- msgN.TopEdge=89;
- msgN.LeftEdge=149;
- msgN.ITextFont=NULL;
- msgN.NextText=NULL;
-
- msgC.IText=(UBYTE *)"CONTINUE";
- msgC.FrontPen=green;
- msgC.BackPen=black;
- msgC.DrawMode=JAM1;
- msgC.TopEdge=40;
- msgC.LeftEdge=5;
- msgC.ITextFont=NULL;
- msgC.NextText=NULL;
-
- offerbgag.NextGadget=&yesgag;
- offerbgag.LeftEdge=50;
- offerbgag.TopEdge=109;
- offerbgag.Width=53;
- offerbgag.Height=10;
- offerbgag.Flags=GADGHNONE;
- offerbgag.Activation=LONGINT | GADGIMMEDIATE;
- offerbgag.GadgetType=STRGADGET;
- offerbgag.GadgetRender=(APTR)&bidborder;
- offerbgag.SelectRender=NULL;
- offerbgag.GadgetText=NULL;
- offerbgag.MutualExclude=NULL;
- offerbgag.SpecialInfo=(APTR)&offerbinfo;
- offerbgag.GadgetID=9;
- offerbgag.UserData=NULL;
-
- offerbinfo.Buffer=nbufofferb;
- offerbinfo.UndoBuffer=undobufi;
- offerbinfo.MaxChars=6;
- offerbinfo.BufferPos=0;
- offerbinfo.DispPos=0;
- offerbinfo.LongInt=0;
-
-
-
- nofferbw.Screen=screen1;
- nofferbw.IDCMPFlags=MENUPICK | GADGETUP | RAWKEY;
- nofferbw.FirstGadget=&continuegag;
- if ((offerbwindow=(struct Window *)OpenWindow(&nofferbw))==NULL) cleanup();
- rportofferb=offerbwindow->RPort;
- Menu13.MenuName=(UBYTE *)"BUYER'S NAME";
- SetMenuStrip(offerbwindow, &Menu13);
-
- if (nsp == 2)
- {
- OnMenu(offerbwindow, 0);
- OnMenu(offerbwindow, 32);
- }
- if (nsp == 3)
- {
- OffMenu(offerbwindow, 0);
- OffMenu(offerbwindow, 32);
- OffMenu(offerbwindow, 64);
- if (!notplaying[0]) OnMenu(offerbwindow, 0);
- if (!notplaying[1]) OnMenu(offerbwindow, 32);
- if (!notplaying[2]) OnMenu(offerbwindow, 64);
- }
- if (nsp == 4)
- {
- OffMenu(offerbwindow, 0);
- OffMenu(offerbwindow, 32);
- OffMenu(offerbwindow, 64);
- OffMenu(offerbwindow, 96);
- if (!notplaying[0]) OnMenu(offerbwindow, 0);
- if (!notplaying[1]) OnMenu(offerbwindow, 32);
- if (!notplaying[2]) OnMenu(offerbwindow, 64);
- if (!notplaying[3]) OnMenu(offerbwindow, 96);
- }
-
- msg3.NextText=&msgC;
- msgC.NextText=&msg4;
-
- PrintIText(rportofferb, &msg0, 0, 30);
-
- msg3.NextText=&msg4;
-
- line0_text=109;
- for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
- instructIT[j].IText=instructline[hold_line++];
-
- donebuying=FALSE;
- while (!donebuying)
- {
- Wait(1<<offerbwindow->UserPort->mp_SigBit);
-
- while((offerbmsg=(struct IntuiMessage *)
- GetMsg(offerbwindow->UserPort))!=NULL)
- {
- obclass=offerbmsg->Class;
- obcode=offerbmsg->Code;
- if (obclass == GADGETUP) getID(offerbmsg);
- ReplyMsg(offerbmsg);
- }
- if ( (obclass == RAWKEY) && (obcode == HELP) ) instruction();
- if (obclass == GADGETUP)
- {
- if (gagid == 0) /* CONTINUE */
- {
- ClearMenuStrip(offerbwindow);
- RemoveGadget(offerbwindow, &continuegag);
- CloseWindow(offerbwindow);
- return;
- }
- }
-
- if ( (obclass == MENUPICK) && (obcode != MENUNULL) )
- {
- buyer=(USHORT)ITEMNUM(obcode);
- donebuying=TRUE;
- }
- }
- ClearMenuStrip(offerbwindow);
- RemoveGadget(offerbwindow, &continuegag);
- CloseWindow(offerbwindow);
- yesgag.TopEdge=130;
- nogag.TopEdge=130;
- yesgag.LeftEdge=145;
- nogag.LeftEdge=10;
-
- if (buyer == 0)
- {
- address.IText=&name0[0];
- address.FrontPen=25;
- }
- if (buyer == 1)
- {
- address.FrontPen=26;
- address.IText=&name1[0];
- }
- if (buyer == 2)
- {
- address.FrontPen=27;
- address.IText=&name2[0];
- }
- if (buyer == 3)
- {
- address.FrontPen=28;
- address.IText=&name3[0];
- }
- msg0.IText=(UBYTE *)"use the MENU to pick";
- msg1.IText=(UBYTE *)"an asset upon which";
- msg2.IText=(UBYTE *)"to make an offer.";
- msg3.IText=(UBYTE *)"Select, delete, and";
- msg4.IText=(UBYTE *)"change the dollar";
- msg5.IText=(UBYTE *)"GADGET to show the ";
- msg6.IText=(UBYTE *)"amount of your offer.";
- msg7.IText=(UBYTE *)"Finally, select YES to";
- msg8.IText=(UBYTE *)"make the offer or NO";
- msg9.IText=(UBYTE *)"to return to the game.";
-
- msg5.NextText=&msg6;
- msg6.NextText=&msg7;
- msg7.NextText=&msg8;
- msg8.NextText=&msg9;
- msg9.NextText=&msgY;
- msgY.NextText=&msgN;
- msgN.NextText=$
-
- nofferbw.FirstGadget=&offerbgag;
- if ((offerbwindow=(struct Window *)OpenWindow(&nofferbw))==NULL) cleanup();
- rportofferb=offerbwindow->RPort;
- SetMenuStrip(offerbwindow, &Menu14);
- fixofferbmenu(buyer);
- PrintIText(rportofferb, &address, 0, 0);
-
- donebuying=FALSE;
- while (!donebuying)
- {
- Wait(1<<offerbwindow->UserPort->mp_SigBit);
-
- while((offerbmsg=(struct IntuiMessage *)
- GetMsg(offerbwindow->UserPort))!=NULL)
- {
- obclass=offerbmsg->Class;
- obcode=offerbmsg->Code;
- if (obclass == GADGETUP) getID(offerbmsg);
- ReplyMsg(offerbmsg);
- }
- if ( (obclass == RAWKEY) && (obcode == HELP) ) instruction();
- if (obclass == GADGETUP)
- {
- if (gagid == NO)
- {
- ClearMenuStrip(offerbwindow);
- RemoveGadget(offerbwindow, &nogag);
- RemoveGadget(offerbwindow, &yesgag);
- RemoveGadget(offerbwindow, &offerbgag);
- CloseWindow(offerbwindow);
- yesgag.NextGadget=&nogag;
- return;
- }
- if ( (gagid == YES) && picked)
- {
- ClearMenuStrip(offerbwindow);
- RemoveGadget(offerbwindow, &nogag);
- RemoveGadget(offerbwindow, &yesgag);
- RemoveGadget(offerbwindow, &offerbgag);
- CloseWindow(offerbwindow);
- yesgag.NextGadget=&nogag;
- donebuying=TRUE;
- }
- }
- if ( (obclass == MENUPICK) && (obcode != MENUNULL) )
- {
- picked=TRUE;
- if (ITEMNUM(obcode) == 0)
- {
- if (SUBNUM(obcode) == 0) buyprop=1;
- if (SUBNUM(obcode) == 1) buyprop=3;
- }
- if (ITEMNUM(obcode) == 1)
- {
- if (SUBNUM(obcode) == 0) buyprop=6;
- if (SUBNUM(obcode) == 1) buyprop=8;
- if (SUBNUM(obcode) == 2) buyprop=9;
- }
- if (ITEMNUM(obcode) == 2)
- {
- if (SUBNUM(obcode) == 0) buyprop=11;
- if (SUBNUM(obcode) == 1) buyprop=13;
- if (SUBNUM(obcode) == 2) buyprop=14;
- }
- if (ITEMNUM(obcode) == 3)
- {
- if (SUBNUM(obcode) == 0) buyprop=16;
- if (SUBNUM(obcode) == 1) buyprop=18;
- if (SUBNUM(obcode) == 2) buyprop=19;
- }
- if (ITEMNUM(obcode) == 4)
- {
- if (SUBNUM(obcode) == 0) buyprop=21;
- if (SUBNUM(obcode) == 1) buyprop=23;
- if (SUBNUM(obcode) == 2) buyprop=24;
- }
- if (ITEMNUM(obcode) == 5)
- {
- if (SUBNUM(obcode) == 0) buyprop=26;
- if (SUBNUM(obcode) == 1) buyprop=27;
- if (SUBNUM(obcode) == 2) buyprop=29;
- }
- if (ITEMNUM(obcode) == 6)
- {
- if (SUBNUM(obcode) == 0) buyprop=31;
- if (SUBNUM(obcode) == 1) buyprop=32;
- if (SUBNUM(obcode) == 2) buyprop=34;
- }
- if (ITEMNUM(obcode) == 7)
- {
- if (SUBNUM(obcode) == 0) buyprop=37;
- if (SUBNUM(obcode) == 1) buyprop=39;
- }
- if (ITEMNUM(obcode) == 8)
- {
- if (SUBNUM(obcode) == 0) buyprop=5;
- if (SUBNUM(obcode) == 1) buyprop=15;
- if (SUBNUM(obcode) == 2) buyprop=25;
- if (SUBNUM(obcode) == 3) buyprop=35;
- }
- if (ITEMNUM(obcode) == 9)
- {
- if (SUBNUM(obcode) == 0) buyprop=12;
- if (SUBNUM(obcode) == 1) buyprop=28;
- }
- if (ITEMNUM(obcode) == 10)
- {
- buyprop=99;
- }
- }
- }
-
- if (buyprop == 99)
- {
- seller=buycard(buyer);
- if (seller == 9) return;
- if (seller == 0)
- {
- msg0.IText=&name0[0];
- msg0.FrontPen=25;
- }
- if (seller == 1)
- {
- msg0.FrontPen=26;
- msg0.IText=&name1[0];
- }
- if (seller == 2)
- {
- msg0.FrontPen=27;
- msg0.IText=&name2[0];
- }
- if (seller == 3)
- {
- msg0.FrontPen=28;
- msg0.IText=&name3[0];
- }
- }
- else
- {
- if (owner[buyprop] == 0)
- {
- msg0.IText=&name0[0];
- msg0.FrontPen=25;
- }
- if (owner[buyprop] == 1)
- {
- msg0.FrontPen=26;
- msg0.IText=&name1[0];
- }
- if (owner[buyprop] == 2)
- {
- msg0.FrontPen=27;
- msg0.IText=&name2[0];
- }
- if (owner[buyprop] == 3)
- {
- msg0.FrontPen=28;
- msg0.IText=&name3[0];
- }
- }
- msg0.NextText=&msg1;
- msg2.NextText=&msg3;
- msg4.NextText=&msg5;
- msg5.NextText=&msg10;
- msg1.IText=(UBYTE *)"you have an offer of";
- msg1.NextText=$
- msg2.IText=&nbufofferb[0];
- msg2.FrontPen=green;
- msg2.LeftEdge=14;
- msg2.NextText=&msg3;
- dollar.FrontPen=green;
- dollar.NextText=&msg2;
- dollar.TopEdge=30;
- dollar.LeftEdge=5;
- msg3.IText=(UBYTE *)"from";
- msg3.NextText=&address;
- address.TopEdge=50;
- address.NextText=&msg4;
- msg4.IText=(UBYTE *)"for";
- msg4.TopEdge=60;
- msg5.TopEdge=70;
-
- if (buyprop == 99)
- {
- msg4.IText=(UBYTE *)"for your";
- msg5.IText=(UBYTE *)"GET-OUT-OF-JAIL-FREE";
- msg6.IText=(UBYTE *)"card.";
- msg5.FrontPen=chest_yellow;
- msg5.NextText=&msg6;
- msg6.NextText=&msg10;
- msg6.TopEdge=80;
- }
- if (buyprop == 1)
- {
- msg5.IText=(UBYTE *)"MEDITERRANEAN AVENUE";
- msg5.FrontPen=purple;
- }
- if (buyprop == 3)
- {
- msg5.IText=(UBYTE *)"BALTIC AVENUE";
- msg5.FrontPen=purple;
- }
- if (buyprop == 5)
- {
- msg5.IText=(UBYTE *)"READING RR";
- msg5.FrontPen=flesh;
- }
- if (buyprop == 6)
- {
- msg5.IText=(UBYTE *)"ORIENTAL AVENUE";
- msg5.FrontPen=lt_blue;
- }
- if (buyprop == 8)
- {
- msg5.IText=(UBYTE *)"VERMONT AVENUE";
- msg5.FrontPen=lt_blue;
- }
- if (buyprop == 9)
- {
- msg5.IText=(UBYTE *)"CONNECTICUT AVENUE";
- msg5.FrontPen=lt_blue;
- }
-
- if (buyprop == 11)
- {
- msg5.IText=(UBYTE *)"ST. CHARLES PLACE";
- msg5.FrontPen=maroon;
- }
- if (buyprop == 12)
- {
- msg5.IText=(UBYTE *)"ELECTRIC COMPANY";
- msg5.FrontPen=yellow;
- }
- if (buyprop == 13)
- {
- msg5.IText=(UBYTE *)"STATES AVENUE";
- msg5.FrontPen=maroon;
- }
- if (buyprop == 14)
- {
- msg5.IText=(UBYTE *)"VIRGINIA AVENUE";
- msg5.FrontPen=maroon;
- }
- if (buyprop == 15)
- {
- msg5.IText=(UBYTE *)"PENNSYLVANIA RR";
- msg5.FrontPen=flesh;
- }
- if (buyprop == 16)
- {
- msg5.IText=(UBYTE *)"ST. JAMES PLACE";
- msg5.FrontPen=orange;
- }
- if (buyprop == 18)
- {
- msg5.IText=(UBYTE *)"TENNESSEE AVENUE";
- msg5.FrontPen=orange;
- }
- if (buyprop == 19)
- {
- msg5.IText=(UBYTE *)"NEW YORK AVENUE";
- msg5.FrontPen=orange;
- }
- if (buyprop == 21)
- {
- msg5.IText=(UBYTE *)"KENTUCKY AVENUE";
- msg5.FrontPen=red;
- }
- if (buyprop == 23)
- {
- msg5.IText=(UBYTE *)"INDIANA AVENUE";
- msg5.FrontPen=red;
- }
- if (buyprop == 24)
- {
- msg5.IText=(UBYTE *)"ILLINOIS AVENUE";
- msg5.FrontPen=red;
- }
- if (buyprop == 25)
- {
- msg5.IText=(UBYTE *)"B. & O. RR";
- msg5.FrontPen=flesh;
- }
- if (buyprop == 26)
- {
- msg5.IText=(UBYTE *)"ATLANTIC AVENUE";
- msg5.FrontPen=yellow;
- }
- if (buyprop == 27)
- {
- msg5.IText=(UBYTE *)"VENTNOR AVENUE";
- msg5.FrontPen=yellow;
- }
- if (buyprop == 28)
- {
- msg5.IText=(UBYTE *)"WATER WORKS";
- msg5.FrontPen=royal_blue;
- }
- if (buyprop == 29)
- {
- msg5.IText=(UBYTE *)"MARVIN GARDENS";
- msg5.FrontPen=yellow;
- }
- if (buyprop == 31)
- {
- msg5.IText=(UBYTE *)"PACIFIC AVENUE";
- msg5.FrontPen=green;
- }
- if (buyprop == 32)
- {
- msg5.IText=(UBYTE *)"NORTH CAROLINA AVENUE";
- msg5.FrontPen=green;
- }
- if (buyprop == 34)
- {
- msg5.IText=(UBYTE *)"PENNSYLVANIA AVENUE";
- msg5.FrontPen=green;
- }
- if (buyprop == 35)
- {
- msg5.IText=(UBYTE *)"SHORT LINE";
- msg5.FrontPen=flesh;
- }
- if (buyprop == 37)
- {
- msg5.IText=(UBYTE *)"PARK PLACE";
- msg5.FrontPen=dk_blue;
- }
- if (buyprop == 39)
- {
- msg5.IText=(UBYTE *)"BOARDWALK";
- msg5.FrontPen=dk_blue;
- }
-
- nofferbw.FirstGadget=&yesgag;
- nofferbw.IDCMPFlags=GADGETUP | RAWKEY;
- if ((offerbwindow=(struct Window *)OpenWindow(&nofferbw))==NULL)
- cleanup();
- rportofferb=offerbwindow->RPort;
- PrintIText(rportofferb, &msg0, 0, 0);
-
- donebuying=FALSE;
- while (!donebuying)
- {
- Wait(1<<offerbwindow->UserPort->mp_SigBit);
-
- while((offerbmsg=(struct IntuiMessage *)
- GetMsg(offerbwindow->UserPort))!=NULL)
- {
- obclass=offerbmsg->Class;
- obcode=offerbmsg->Code;
- if (obclass == GADGETUP) getID(offerbmsg);
- ReplyMsg(offerbmsg);
- }
- if ( (obclass == RAWKEY) && (obcode == HELP) ) instruction();
- if (obclass == GADGETUP)
- {
- if (gagid == NO) donebuying=TRUE;
- if (gagid == YES)
- {
- donebuying=TRUE;
- cost=offerbinfo.LongInt;
- if (buyprop != 99)
- transfertitle(buyer, owner[buyprop], buyprop, cost);
- if (buyprop == 99)
- {
- eft(buyer, seller, cost);
- freecard[seller]--;
- freecard[buyer]++;
- }
- }
- }
- }
- RemoveGadget(offerbwindow, &nogag);
- RemoveGadget(offerbwindow, &yesgag);
- CloseWindow(offerbwindow);
- yesgag.NextGadget=&nogag;
- return;
- }
-
-