/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2021, 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
+ * Markus Armbruster, 2004-2016
*/
/*
#include <config.h>
+#include "chance.h"
#include "commands.h"
-#include "land.h"
int
-conv(void)
+c_convert(void)
{
struct natstr *natp;
struct sctstr sect;
struct nstr_sect nstr;
int uwtoconvert, newuw, totaluw, uw;
- int maxpop, civ, mil, adj_mob, mob;
+ int maxpop, civ, seceff, adj_mob, mob;
+ double secstr;
double security_extra = 1.0;
- struct lndstr land;
- struct nstr_item ni;
if (!snxtsct(&nstr, player->argp[1]))
return RET_SYN;
natp = getnatp(sect.sct_own);
maxpop = max_pop(natp->nat_level[NAT_RLEV], §);
civ = sect.sct_item[I_CIVIL];
- mil = sect.sct_item[I_MILIT];
-
- /*
- * Military units count according to the number of
- * mil in them. (i.e. attack/defense modifier don't
- * count.
- */
- snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
- while (nxtitem(&ni, &land)) {
- mil += land.lnd_item[I_MILIT];
-
- /* Anti-terrorist units count double */
- if (lchr[(int)land.lnd_type].l_flags & L_SECURITY) {
-
- /*
- * They also increase the efficiency of
- * the conversion process by 10% each.
- * (but they use 10 mobility doing it)
- */
- security_extra += .1;
- land.lnd_mobil -= 10;
- mil += land.lnd_item[I_MILIT];
- }
- }
+ secstr = security_strength(§, &seceff);
/*
* Must have military control to convert captured civs.
*/
- if (mil * 10 < civ)
+ if (secstr * 10 < civ)
continue;
newuw = civ;
if (newuw > uwtoconvert)
mob = sect.sct_mobil * 5;
/* security troops make conversion more effective */
+ security_extra = 1.0 + seceff / 1000.0;
adj_mob = ldround(((double)mob * security_extra), 1);
if (adj_mob < newuw)