Rework validation

This commit is contained in:
jl777
2019-02-18 00:00:06 -11:00
parent 2e1e7f8c7b
commit 76c397d4d1
2 changed files with 15 additions and 10 deletions

View File

@@ -52,9 +52,9 @@ add_pack(struct rogue_state *rs,THING *obj, bool silent)
if (pack == NULL)
{
pack = obj;
obj->o_packch = pack_char();
inpack++;
pack = obj;
obj->o_packch = pack_char();
inpack++;
}
else
{
@@ -291,11 +291,11 @@ inventory(struct rogue_state *rs,THING *list, int type)
// fprintf(stderr,"n_objs.%d vs inpack.%d\n",n_objs,inpack), sleep(2);
if (n_objs == 0)
{
if (terse)
msg(rs,type == 0 ? (char *)"empty handed" : (char *)"nothing appropriate");
else
msg(rs,type == 0 ? (char *)"you are empty handed" : (char *)"you don't have anything appropriate");
return FALSE;
if (terse)
msg(rs,type == 0 ? (char *)"empty handed" : (char *)"nothing appropriate");
else
msg(rs,type == 0 ? (char *)"you are empty handed" : (char *)"you don't have anything appropriate");
return FALSE;
}
end_line(rs);
return TRUE;

View File

@@ -1226,16 +1226,21 @@ bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C
if ( vopret.size() > 2 )
{
script = (uint8_t *)vopret.data();
if ( script[0] == EVAL_TOKENS )
funcid = script[1];
if ( (e= script[0]) == EVAL_TOKENS )
{
if ( script[1] == 'c' )
{
e = EVAL_ROGUE;
funcid = 'Q';
}
else if ( script[1] == 't' )
{
e = EVAL_ROGUE;
funcid = 'Q';
} else return eval->Invalid("illegal tokens funcid");
}
if ( script[0] == EVAL_ROGUE )
if ( e == EVAL_ROGUE )
{
switch ( funcid )
{