Rebase of Hvy Metal I final version

Straightforward forward port.  Drop the code to reset track on
startup.  It's not necessary, and it breaks linking of empdump.
This commit is contained in:
Markus Armbruster 2008-01-19 15:19:13 +01:00
parent abd64835c7
commit 5d0f5e69ee
25 changed files with 349 additions and 25 deletions

View file

@ -35,6 +35,13 @@
#include "update.h"
int
age_people(int n, int etu)
{
/* age by 1% per 24 etus */
return roundavg(n * (1.0 - etu / 2400.0));
}
void
age_levels(int etu)
{
@ -43,7 +50,6 @@ age_levels(int etu)
int i;
double level;
double delta;
int deltares;
best_tech = 0.0;
best_res = 0.0;
@ -61,14 +67,7 @@ age_levels(int etu)
delta = np->nat_level[NAT_TLEV] * etu / (100 * level_age_rate);
np->nat_level[NAT_TLEV] -= delta;
}
/*
* age reserves by 1% per every 24 etus
*/
deltares = -roundavg(np->nat_reserve * etu / 2400.0);
if (deltares != 0)
np->nat_reserve += deltares;
/* Chad Zabel - above number is negative ( was a -= there
which was wrong. */
np->nat_reserve = age_people(np->nat_reserve, etu);
}
best_tech /= 5;
best_res /= 5;

View file

@ -87,6 +87,11 @@ finish_sects(int etu)
/* Wipe it clean */
memset(g_distptrs, 0, WORLD_SZ() * sizeof(*g_distptrs));
if (opt_RAILWAYS) {
for (n = 0; NULL != (sp = getsectid(n)); n++)
set_railway(sp);
}
logerror("delivering...\n");
/* Do deliveries */
for (n = 0; NULL != (sp = getsectid(n)); n++) {

View file

@ -109,6 +109,17 @@ do_feed(struct sctstr *sp, struct natstr *np, short *vec,
if (!player->simulation)
sp->sct_work = sctwork;
grow_people(sp, etu, np, &work_avail, sctwork, vec);
/* age che */
if (!player->simulation) {
int oldche = sp->sct_che;
sp->sct_che = age_people(sp->sct_che, etu);
if (sp->sct_che_target == sp->sct_own && sp->sct_loyal < 40)
/* make them fade away eventually, for playability */
sp->sct_che /= 2;
if (sp->sct_che != oldche)
logerror("che in %d,%d aged from %d to %d",
sp->sct_x, sp->sct_y, oldche, sp->sct_che);
}
}
} else
sctwork = sp->sct_work = 100;

View file

@ -157,7 +157,8 @@ upd_ship(struct shpstr *sp, int etus,
/* produce oil */
if (np->nat_money >= 0
&& (mp->m_flags & M_OIL) && sectp->sct_type == SCT_WATER) {
&& (mp->m_flags & M_OIL) && sectp->sct_type == SCT_WATER
&& sp->shp_mobil >= ship_mob_max) {
product = &pchr[dchr[SCT_OIL].d_prd];
oil_gained = roundavg(total_work(100, etus,
sp->shp_item[I_CIVIL],