[net.sources.bugs] Patch #1 for Phantasia 3.3.1+

nonh@utzoo.UUCP (Chris Robertson) (10/10/85)

This is Patch #1 for Phantasia 3.3.1+, distributed by Chris Robertson.  It
is suitable for use with "patch", or may be easily applied by hand.

Problem:	Prices print as zero or negative in trading posts;  you
		can buy "max 0" of anything.
		Also forgot to show brains as well as mana in the
		trading posts stats display.

Fix:		Use "%ld" in printw, not "%d", and don't do last-minute
		fixes just before posting sources.

Index: func0.c
*** old.func0.c	Thu Oct 10 09:50:46 1985
--- func0.c	Thu Oct 10 12:06:04 1985
***************
*** 676,682
  	mvprintw(5,0,"L: Leave  P: Purchase  S: Sell Gems?  ");
  	move(7,0);
  	for (loop = 0; loop < size; ++loop)
! 		printw("(%d) %-30.30s: %6d\n",loop+1,menu[loop].item,menu[loop].cost);
  PROMPT: adjuststats(stat);
  	mvprintw(1,0,"Gold:   %9.0f  Gems:  %9.0f  Level:    %6u  Charms: %6d\n",
  				stat->gld,stat->gem,stat->lvl,stat->chm);

--- 676,682 -----
  	mvprintw(5,0,"L: Leave  P: Purchase  S: Sell Gems?  ");
  	move(7,0);
  	for (loop = 0; loop < size; ++loop)
! 		printw("(%d) %-30.30s: %6ld\n",loop+1,menu[loop].item,menu[loop].cost);
  PROMPT: adjuststats(stat);
  	mvprintw(1,0,"Gold:   %9.0f  Gems:  %9.0f  Level:    %6u  Charms: %6d\n",
  				stat->gld,stat->gem,stat->lvl,stat->chm);
***************
*** 682,688
  				stat->gld,stat->gem,stat->lvl,stat->chm);
  	printw("Shield: %9.0f  Sword: %9.0f  Quicksilver: %3d  Blessed: %s\n",
  	stat->shd,stat->swd,stat->quks,(stat->bls? " True" : "False"));
! 	printw("Mana:   %9.0f",stat->man);
  	move(5,38);
  	ch = getans("LPS", FALSE);
  	move(15,0);

--- 682,688 -----
  				stat->gld,stat->gem,stat->lvl,stat->chm);
  	printw("Shield: %9.0f  Sword: %9.0f  Quicksilver: %3d  Blessed: %s\n",
  	stat->shd,stat->swd,stat->quks,(stat->bls? " True" : "False"));
! 	printw("Brains: %9.0f  Mana:  %9.0f",stat->brn,stat->man);
  	move(5,38);
  	ch = getans("LPS", FALSE);
  	move(15,0);
***************
*** 705,711
  				switch (ch)
  				{
  					case '1':
! 					printw("Mana is one per %d gold piece.  How much do you want (%.0f max)? ",menu[0].cost,floor(stat->gld/menu[0].cost));
  					temp = inflt();
  					if (temp * menu[0].cost > stat->gld || temp < 0)
  						goto CHEAT;

--- 705,711 -----
  				switch (ch)
  				{
  					case '1':
! 					printw("Mana is one per %ld gold piece.  How much do you want (%.0f max)? ",menu[0].cost,floor(stat->gld/menu[0].cost));
  					temp = inflt();
  					if (temp * menu[0].cost > stat->gld || temp < 0)
  						goto CHEAT;
***************
*** 719,725
  					}
  					break;
  				case '2':
! 					printw("Shields are %d per +1.  How many do you want (%.0f max)? ",menu[1].cost,floor(stat->gld/menu[1].cost));
  					temp = inflt();
  					if (!temp)
  						break;

--- 719,725 -----
  					}
  					break;
  				case '2':
! 					printw("Shields are %ld per +1.  How many do you want (%.0f max)? ",menu[1].cost,floor(stat->gld/menu[1].cost));
  					temp = inflt();
  					if (!temp)
  						break;
***************
*** 735,741
  					}
  					break;
  				case '3':
! 					printw("A book costs %d gp.  How many do you want (%.0f max)? ",menu[2].cost,floor(stat->gld/menu[2].cost));
  					temp = inflt();
  					if (temp * menu[2].cost > stat->gld || temp < 0)
  						goto CHEAT;

--- 735,741 -----
  					}
  					break;
  				case '3':
! 					printw("A book costs %ld gp.  How many do you want (%.0f max)? ",menu[2].cost,floor(stat->gld/menu[2].cost));
  					temp = inflt();
  					if (temp * menu[2].cost > stat->gld || temp < 0)
  						goto CHEAT;
***************
*** 755,761
  					}
  					break;
  				case '4':
! 					printw("Weapon enchantments are %d gp per +1.  How many + do you want (%.0f max)? ",menu[3].cost,floor(stat->gld/menu[3].cost));
  					temp = inflt();
  					if (!temp)
  						break;

--- 755,761 -----
  					}
  					break;
  				case '4':
! 					printw("Weapon enchantments are %ld gp per +1.  How many + do you want (%.0f max)? ",menu[3].cost,floor(stat->gld/menu[3].cost));
  					temp = inflt();
  					if (!temp)
  						break;
***************
*** 771,777
  					}
  					break;
  				case '5':
! 					printw("A charm costs %d gp.  How many do you want (%.0f max)? ",menu[4].cost,floor(stat->gld/menu[4].cost));
  					temp = inflt();
  					if (temp * menu[4].cost > stat->gld || temp < 0)
  						goto CHEAT;

--- 771,777 -----
  					}
  					break;
  				case '5':
! 					printw("A charm costs %ld gp.  How many do you want (%.0f max)? ",menu[4].cost,floor(stat->gld/menu[4].cost));
  					temp = inflt();
  					if (temp * menu[4].cost > stat->gld || temp < 0)
  						goto CHEAT;
***************
*** 785,791
  					}
  					break;
  				case '6':
! 					printw("Quicksilver is %d gp per +1.  How many + do you want (%.0f max)? ",menu[5].cost,floor(stat->gld/menu[5].cost));
  					temp = inflt();
  					if (!temp)
  						break;

--- 785,791 -----
  					}
  					break;
  				case '6':
! 					printw("Quicksilver is %ld gp per +1.  How many + do you want (%.0f max)? ",menu[5].cost,floor(stat->gld/menu[5].cost));
  					temp = inflt();
  					if (!temp)
  						break;
***************
*** 801,807
  					}
  					break;
  				case '7':
! 					printw("A blessing requires a %d gp donation.  Still want one? ",menu[6].cost);
  					ch = getans("NY", FALSE);
  					if (ch == 'Y')
  						if (stat->gld < menu[6].cost)

--- 801,807 -----
  					}
  					break;
  				case '7':
! 					printw("A blessing requires a %ld gp donation.  Still want one? ",menu[6].cost);
  					ch = getans("NY", FALSE);
  					if (ch == 'Y')
  						if (stat->gld < menu[6].cost)
***************
*** 832,838
  			}
  			break;
  		case 'S':
! 			mvprintw(15,0,"A gem is worth %d gp.  How many do you want to sell (%.0f max)? ",menu[7].cost,stat->gem);
  			temp = inflt();
  			if (temp > stat->gem || temp < 0)
  				goto CHEAT;

--- 832,838 -----
  			}
  			break;
  		case 'S':
! 			mvprintw(15,0,"A gem is worth %ld gp.  How many do you want to sell (%.0f max)? ",menu[7].cost,stat->gem);
  			temp = inflt();
  			if (temp > stat->gem || temp < 0)
  				goto CHEAT;