Skip to content

Commit

Permalink
On hack fail, only shutdown computers next to player
Browse files Browse the repository at this point in the history
  • Loading branch information
vidarsk committed Jun 6, 2014
1 parent cf79ed9 commit d5e4292
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/computer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,13 +1075,26 @@ void computer::activate_random_failure()

void computer::activate_failure(computer_failure fail)
{
bool found_tile = false;
switch (fail) {

case COMPFAIL_NULL: // Unknown action.
case NUM_COMPUTER_FAILURES: // Suppress compiler warning [-Wswitch]
break;

case COMPFAIL_SHUTDOWN:
for( int x = g->u.posx-1; x <= g->u.posx+1; x++ ) {
for( int y = g->u.posy-1; y <= g->u.posy+1; y++ ) {
if( g->m.has_flag("CONSOLE", x, y) ) {
g->m.ter_set(x, y, t_console_broken);
add_msg(m_bad, _("The console shuts down."));
found_tile = true;
}
}
}
if( found_tile ) {
break;
}
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.has_flag("CONSOLE", x, y)) {
Expand Down

0 comments on commit d5e4292

Please sign in to comment.