1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
int main()
{
try
{
std::unique_ptr<Link> gods = std::make_unique<Link>(new Link{ new God{ "Odin", "Norse",
"Eight-legged flying horse called Sleipnir", "Spear called Gungnir" } });
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Thor", "Norse",
"Chariot pulled by goats Tanngrisnir and Tanngnjostr", "Hammer called Mjolnir" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Baldr", "Norse",
"A giant ship called Hringorni", "None" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Frejya", "Norse",
"Chariot pulled by two cats", "Magic called seidr" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Ares", "Greek",
"War chariot", "Sword and spear" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Zeus", "Greek",
"A chariot pulled by the four major winds shaped as horses", "Thunderbolt and the shield called Aegis" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Apollo", "Greek",
"Chariot pulled by the four horses Aethon, Pyrois, Phlegon and Eous", "A bow" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Hera", "Greek",
"A chariot drawn by peacocks", "Her intelligence" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Poseidon", "Greek",
"A chariot pulled either by a hippocampus or by four horses that can ride on the seas",
"A three-pronged spear called Trident" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Athena", "Greek", "",
"Allowed to use Zeus's Thunderbolt and the Aegis" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Amaterasu", "Japanese", "",
"Sword of Kusanagi, Jewel of Yasakani, Mirror of Yata" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Susanoo", "Japanese", "", "Sword of Totsuka" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Izanagi", "Japanese", "",
"Sword of Totsuka (later given to Susanoo)" } })));
gods = std::make_unique<Link>(gods->add_ordered(std::move(new Link{ new God{ "Bishamonten", "Japanese", "", "A spear" } })));
std::unique_ptr<Link> norse_gods = std::make_unique<Link>(new Link{ new God{ "Odin", "Norse",
"Eight-legged flying horse called Sleipnir", "Spear called Gungnir" } });
std::unique_ptr<Link> greek_gods = std::make_unique<Link>(new Link{ new God{ "Zeus", "Greek",
"A chariot pulled by the four major winds shaped as horses", "Thunderbolt and the shield called Aegis" } });
std::unique_ptr<Link> jap_gods = std::make_unique<Link>(new Link{ new God{ "Amaterasu", "Japanese", "",
"Sword of Kusanagi, Jewel of Yasakani, Mirror of Yata" } });
std::unique_ptr<Link> trav = std::make_unique<Link>(std::move(gods->find("Odin")));
if (trav)
{
if (trav == gods)
{
gods = std::make_unique<Link>(std::move(trav->next()));
}
trav->erase();
}
std::cout << "gods list:\n";
print_all(gods);
}
catch (const std::runtime_error &rte)
{
std::cerr << "Runtime error: " << rte.what() << '\n';
keep_window_open();
return 1;
}
catch (const std::bad_alloc &ba)
{
std::cerr << "Bad allocation error: " << ba.what() << '\n';
keep_window_open();
return 2;
}
catch (const std::exception &e)
{
std::cerr << "Exception: " << e.what() << "\n";
keep_window_open();
return 3;
}
catch (...)
{
std::cerr << "An unknown exception occurred\n";
keep_window_open();
return 4;
}
keep_window_open();
}
|