Project

General

Profile

Feature #98 » 0021-Add-disaster-type-Robbery.patch

Marko Lindqvist, 12/30/2023 02:13 PM

View differences:

common/city.h
* radius. */
int tile_cache_radius_sq;
/* the productions */
/* The productions */
int surplus[O_LAST]; /* Final surplus in each category. */
int waste[O_LAST]; /* Waste/corruption in each category. */
int unhappy_penalty[O_LAST]; /* Penalty from unhappy cities. */
......
int bonus[O_LAST];
int abs_bonus[O_LAST];
/* the physics */
/* The physics */
int food_stock;
int shield_stock;
int pollution; /* not saved */
common/disaster.h
#define SPECENUM_VALUE5NAME "Fallout"
#define SPECENUM_VALUE6 DE_REDUCE_DESTROY
#define SPECENUM_VALUE6NAME "ReducePopDestroy"
#define SPECENUM_VALUE7 DE_ROBBERY
#define SPECENUM_VALUE7NAME "Robbery"
#define SPECENUM_COUNT DE_COUNT
#define SPECENUM_BITVECTOR bv_disaster_effects
#include "specenum_gen.h"
server/cityturn.c
_("%s was hit by %s."), city_name_get(pcity),
disaster_name_translation(pdis));
if (disaster_has_effect(pdis, DE_ROBBERY)) {
if (pplayer->economic.gold > 0 && pcity->prod[O_TRADE] > 0) {
int amount = pcity->prod[O_TRADE] * 5;
amount = MIN(pplayer->economic.gold, amount);
pplayer->economic.gold -= amount;
notify_player(pplayer, ptile, E_DISASTER, ftc_server,
PL_("Robbery in %s. %d gold stolen.",
"Robbery in %s. %d gold stolen.", amount),
city_link(pcity), amount);
had_internal_effect = TRUE;
}
}
if (disaster_has_effect(pdis, DE_POLLUTION)) {
if (place_pollution(pcity, EC_POLLUTION)) {
notify_player(pplayer, ptile, E_DISASTER, ftc_server,
(1-1/2)