X-Git-Url: http://git.localhorst.tv/?p=blobs.git;a=blobdiff_plain;f=src%2Fcreature%2Fcreature.cpp;h=376ad3ffe86438272c52ac221eb9efdaa0426863;hp=1a88dba1ab7d76831972bdaa3b0fab4d3e7b0973;hb=631f0cfd6b421f5be68d60375db2ce91176d923d;hpb=05c42da80ec11cd73cc8a1b6ff21ac817b02a6e6 diff --git a/src/creature/creature.cpp b/src/creature/creature.cpp index 1a88dba..376ad3f 100644 --- a/src/creature/creature.cpp +++ b/src/creature/creature.cpp @@ -209,21 +209,21 @@ void Creature::DoWork(double amount) noexcept { void Creature::Hurt(double amount) noexcept { stats.Damage().Add(amount); if (stats.Damage().Full()) { - std::cout << "[" << ui::TimeString(sim.Time()) << "] " << name << " "; + std::ostream &log = sim.Log() << name << " "; if (stats.Exhaustion().Full()) { - std::cout << "died of exhaustion"; + log << "died of exhaustion"; } else if (stats.Breath().Full()) { - std::cout << "suffocated"; + log << "suffocated"; } else if (stats.Thirst().Full()) { - std::cout << "died of thirst"; + log << "died of thirst"; } else if (stats.Hunger().Full()) { - std::cout << "starved to death"; + log << "starved to death"; } else { - std::cout << "succumed to wounds"; + log << "succumed to wounds"; } - std::cout << " at an age of " << ui::TimeString(Age()) + log << " at an age of " << ui::TimeString(Age()) << " (" << ui::PercentageString(Age() / properties.Lifetime()) - << "% of life expectancy of " << ui::TimeString(properties.Lifetime()) + << " of life expectancy of " << ui::TimeString(properties.Lifetime()) << ")" << std::endl; Die(); } @@ -697,8 +697,7 @@ void Split(Creature &c) { s.GetPlanet(), s.Surface(), s.Position() + glm::dvec3(0.0, 0.55 * a->Size(), 0.0)); a->BuildVAO(); - std::cout << "[" << ui::TimeString(c.GetSimulation().Time()) << "] " - << a->Name() << " was born" << std::endl; + c.GetSimulation().Log() << a->Name() << " was born" << std::endl; Creature *b = new Creature(c.GetSimulation()); b->AddParent(c); @@ -712,8 +711,7 @@ void Split(Creature &c) { s.GetPlanet(), s.Surface(), s.Position() - glm::dvec3(0.0, 0.55 * b->Size(), 0.0)); b->BuildVAO(); - std::cout << "[" << ui::TimeString(c.GetSimulation().Time()) << "] " - << b->Name() << " was born" << std::endl; + c.GetSimulation().Log() << b->Name() << " was born" << std::endl; c.Die(); }