Beispiel #1
0
/*
	function to drop an object
 */
static void
dropobj(void)
{
	int    i;
	unsigned char  *p;
	long            amt;
	p = &item[playerx][playery];
	while (1) {
		if ((i = whatitem("drop")) == '\33')
			return;
		if (i == '*')
			showstr();
		else {
			if (i == '.') {	/* drop some gold */
				if (*p) {
					lprcat("\nThere's something here already!");
					return;
				}
				lprcat("\n\n");
				cl_dn(1, 23);
				lprcat("How much gold do you drop? ");
				if ((amt = readnum((long) c[GOLD])) == 0)
					return;
				if (amt > c[GOLD]) {
					lprcat("\nYou don't have that much!");
					return;
				}
				if (amt <= 32767) {
					*p = OGOLDPILE;
					i = amt;
				} else if (amt <= 327670L) {
					*p = ODGOLD;
					i = amt / 10;
					amt = 10 * i;
				} else if (amt <= 3276700L) {
					*p = OMAXGOLD;
					i = amt / 100;
					amt = 100 * i;
				} else if (amt <= 32767000L) {
					*p = OKGOLD;
					i = amt / 1000;
					amt = 1000 * i;
				} else {
					*p = OKGOLD;
					i = 32767;
					amt = 32767000L;
				}
				c[GOLD] -= amt;
				lprintf("You drop %ld gold pieces", (long)amt);
				iarg[playerx][playery] = i;
				bottomgold();
				know[playerx][playery] = 0;
				dropflag = 1;
				return;
			}
			drop_object(i - 'a');
			return;
		}
	}
}
Beispiel #2
0
/* routine to pick up some gold -- if arg==OMAXGOLD then the pile is worth 100* the argument */
void ogold(int arg)
{
	long i;

	i = iarg[playerx][playery];

	if (arg==ODGOLD) i *= 10;
	else if (arg==OMAXGOLD) i *= 100;
	else if (arg==OKGOLD) i *= 1000;

	lprintf("\nYou find %d gold piece%s.",i, i==1 ? "": "s");
	c[GOLD] += i;  
	bottomgold();
	item[playerx][playery] = know[playerx][playery] = 0;/*destroy gold*/
}
Beispiel #3
0
/*
	function to drop an object
 */
void dropobj (void)
{
	int i, pitflag=0;
	char *p;
	long amt;

	p = &item[playerx][playery];
	while (1) {
		if ((i = whatitem("drop"))==ESC)  
			return;
		if (i=='*') 
			showstr(); 
		else {
			/* drop some gold */
			if (i=='.')	{
				if (*p == OPIT) pitflag=1;
				if (*p && !pitflag) { 
				lprcat("\nThere's something here already!"); 
						return; 
				}
				lprcat("\n\n");
				cl_dn(1,23);
				lprcat("How much gold do you drop? ");
				if ((amt=readnum((long)c[GOLD])) <= 0) return;
				if (amt>c[GOLD]) { 
					lprcat("\nYou don't have that much!"); 
					return; 
				}
				if (amt<=32767) { 
					*p=OGOLDPILE; 
					i=(int)amt; 
				}
				else if (amt<=327670L) { 
					*p=ODGOLD; 
					i=(int)amt/10; 
					amt = 10L*i; 
				}
				else if (amt<=3276700L) { 
					*p=OMAXGOLD; 
					i=(int)amt/100; 
					amt = 100L*i; 
				}
				else if (amt<=32767000L) { 
					*p=OKGOLD; 
					i=(int)amt/1000; 
					amt = 1000L*i; 
				}
				else { 
					*p=OKGOLD; 
					i=(int)32767; 
					amt = 32767000L; 
				}
				c[GOLD] -= amt; 
				lprintf("You drop %d gold piece%s.",(long)amt,(amt==1)?"":"s");
				if (pitflag) {
					*p = OPIT;
					lprcat("\nThe gold disappears down the pit.");
				} else
					iarg[playerx][playery]=i; 
				bottomgold();
				know[playerx][playery]=0; 
				dropflag=1;  
				return;
			}
			drop_object(i-'a');
			return;
		}
	}
}