/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2015, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
* Known contributors to this file:
* Dave Pare, 1986
* Steve McClure, 1997-2000
- * Markus Armbruster, 2004-2011
+ * Markus Armbruster, 2004-2012
*/
#include <config.h>
return;
che_uw = 0;
/* che due to civilian unrest */
- n = 10 - (random() % 20);
+ n = 10 - roll0(20);
che_civ = 3 + (civ * n / 500);
if (che_civ < 0)
che_civ = 0;
che += che_civ;
if (che < CHE_MAX) {
/* che due to uw unrest */
- n = 10 + (random() % 30);
+ n = 9 + roll(30);
che_uw = 5 + (uw * n / 500);
if (che_uw > uw)
che_uw = uw;
}
if (mil > 0) {
/* military won. */
- n = sp->sct_loyal - (random() % 15);
+ n = sp->sct_loyal - roll0(15);
if (n < 0)
n = 0;
sp->sct_loyal = n;
* guerrillas have to resort to blowing things up.
* Note this disrupts work in the sector.
*/
- n = (random() % 10) + (random() % che);
+ n = roll0(10) + roll0(che);
if (n > 100)
n = 100;
tmp = sp->sct_work - n;
/* loyalty drops during recruitment efforts */
n = sp->sct_loyal;
if (n < 30)
- n += (random() % 5) + 1;
+ n += roll(5);
else if (n < 70)
- n += (random() % 10) + 4;
+ n += roll(10) + 3;
if (n > 127)
n = 127;
sp->sct_loyal = n;
if (sp->sct_oldown != sp->sct_own || n > 100) {
- n = civ * (random() % 3) / 200;
+ n = civ * roll0(3) / 200;
n /= hap_fact(tnat, getnatp(sp->sct_oldown));
if (n + che > CHE_MAX)
n = CHE_MAX - che;
civ -= n;
sp->sct_item[I_CIVIL] = civ;
}
- n = uw * (random() % 3) / 200;
+ n = uw * roll0(3) / 200;
if (n + che > CHE_MAX)
n = CHE_MAX - che;
che += n;
val = roundintby(val, 10);
/* inject a modicum of indeterminism; also
* avoids che preferring certain directions */
- val += random() % 10 - 5;
+ val += roll(10) - 6;
if (val >= min_mil)
continue;
nicest_sp = nsp;