From da3a98811660eda150f91dd6799d0a172120bdb1 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sun, 27 Nov 2011 04:12:51 +0100 Subject: [PATCH] Introduce world::dead_body_energy_carryover --- agent.cc | 3 ++- world.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/agent.cc b/agent.cc index 5922000..2ed30bb 100644 --- a/agent.cc +++ b/agent.cc @@ -83,7 +83,8 @@ agent::die(void) { assert(!dead); dead = true; - energy = world::dead_body_energy; + if (energy < 0) energy = 0; + energy = energy * world::dead_body_energy_carryover + world::dead_body_energy; } void diff --git a/world.h b/world.h index df8a26e..edb8ddd 100644 --- a/world.h +++ b/world.h @@ -9,6 +9,7 @@ struct world { const static int sun_energy = 1; const static int dead_body_energy = 500; + const static double dead_body_energy_carryover = 0.5; const static int dead_decay = -1; };