int SetPos( int nx, int ny ) { int result = 0; if ( Passable( nx, ny ) == 1 ) { #ifdef USE_PATHER float totalCost; if ( showConsidered ) pather->Reset(); result = pather->Solve( XYToNode( playerX, playerY ), XYToNode( nx, ny ), &path, &totalCost ); if ( result == MicroPather::SOLVED ) { playerX = nx; playerY = ny; } printf( "Pather returned %d\n", result ); #else playerX = nx; playerY = ny; #endif } return result; }
void ToggleDoor() { doorsOpen = !doorsOpen; #ifdef USE_PATHER pather->Reset(); #endif }
void ToggleDoor() { doorsOpen = !doorsOpen; #ifdef USE_PATHER pather->Reset(); // // This is very brute force - a "real" app would know where its doors are. // const int delta[8] = { 1, 1+MAPX, MAPX, -1+MAPX, -1, -1-MAPX, -MAPX, 1-MAPX }; // // for( int i=0; i<MAPX*MAPY; ++i ) // { // if ( gMap[i] == 'D' ) { // for( int k=0; k<8; ++k ) { // int index = i+delta[k]; // if ( index >= 0 && index < MAPX*MAPY ) { // pather->StateCostChange( (void*) index ); // } // } // } // } #endif }
void ToggleTouched() { showConsidered = !showConsidered; pather->Reset(); }