Skip to content

Commit

Permalink
catch exceptions in temporary mover, placer, remover dtor's
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Jun 8, 2014
1 parent 4e7aa83 commit 7b0c4e6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/game_board.cpp
Expand Up @@ -231,10 +231,12 @@ temporary_unit_placer::temporary_unit_placer(game_board& b, const map_location&

temporary_unit_placer::~temporary_unit_placer()
{
try {
m_.erase(loc_);
if(temp_) {
m_.insert(temp_);
}
} catch (...) {}
}

temporary_unit_remover::temporary_unit_remover(unit_map& m, const map_location& loc)
Expand All @@ -249,9 +251,11 @@ temporary_unit_remover::temporary_unit_remover(game_board& b, const map_location

temporary_unit_remover::~temporary_unit_remover()
{
try {
if(temp_) {
m_.insert(temp_);
}
} catch (...) {}
}

/**
Expand Down Expand Up @@ -312,6 +316,7 @@ temporary_unit_mover::temporary_unit_mover(game_board& b, const map_location& sr

temporary_unit_mover::~temporary_unit_mover()
{
try {
std::pair<unit_map::iterator, bool> move_result = m_.move(dst_, src_);

// Restore the movement?
Expand All @@ -322,5 +327,6 @@ temporary_unit_mover::~temporary_unit_mover()
if(temp_) {
m_.insert(temp_);
}
} catch (...) {}
}

0 comments on commit 7b0c4e6

Please sign in to comment.