home *** CD-ROM | disk | FTP | other *** search
- /* f8.c contains these functions for monopoly:
- buildhouse(), sellhouse(), makemortgage(),
- liftmortgage(), fixtransmenu(), cktransactmsg(), */
-
- #include "mono:defines"
- #include "mono:xvariables"
-
- VOID cktransactmsg()
- {
- ULONG tclass;
- USHORT tcode;
- tclass=0;
- tcode=0;
-
- while (transactmsg=(struct IntuiMessage *)GetMsg(transactwindow->UserPort))
- {
- tclass = transactmsg->Class;
- tcode = transactmsg->Code;
- ReplyMsg(transactmsg);
- }
- if ( (tclass == RAWKEY) && (tcode == HELP) ) instruction();
- if (tclass == GADGETUP) donetransact=TRUE;
- if ( (tclass == MENUPICK) && (tcode != MENUNULL) )
- {
- property = servicetransmenu(MENUNUM(tcode), ITEMNUM(tcode), SUBNUM(tcode));
- donetransact=TRUE;
- }
- }
-
- VOID buildhouse(who)
- USHORT who;
- {
- USHORT buildprop, hold_line;
- struct IntuiText name;
-
- name.BackPen=black;
- name.DrawMode=JAM1;
- name.TopEdge=cname.TopEdge;
- name.LeftEdge=cname.LeftEdge;
- name.ITextFont=NULL;
- name.NextText=NULL;
- if (who == 0)
- {
- name.IText=&name0[0];
- name.FrontPen=25;
- }
- if (who == 1)
- {
- name.IText=&name1[0];
- name.FrontPen=26;
- }
- if (who == 2)
- {
- name.IText=&name2[0];
- name.FrontPen=27;
- }
- if (who == 3)
- {
- name.IText=&name3[0];
- name.FrontPen=28;
- }
- transactnote0.IText=(UBYTE *)"Use the menu to choose";
- transactnote1.IText=(UBYTE *)"a property upon which";
- transactnote2.IText=(UBYTE *)"to BUILD a house.";
- transactnote3.IText=(UBYTE *)"NOTE: A hotel is";
- transactnote4.IText=(UBYTE *)"simply FIVE houses.";
- ntransactw.Screen=screen1;
- if ((transactwindow=(struct Window *)OpenWindow(&ntransactw))==NULL) cleanup();
- rporttransact=transactwindow->RPort;
- SetMenuStrip(transactwindow, &Menu5);
- fixtransmenu(BUILD, who);
- PrintIText(rporttransact, &name, 0, 0);
- PrintIText(rporttransact, &transactnote0, 0, 0);
- PrintIText(rporttransact, &transactnote1, 0, 0);
- PrintIText(rporttransact, &transactnote2, 0, 0);
- PrintIText(rporttransact, &transactnote3, 0, 10);
- PrintIText(rporttransact, &transactnote4, 0, 10);
- pickedprop=FALSE;
-
- line0_text=48;
- for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
- instructIT[j].IText=instructline[hold_line++];
-
- donetransact=FALSE;
- while (!donetransact)
- {
- if (1<<transactwindow->UserPort->mp_SigBit) cktransactmsg();
- }
- ClearMenuStrip(transactwindow);
- CloseWindow(transactwindow);
- if (pickedprop)
- {
- buildprop=property;
- building=TRUE;
- eft(owner[buildprop], BANK, housecost[buildprop]);
- if (!building) goto exbuildhouse;
- numhouses[buildprop]++;
- if (numhouses[buildprop] < 5)
- drawhouse(buildprop, TRUE);
- else
- {
- drawhouse(buildprop, FALSE);
- drawhotel(buildprop, TRUE);
- }
- pickedprop=FALSE;
- }
- exbuildhouse:
- building=FALSE;
- fixmenu();
- }
-
- VOID sellhouse(who)
- USHORT who;
- {
- USHORT sellprop, hold_line;
- struct IntuiText name;
-
- name.BackPen=black;
- name.DrawMode=JAM1;
- name.TopEdge=cname.TopEdge;
- name.LeftEdge=cname.LeftEdge;
- name.ITextFont=NULL;
- name.NextText=NULL;
- if (who == 0)
- {
- name.IText=&name0[0];
- name.FrontPen=25;
- }
- if (who == 1)
- {
- name.IText=&name1[0];
- name.FrontPen=26;
- }
- if (who == 2)
- {
- name.IText=&name2[0];
- name.FrontPen=27;
- }
- if (who == 3)
- {
- name.IText=&name3[0];
- name.FrontPen=28;
- }
- transactnote0.IText=(UBYTE *)"Use the menu to choose";
- transactnote1.IText=(UBYTE *)"a property from which";
- transactnote2.IText=(UBYTE *)"to REMOVE a house.";
- transactnote3.IText=(UBYTE *)"NOTE: A hotel is";
- transactnote4.IText=(UBYTE *)"simply FIVE houses.";
- ntransactw.Screen=screen1;
- if ((transactwindow=(struct Window *)OpenWindow(&ntransactw))==NULL) cleanup();
- rporttransact=transactwindow->RPort;
- SetMenuStrip(transactwindow, &Menu5);
- fixtransmenu(SELL, who);
- PrintIText(rporttransact, &name, 0, 0);
- PrintIText(rporttransact, &transactnote0, 0, 0);
- PrintIText(rporttransact, &transactnote1, 0, 0);
- PrintIText(rporttransact, &transactnote2, 0, 0);
- PrintIText(rporttransact, &transactnote3, 0, 10);
- PrintIText(rporttransact, &transactnote4, 0, 10);
- pickedprop=FALSE;
-
- line0_text=59;
- for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
- instructIT[j].IText=instructline[hold_line++];
-
- donetransact=FALSE;
- while (!donetransact)
- {
- if (1<<transactwindow->UserPort->mp_SigBit) cktransactmsg();
- }
- ClearMenuStrip(transactwindow);
- CloseWindow(transactwindow);
- if (pickedprop)
- {
- sellprop=property;
- eft(BANK, owner[sellprop], (housecost[sellprop]/2) );
- numhouses[sellprop]--;
- if (numhouses[sellprop] == 4) drawhotel(sellprop, FALSE);
- else drawhouse(sellprop, FALSE);
- pickedprop=FALSE;
- drawhouse(sellprop, TRUE);
- }
- fixmenu();
- }
-
- VOID makemortgage(who)
- USHORT who;
- {
- USHORT morgprop, hold_line;
- struct IntuiText name;
-
- name.BackPen=black;
- name.DrawMode=JAM1;
- name.TopEdge=cname.TopEdge;
- name.LeftEdge=cname.LeftEdge;
- name.ITextFont=NULL;
- name.NextText=NULL;
- if (who == 0)
- {
- name.IText=&name0[0];
- name.FrontPen=25;
- }
- if (who == 1)
- {
- name.IText=&name1[0];
- name.FrontPen=26;
- }
- if (who == 2)
- {
- name.IText=&name2[0];
- name.FrontPen=27;
- }
- if (who == 3)
- {
- name.IText=&name3[0];
- name.FrontPen=28;
- }
- transactnote0.IText=(UBYTE *)"Use the menu to choose";
- transactnote1.IText=(UBYTE *)"the property which you";
- transactnote2.IText=(UBYTE *)"wish to mortgage.";
- transactnote3.IText=(UBYTE *)"NOTE: the property may";
- transactnote4.IText=(UBYTE *)"NOT be improved. Sell";
- transactnote5.IText=(UBYTE *)"hotel or houses first!";
- ntransactw.Screen=screen1;
- if ((transactwindow=(struct Window *)OpenWindow(&ntransactw))==NULL) cleanup();
- rporttransact=transactwindow->RPort;
- SetMenuStrip(transactwindow, &Menu5);
- fixtransmenu(MAKE, who);
- PrintIText(rporttransact, &name, 0, 0);
- PrintIText(rporttransact, &transactnote0, 0, 0);
- PrintIText(rporttransact, &transactnote1, 0, 0);
- PrintIText(rporttransact, &transactnote2, 0, 0);
- PrintIText(rporttransact, &transactnote3, 0, 10);
- PrintIText(rporttransact, &transactnote4, 0, 10);
- PrintIText(rporttransact, &transactnote5, 0, 10);
- pickedprop=FALSE;
-
- line0_text=65;
- for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
- instructIT[j].IText=instructline[hold_line++];
-
- donetransact=FALSE;
- while (!donetransact)
- {
- if (1<<transactwindow->UserPort->mp_SigBit) cktransactmsg();
- }
- ClearMenuStrip(transactwindow);
- CloseWindow(transactwindow);
- if (pickedprop)
- {
- morgprop=property;
- eft(BANK, owner[morgprop], (propcost[morgprop]/2));
- ismorg[morgprop]=TRUE;
- em(morgprop, TRUE);
- pickedprop=FALSE;
- }
- fixmenu();
- }
-
- VOID liftmortgage(who)
- USHORT who;
- {
- USHORT liftprop, hold_line;
- struct IntuiText name;
-
- name.BackPen=black;
- name.DrawMode=JAM1;
- name.TopEdge=cname.TopEdge;
- name.LeftEdge=cname.LeftEdge;
- name.ITextFont=NULL;
- name.NextText=NULL;
- if (who == 0)
- {
- name.IText=&name0[0];
- name.FrontPen=25;
- }
- if (who == 1)
- {
- name.IText=&name1[0];
- name.FrontPen=26;
- }
- if (who == 2)
- {
- name.IText=&name2[0];
- name.FrontPen=27;
- }
- if (who == 3)
- {
- name.IText=&name3[0];
- name.FrontPen=28;
- }
- transactnote0.IText=(UBYTE *)"Use the menu to choose";
- transactnote1.IText=(UBYTE *)"the property from which";
- transactnote2.IText=(UBYTE *)"to REMOVE the mortgage.";
- ntransactw.Screen=screen1;
- if ((transactwindow=(struct Window *)OpenWindow(&ntransactw))==NULL) cleanup();
- rporttransact=transactwindow->RPort;
- SetMenuStrip(transactwindow, &Menu5);
- fixtransmenu(LIFT, who);
- PrintIText(rporttransact, &name, 0, 0);
- PrintIText(rporttransact, &transactnote0, 0, 0);
- PrintIText(rporttransact, &transactnote1, 0, 0);
- PrintIText(rporttransact, &transactnote2, 0, 0);
- pickedprop=FALSE;
-
- line0_text=72;
- for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
- instructIT[j].IText=instructline[hold_line++];
-
- donetransact=FALSE;
- while (!donetransact)
- {
- if (1<<transactwindow->UserPort->mp_SigBit) cktransactmsg();
- }
- ClearMenuStrip(transactwindow);
- CloseWindow(transactwindow);
- if (pickedprop)
- {
- liftprop=property;
- if ( (liftprop == 12) || (liftprop ==28) )
- {
- mortgaging=TRUE;
- eft(owner[liftprop], BANK, (75+7) );
- if (!mortgaging) goto exliftmorg;
- }
- else
- {
- mortgaging=TRUE;
- eft(owner[liftprop], BANK, (propcost[liftprop]/2));
- if (!mortgaging) goto exliftmorg;
- }
- ismorg[liftprop]=FALSE;
- em(liftprop, FALSE);
- pickedprop=FALSE;
- }
- exliftmorg:
- mortgaging=FALSE;
- fixmenu();
- }
-
-