import recovered chunk of validity_check() func
as posted by Crashdisk in
http://eab.abime.net/showpost.php?p=968499&postcount=10
not used yet.
it was slightly modified to accomodate for recent code changes
(TxWrite used directly instead of printing to a buffer first).
original recovered code chunk (note that the last 13 lines are
unrelated garbage):
_no != JUMP))
{
clear_line();
sprintf(tempstr,"Invalid Command");
TxWrite(rp,tempstr);
message = TRUE;
return(FALSE);
}
else if ((*units > 3000) && (*com_no != JUMP))
{
clear_line();
sprintf(tempstr,"3000 UNIT TRANSACTION LIMIT");
TxWrite(rp,tempstr);
message = TRUE;
return(FALSE);
}
} /* end if isdigit(com_array[counter] */
else if (com_array[counter] == '*')
{
*units = ALL;
++counter;
}
else if (*com_no == LIMIT)
*units = 0;
else
*units = 1;
/* check for valid DELETE command */
if (*com_no == DELETE)
{
if ((*units >=1) && (*units <= cur_player->auto_count))
return(TRUE);
else
{
clear_line();
sprintf(tempstr,"INVALID DELETE COMMAND");
TxWrite(rp,tempstr);
message = TRUE;
return(FALSE);
}
}
else if (*com_no == EXERCISE)
{
if ((*units >= 1) && (*units <= cur_player->auto_count) &&
(cur_player->auto_ptr[*units - 1]->option_type != AUTOBUY) &&
(cur_player->auto_ptr[*units - 1]->option_type != AUTOSELL))
{
tmp_ptr = cur_player->auto_ptr[*units - 1];
*price = option(tmp_ptr->option_type,tmp_ptr->stock_no,tmp_ptr->option_price);
return(TRUE);
}
else
{
clear_line();
message = TRUE;
sprintf(tempstr,"Invalid Exercise Command");
TxWrite(rp,tempstr);
return(FALSE);
}
}
else if (*com_no == BONDS)
{
if ((!q_break) || (*units == ALL))
{
message = TRUE;
clear_line();
if (*units == ALL)
{
sprintf(tempstr,"INVALID COMMAND");
TxWrite(rp,tempstr);
}
else
sprintf(tempstr,"BONDS SOLD AT BEGINNING OF QUARTER ONLY");
TxWrite(rp,tempstr);
return(FALSE);
}
else
{
return(TRUE);
}
}
else if (*com_no == CASH)
{
if (!q_break)
{
message = TRUE;
clear_line();
sprintf(tempstr,"CAN'T SELL T-BILLS UNTIL END OF QUARTER");
TxWrite(rp,tempstr);
return(FALSE);
}
else if (*units == ALL)
*units = cur_player->bonds;
else if (*units > cur_player->bonds)
*units = cur_player->bonds;
return(TRUE);
}
/*** New command to speed through time added 11/22/85 **/
else if (*com_no == JUMP)
{
if (*units == ALL)
*units = 3500;
return(TRUE);
}
while ((com_array[counter] == ' ') &&
(counter <= *com_char_count))
++counter;
if (counter > *com_char_count)
{
clear_line();
sprintf(tempstr,"NO STOCK NAME GIVEN");
TxWrite(rp,tempstr);
message = TRUE;
return (FALSE);
}
ptr = counter;
while ((com_array[counter] != ' ') &&
(counter <= *com_char_count))
++counter;
*stock_no = compare(ptr,counter - 1,com_array,STOCK);
if (*stock_no == NOT_FOUND)
{
clear_line();
sprintf(tempstr,"INVALID STOCK NAME GIVEN");
TxWrite(rp,tempstr);
message = TRUE;
return(FALSE);
}
else if ((*com_no == PUT) ||
(*com_no == CALL))
{
if (q_break == FALSE)
{
message = TRUE;
clear_line();
sprintf(tempstr,"NO OPTIONS SOLD UNTIL END OF QUARTER");
TxWrite(rp,tempstr);
return(FALSE);
}
else
{
*price = option(*com_no,*stock_no,stock_array[*stock_no].price);
return(TRUE);
}
}
else if (*com_no == GRAPH)
{
if (q_break == FALSE)
{
message = TRUE;
clear_line();
sprintf(tempstr,"DATA AVAILABLE AT END OF QUARTER ONLY");
TxWrite(rp,tempstr);
return(FALSE);
}
else
return(TRUE);
}
else if (*com_no == LIMIT)
{
if (cur_player->portfolio[*stock_no].shares > 0)
{
if (*units < 200)
return(TRUE);
else
{
message = TRUE;
clear_line();
sprintf(tempstr,"Maximum Price is $200");
TxWrite(rp,tempstr);
return(FALSE);
}
}
else
{
message = TRUE;
clear_line();
sprintf(tempstr,"You don't own any");
TxWrite(rp,tempstr);
return(FALSE);
}
}
else if ((*com_no == SELL) && (*units == ALL))
*units = cur_player->portfolio[*stock_no].shares;
else if (*units == ALL)
{
message = TRUE;
clear_line();
sprintf(tempstr,"INVALID USE OF ASTERISK");
TxWrite(rp,tempstr);
return(FALSE);
}
while ((com_array[counter] != '+') &&
(com_array[counter] != '-') &&
(counter <= *com_char_count))
++counter;
if ((counter > *com_char_count)) /* if no more user input */
if (((*com_no == BUY) || (*com_no == MARGIN)) &&
((*units + cur_player->portfolio[*stock_no].shares) > LOTLIMIT))
{
clear_line();
message = TRUE;
sprintf(tempstr,"Would Exceed 9999 Lot Limit");
TxWrite(rp,tempstr);
return(FALSE);
}
else
{
*price = stock_array[*stock_no].price;
return(TRUE);
}
else /* we found a digit, plus, */
{ /* or minus. */
int i,pr,type;
switch(com_array[counter])
{
case '+': type = 1;
++counter;
*auto_plus = 0;
break;
case '-': type = 2;
++counter;
*auto_minus = 0;
break;
}
pr = 0;
while ((isdigit(com_array[counter])) &&
(counter <= *com_char_count) &&
(pr <= 3000))
{
i = com_array[counter] - DIFFERENCE;
pr = (pr * 10) + i;
++counter;
}
if (pr == 0)
{
clear_line();
sprintf(tempstr,"ZERO IS AN INVALID PRICE");
TxWrite(rp,tempstr);
message = TRUE;
return(FALSE);
}
else if (pr > 200)
{
clear_line();
sprintf(tempstr,"ATTEMPTED TOO GREAT A PRICE");
TxWrite(rp,tempstr);
message = TRUE;
return(FALSE);
}
else
{
switch(type)
{
case 1: *auto_plus = pr;
break;
case 2: *auto_minus = pr;
break;
}
if (*com_no == MARGIN)
{
clear_line();
sprintf(tempstr,"NO AUTO TRANSACTIONS ON MARGIN");
TxWrite(rp,tempstr);
message = TRUE;
return(FALSE);
}
else
return(TRUE);
} /* end price not 0 or >3000 */
} /* end found + or - fields */
} /* end procedure validity_check */
digit, plus, */
{ /* or minus. */
int i,pr,type;
switch(com_array[counter])
{
case '+': type = 1;
++counter;
*auto_plus = 0;
break;
case '-': type = 2;
++counter;
*auto_minu