Capture des exceptions pour la lecture du fichier
This commit is contained in:
parent
25287bcc4b
commit
a8e325cb20
16
src/main.cpp
16
src/main.cpp
|
@ -12,18 +12,16 @@ int main() {
|
||||||
Manager manager;
|
Manager manager;
|
||||||
std::shared_ptr<Game> game = std::shared_ptr<Game>(new Game(manager));
|
std::shared_ptr<Game> game = std::shared_ptr<Game>(new Game(manager));
|
||||||
|
|
||||||
// ouverture du niveau
|
|
||||||
std::ifstream file;
|
|
||||||
file.open("./levels/level1.dat", std::ios::binary | std::ios::in);
|
|
||||||
game->load(file);
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
manager.setView(game);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// ouverture du niveau
|
||||||
|
std::ifstream file;
|
||||||
|
file.open("./levels/level1.dat", std::ios::binary | std::ios::in);
|
||||||
|
game->load(file);
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
manager.setView(game);
|
||||||
manager.start();
|
manager.start();
|
||||||
} catch (const std::exception& exception) {
|
} catch (const std::exception& exception) {
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "Le programme a quitté après une erreur d'exécution." << std::endl;
|
std::cerr << "Le programme a quitté après une erreur d'exécution." << std::endl;
|
||||||
std::cerr << exception.what() << std::endl;
|
std::cerr << exception.what() << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
Loading…
Reference in New Issue