From 26c31708dc59cf5d99598f64de4c516cfbf7b4b7 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 8 Dec 2017 20:27:43 +0100 Subject: [PATCH] delete dead code. --- src/kernel/resources.c | 24 ------------------------ src/kernel/save.c | 38 +++----------------------------------- src/move.c | 5 ++--- src/spells.c | 22 ---------------------- 4 files changed, 5 insertions(+), 84 deletions(-) diff --git a/src/kernel/resources.c b/src/kernel/resources.c index 842cb83ba..2f99315e3 100644 --- a/src/kernel/resources.c +++ b/src/kernel/resources.c @@ -124,30 +124,6 @@ static void terraform_default(struct rawmaterial *res, const region * r) UNUSED_ARG(r); } -#ifdef RANDOM_CHANGE -static void resource_random_change(int *pvalue, bool used) -{ - int split = 5; - int rnd = rng_int() % 100; - - if (pvalue == 0 || rnd % 10 >= 10) - return; - if (used) - split = 4; - /* if a resource was mined this round, there is a 6% probability - * of a decline and a 4% probability of a raise. */ - /* if it wasn't mined this round, there is an equal probability - * of 5% for a decline or a raise. */ - if (rnd < split) { - (*pvalue)++; - } else { - (*pvalue)--; - } - if ((*pvalue) < 0) - (*pvalue) = 0; -} -#endif - static int visible_default(const rawmaterial * res, int skilllevel) /* resources are visible, if skill equals minimum skill to mine them * plus current level of difficulty */ diff --git a/src/kernel/save.c b/src/kernel/save.c index 386c7523c..ba7692806 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -102,30 +102,6 @@ int firstx = 0, firsty = 0; /* TODO: is this still important? */ int enc_gamedata = ENCODING_UTF8; -/* local symbols */ -static region *current_region; - -char *rns(FILE * f, char *c, size_t size) -{ - char *s = c; - do { - *s = (char)getc(f); - } while (*s != '"'); - - for (;;) { - *s = (char)getc(f); - if (*s == '"') - break; - if (s < c + size) - ++s; - } - *s = 0; - return c; -} - -int maxregions = -1; -int loadplane = 0; - static void read_alliances(gamedata *data) { storage *store = data->store; @@ -635,7 +611,6 @@ static region *readregion(gamedata *data, int x, int y) } else { assert(uid == 0 || r->uid == uid); - current_region = r; while (r->attribs) a_remove(&r->attribs, r->attribs); if (r->land) { @@ -1399,7 +1374,6 @@ int read_game(gamedata *data) building **bp; ship **shp; unit *u; - int rmax = maxregions; storage * store = data->store; const struct building_type *bt_lighthouse = bt_find("lighthouse"); const struct race *rc_spell = rc_find("spell"); @@ -1443,11 +1417,9 @@ int read_game(gamedata *data) /* Regionen */ READ_INT(store, &nread); - assert(nread < MAXREGIONS && nread>=0); - if (rmax < 0) { - rmax = nread; - } - log_debug(" - Einzulesende Regionen: %d/%d", rmax, nread); + assert(nread < MAXREGIONS && nread >=0); + + log_debug(" - Einzulesende Regionen: %d", nread); while (--nread >= 0) { unit **up; @@ -1510,7 +1482,6 @@ int read_game(gamedata *data) update_interval(u->faction, r); } } - --rmax; } read_borders(data); @@ -1572,9 +1543,6 @@ int read_game(gamedata *data) fix_familiars(); } - if (loadplane || maxregions >= 0) { - remove_empty_factions(); - } log_debug("Done loading turn %d.", turn); return 0; diff --git a/src/move.c b/src/move.c index 01c5e94b2..289d7a421 100644 --- a/src/move.c +++ b/src/move.c @@ -1764,10 +1764,9 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting) } if (!flying_ship(sh)) { - int stormchance = 0; - int reason; if (storms_enabled) { - int stormyness; + int stormchance = 0; + int stormyness, reason; gamedate date; get_gamedate(turn, &date); stormyness = storms ? storms[date.month] * 5 : 0; diff --git a/src/spells.c b/src/spells.c index 74f466583..833061b0a 100644 --- a/src/spells.c +++ b/src/spells.c @@ -4527,28 +4527,6 @@ int sp_illusionary_shapeshift(castorder * co) return cast_level; } -/* ------------------------------------------------------------- */ -/* Name: Regionstraum analysieren - * Stufe: 9 - * Aura: 18 - * Kosten: SPC_FIX - * Wirkung: - * Zeigt die Verzauberungen eines Objekts an (curse->name, - * curse::info). Aus der Differenz Spruchstaerke und Curse->vigour - * ergibt sich die Chance den Spruch zu identifizieren ((force - - * c->vigour)*10 + 100 %). - */ -int sp_analyseregionsdream(castorder * co) -{ - region *r = co_get_region(co); - unit *mage = co->magician.u; - int cast_level = co->level; - - magicanalyse_region(r, mage, cast_level); - - return cast_level; -} - /* ------------------------------------------------------------- */ /* Name: Traumbilder erkennen * Stufe: 5