STATIC const char *doParse( const char *str ) { /**/myassert( str != NULL ); getAct( 1 ); switch( tolower( *str ) ) { case 'w': curAct->dbg_parser = PARSE_WATCOM; break; case '7': curAct->dbg_parser = PARSE_WATCOM_70; break; case '-': curAct->dbg_parser = PARSE_NULL; break; default: unrecognized( 'p' ); } return( str + 1 ); }
STATIC const char *doOutput( const char * str ) { /**/myassert( str != NULL ); if( *str != '=' && *str != '#' ) unrecognized( 'o' ); ++str; getAct( 1 ); if( curAct->output != NULL ) { MemFree( curAct->output ); } if( isBreakChar( *str ) ) unrecognized( 'o' ); curAct->output = getFile( &str ); return( str ); }
STATIC const char *doToggle( const char *str ) { /**/myassert( str != NULL ); getAct( 1 ); switch( tolower( str[-1] ) ) { case 'q': curAct->quiet = ! curAct->quiet; break; #if 0 case 'l': curAct->deflib = ! curAct->deflib; break; #endif case 'b': curAct->batch = ! curAct->batch; break; default: unrecognized( str[-1] ); break; } return( str ); }
STATIC const char *doDebug( const char *str ) { /**/myassert( str != NULL ); getAct( 1 ); switch( tolower( *str ) ) { case 'm': curAct->dbg_generator = DGEN_MICROSOFT; break; case 'p': curAct->dbg_generator = DGEN_METAWARE; break; case 't': curAct->dbg_generator = DGEN_TURBO; break; case 'x': curAct->dbg_generator = DGEN_TXT; break; case '-': curAct->dbg_generator = DGEN_NULL; break; default: unrecognized( 'd' ); } return( str + 1 ); }
void Guardian::updateGhostPoint() { for (auto it = ghostList.begin(); it != ghostList.end(); ) { auto ghost = *it; ghost->updatePos(); if (ghost->getAct() == ABSORB) { ghost->setOriginPos(getPositionX(), getPositionY()+80); if (ghost->hit()) { if (man != nullptr) { setGhost(getBlackActor()->getGhost() + 1); } ghostList.erase(it); ghost->removeFromParent(); continue; } } ++it; } }
STATIC const char *doFile( const char *str ) { /**/myassert( str != NULL ); getAct( 1 ); switch( tolower( *str ) ) { case 'm': curAct->omf_generator = OGEN_MICROSOFT; if( str[1] == '2' ) { curAct->omf_generator = OGEN_MICROSOFT_OS2; ++str; } break; case 'p': curAct->omf_generator = OGEN_PHARLAP; break; case '-': curAct->omf_generator = OGEN_NULL; break; default: unrecognized( 'f' ); } return( str + 1 ); }
STATIC const char *addFile( const char *str ) { DIR *parent; struct dirent *direntp; char sp_buf[ _MAX_PATH2 ]; char *drive; char *dir; char path[ _MAX_PATH ]; char *p; size_t len; size_t files_in_dir; /**/myassert( str != NULL ); getAct( 0 ); p = getFile( &str ); if( strpbrk( p, WILD_CARDS ) == NULL ) { curAct = MemRealloc( curAct, sizeof( act_grp_t ) + sizeof( const char * ) * curAct->num_files ); curAct->files[ curAct->num_files ] = p; ++curAct->num_files; return( str ); } /* process a wildcarded name */ parent = opendir( p ); if( parent == NULL ) { Fatal( MSG_UNABLE_TO_OPEN_FILE, p ); } /* Since we must allocate memory for the filenames we shouldn't MemRealloc the curAct to a larger size at the same time. So we count the number of files in the directory. */ files_in_dir = 0; for(;;) { /* count number of directory entries */ direntp = readdir( parent ); if( direntp == NULL ) break; ++files_in_dir; } closedir( parent ); if( files_in_dir == 0 ) { Fatal( MSG_UNABLE_TO_OPEN_FILE, p ); } curAct = MemRealloc( curAct, sizeof( act_grp_t ) + sizeof( const char * ) * ( curAct->num_files + files_in_dir - 1 ) ); parent = opendir( p ); if( parent == NULL ) { Fatal( MSG_UNABLE_TO_OPEN_FILE, p ); } _splitpath2( p, sp_buf, &drive, &dir, NULL, NULL ); MemFree( p ); /* no longer need this */ for(;;) { /* we ignore any difference between the number of times we can loop here, and file_in_dir calc'd above */ direntp = readdir( parent ); if( direntp == NULL ) break; _makepath( path, drive, dir, direntp->d_name, NULL ); len = strlen( path ) + 1; curAct->files[ curAct->num_files ] = memcpy( MemAlloc( len ), path, len ); ++curAct->num_files; --files_in_dir; if( files_in_dir == 0 ) break; } closedir( parent ); return( str ); }