diff --git a/s/cppcheck b/s/cppcheck index 9c51309f8..e38e86de1 100755 --- a/s/cppcheck +++ b/s/cppcheck @@ -1,7 +1,7 @@ #!/bin/sh IGNORE=$(find src -name "*.test.c" | awk '{ print "-i"$1 }') -cppcheck $IGNORE \ +cppcheck $IGNORE -isrc/tests.c \ --quiet --enable=all -U_MSC_VER -UCLEANUP_CODE -UTODO \ -UERESSEA_BUILDNO -UERESSEA_VERSION \ -IcJSON -Isrc -Iclibs -Istorage src diff --git a/src/attributes/CMakeLists.txt b/src/attributes/CMakeLists.txt index fb077cfe9..bc960d3e7 100644 --- a/src/attributes/CMakeLists.txt +++ b/src/attributes/CMakeLists.txt @@ -11,7 +11,6 @@ follow.c hate.c iceberg.c key.c -moved.c movement.c dict.c otherfaction.c diff --git a/src/attributes/attributes.c b/src/attributes/attributes.c index a5911200c..7a697016b 100644 --- a/src/attributes/attributes.c +++ b/src/attributes/attributes.c @@ -30,7 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "key.h" #include "stealth.h" #include "magic.h" -#include "moved.h" #include "movement.h" #include "dict.h" #include "otherfaction.h" @@ -207,6 +206,7 @@ void register_attributes(void) at_deprecate("xontormiaexpress", a_readint); /* required for old datafiles */ at_deprecate("orcification", a_readint); /* required for old datafiles */ at_deprecate("lua", read_ext); /* required for old datafiles */ + at_deprecate("moved", a_readint); at_deprecate("gm", a_readint); at_deprecate("guard", a_readint); /* used to contain guard-flags (v3.10.0-259-g8597e8b) */ at_register(&at_stealth); @@ -226,5 +226,4 @@ void register_attributes(void) at_register(&at_racename); at_register(&at_speedup); at_register(&at_movement); - at_register(&at_moved); } diff --git a/src/attributes/moved.c b/src/attributes/moved.c deleted file mode 100644 index e34b9c5e8..000000000 --- a/src/attributes/moved.c +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright (c) 1998-2015, Enno Rehling -Katja Zedel - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -**/ - -#include -#include -#include "moved.h" - -#include -#include -#include - -#include - -static int age_moved(attrib * a, void *owner) -{ - UNUSED_ARG(owner); - --a->data.i; - return a->data.i > 0; -} - -static void -write_moved(const attrib * a, const void *owner, struct storage *store) -{ - WRITE_INT(store, a->data.i); -} - -static int read_moved(attrib * a, void *owner, gamedata *data) -{ - READ_INT(data->store, &a->data.i); - if (a->data.i != 0) - return AT_READ_OK; - else - return AT_READ_FAIL; -} - -attrib_type at_moved = { - "moved", NULL, NULL, age_moved, write_moved, read_moved -}; - -bool get_moved(attrib ** alist) -{ - return a_find(*alist, &at_moved) ? true : false; -} - -void set_moved(attrib ** alist) -{ - attrib *a = a_find(*alist, &at_moved); - if (a == NULL) - a = a_add(alist, a_new(&at_moved)); - a->data.i = 2; -} diff --git a/src/attributes/moved.h b/src/attributes/moved.h deleted file mode 100644 index 2011e02a1..000000000 --- a/src/attributes/moved.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright (c) 1998-2015, Enno Rehling -Katja Zedel - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -**/ - -#ifndef H_ATTRIBUTE_MOVED -#define H_ATTRIBUTE_MOVED -#ifdef __cplusplus -extern "C" { -#endif - - struct attrib; - struct attrib_type; - - extern bool get_moved(struct attrib **alist); - extern void set_moved(struct attrib **alist); - - extern struct attrib_type at_moved; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/battle.c b/src/battle.c index fd658cd69..62dc72d1e 100644 --- a/src/battle.c +++ b/src/battle.c @@ -57,7 +57,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include /* util includes */ #include diff --git a/src/kernel/ally.c b/src/kernel/ally.c index 2f3d6a017..47c56f315 100644 --- a/src/kernel/ally.c +++ b/src/kernel/ally.c @@ -203,8 +203,9 @@ alliedgroup(const struct plane *pl, const struct faction *f, if (!(faction_alive(f) && faction_alive(f2))) { return 0; } - while (sf && sf->faction != f2) + while (sf && sf->faction != f2) { sf = sf->next; + } if (sf == NULL) { mode = mode & autoalliance(pl, f, f2); } diff --git a/src/kernel/save.c b/src/kernel/save.c index 6a72ea23a..b6e099e91 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -934,6 +934,7 @@ static void read_password(gamedata *data, faction *f) { else { faction_setpassword(f, (data->version >= CRYPT_VERSION) ? name : password_encode(name, PASSWORD_DEFAULT)); } + (void)_test_read_password; } void _test_read_password(gamedata *data, faction *f) { @@ -942,6 +943,7 @@ void _test_read_password(gamedata *data, faction *f) { static void write_password(gamedata *data, const faction *f) { WRITE_TOK(data->store, (const char *)f->_password); + (void)_test_write_password; } void _test_write_password(gamedata *data, const faction *f) { diff --git a/src/kernel/unit.c b/src/kernel/unit.c index a6ab5c2f9..9f686bfc7 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -38,7 +38,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "skill.h" #include "terrain.h" -#include #include #include #include diff --git a/src/magic.c b/src/magic.c index f2108b8f2..b7ceae183 100644 --- a/src/magic.c +++ b/src/magic.c @@ -2486,17 +2486,6 @@ unit *get_clone(const unit * u) return NULL; } -unit *get_clone_mage(const unit * u) -{ - attrib *a = a_find(u->attribs, &at_clonemage); - if (a != NULL) { - unit *um = (unit *)a->data.v; - if (um->number > 0) - return um; - } - return NULL; -} - static bool is_moving_ship(ship * sh) { const unit *u = ship_owner(sh); diff --git a/src/magic.h b/src/magic.h index 403dafdc6..636b4113a 100644 --- a/src/magic.h +++ b/src/magic.h @@ -328,7 +328,6 @@ extern "C" { struct unit *get_familiar(const struct unit *u); struct unit *get_familiar_mage(const struct unit *u); struct unit *get_clone(const struct unit *u); - struct unit *get_clone_mage(const struct unit *u); void remove_familiar(struct unit *mage); void create_newfamiliar(struct unit *mage, struct unit *familiar); void create_newclone(struct unit *mage, struct unit *familiar); diff --git a/src/modules/museum.c b/src/modules/museum.c index 0f9fe9923..29c25f49b 100644 --- a/src/modules/museum.c +++ b/src/modules/museum.c @@ -138,169 +138,6 @@ attrib_type at_museumgiveback = { a_readmuseumgiveback }; -void warden_add_give(unit * src, unit * u, const item_type * itype, int n) -{ - attrib *aw = a_find(u->attribs, &at_warden); - museumgiveback *gb = NULL; - museumgivebackcookie *gbc; - attrib *a; - - /* has the giver a cookie corresponding to the warden */ - for (a = a_find(src->attribs, &at_museumgivebackcookie); - a && a->type == &at_museumgivebackcookie; a = a->next) { - if (((museumgivebackcookie *)(a->data.v))->warden_no == u->no) - break; - } - - /* if not give it one */ - if (a == NULL || a->type != &at_museumgivebackcookie) { - a = a_add(&src->attribs, a_new(&at_museumgivebackcookie)); - gbc = (museumgivebackcookie *)a->data.v; - gbc->warden_no = u->no; - gbc->cookie = aw->data.i; - assert(aw->data.i < INT_MAX); - aw->data.i++; - } - else { - gbc = (museumgivebackcookie *)(a->data.v); - } - - /* now we search for the warden's corresponding item list */ - for (a = a_find(u->attribs, &at_museumgiveback); - a && a->type == &at_museumgiveback; a = a->next) { - gb = (museumgiveback *)a->data.v; - if (gb->cookie == gbc->cookie) { - break; - } - } - - /* if there's none, give it one */ - if (!gb) { - a = a_add(&u->attribs, a_new(&at_museumgiveback)); - gb = (museumgiveback *)a->data.v; - gb->cookie = gbc->cookie; - } - - /* now register the items */ - i_change(&gb->items, itype, n); - - /* done */ - - /* this has a caveat: If the src-unit is destroyed while inside - * the museum, the corresponding itemlist of the warden will never - * be removed. to circumvent that in a generic way will be extremly - * difficult. */ -} - -void create_museum(void) -{ -#if 0 /* TODO: move this to Lua. It should be possible. */ - unsigned int museum_id = hashstring("museum"); - plane *museum = getplanebyid(museum_id); - region *r; - building *b; - const terrain_type *terrain_hall = get_terrain("hall1"); - const terrain_type *terrain_corridor = get_terrain("corridor1"); - - assert(terrain_corridor && terrain_hall); - - if (!museum) { - museum = create_new_plane(museum_id, "Museum", 9500, 9550, - 9500, 9550, PFL_MUSEUM); - } - - if (findregion(9525, 9525) == NULL) { - /* Eingangshalle */ - r = new_region(9525, 9525, 0); - terraform_region(r, terrain_hall); - r->planep = museum; - rsetname(r, "Eingangshalle"); - rsethorses(r, 0); - rsetmoney(r, 0); - rsetpeasants(r, 0); - set_string(&r->display, - "Die Eingangshalle des Großen Museum der 1. Welt ist bereits jetzt ein beeindruckender Anblick. Obwohl das Museum noch nicht eröffnet ist, vermittelt sie bereits einen Flair exotischer Welten. In den Boden ist ein großer Kompass eingelassen, der den Besuchern bei Orientierung helfen soll."); - } - - r = findregion(9526, 9525); - if (!r) { - /* Lounge */ - r = new_region(9526, 9525, 0); - terraform_region(r, terrain_hall); - r->planep = museum; - rsetname(r, "Lounge"); - rsethorses(r, 0); - rsetmoney(r, 0); - rsetpeasants(r, 0); - set_string(&r->display, - "Die Lounge des großen Museums ist ein Platz, in dem sich die Besucher treffen, um die Eindrücke, die sie gewonnen haben, zu verarbeiten. Gemütliche Sitzgruppen laden zum Verweilen ein."); - } - - r = findregion(9526, 9525); - if (!r->buildings) { - const building_type *bt_generic = bt_find("generic"); - b = new_building(bt_generic, r, NULL); - set_string(&b->name, "Séparée im dämonischen Stil"); - set_string(&b->display, - "Diese ganz im dämonischen Stil gehaltene Sitzgruppe ist ganz in dunklen Schwarztönen gehalten. Muster fremdartiger Runen bedecken das merkwürdig geformte Mobiliar, das unangenehm lebendig wirkt."); - - b = new_building(bt_generic, r, NULL); - set_string(&b->name, "Séparée im elfischen Stil"); - set_string(&b->display, - "Ganz in Grün- und Brauntönen gehalten wirkt die Sitzgruppe fast lebendig. Bei näherer Betrachtung erschließt sich dem Betrachter, daß sie tatsächlich aus lebenden Pflanzen erstellt ist. So ist der Tisch aus einem eizigen Baum gewachsen, und die Polster bestehen aus weichen Grassoden. Ein wunderschön gemusterter Webteppich mit tausenden naturgetreu eingestickter Blumensarten bedeckt den Boden."); - - b = new_building(bt_generic, r, NULL); - set_string(&b->name, "Séparée im halblingschen Stil"); - set_string(&b->display, - "Dieses rustikale Mobiliar ist aus einem einzigen, gewaltigen Baum hergestellt worden. Den Stamm haben fleißige Halblinge der Länge nach gevierteilt und aus den vier langen Viertelstämmen die Sitzbänke geschnitzt, während der verbleibende Stumpf als Tisch dient. Schon von weitem steigen dem Besucher die Gerüche der Köstlichkeiten entgegen, die auf dem Tisch stapeln."); - - b = new_building(bt_generic, r, NULL); - set_string(&b->name, "Séparée im orkischen Stil"); - set_string(&b->display, - "Grobgeschreinerte, elfenhautbespannte Stühle und ein Tisch aus Knochen, über deren Herkunft man sich lieber keine Gedanken macht, bilden die Sitzgruppe im orkischen Stil. Überall haben Orks ihre Namen, und anderes wenig zitierenswertes in das Holz und Gebein geritzt."); - - b = new_building(bt_generic, r, NULL); - set_string(&b->name, "Séparée im Meermenschenstil"); - set_string(&b->display, - "Ganz in Blau- und Grüntönen gehalten, mit Algen und Muscheln verziert wirken die aus altem Meerholz geschnitzten Stühle immer ein wenig feucht. Seltsammerweise hat der schwere aus alten Planken gezimmerte Tisch einen Mast mit kompletten Segel in der Mitte."); - - b = new_building(bt_generic, r, NULL); - set_string(&b->name, "Séparée im Katzenstil"); - set_string(&b->display, - "Die Wände dieses Séparée sind aus dunklem Holz. Was aus der Ferne wie ein chaotisch durchbrochenes Flechtwerk wirkt, entpuppt sich bei näherer Betrachtung als eine bis in winzige Details gestaltete dschungelartige Landschaft, in die eine Vielzahl von kleinen Bildergeschichten eingewoben sind. Wie es scheint hat sich der Künstler Mühe gegeben wirklich jedes Katzenvolk Eresseas zu porträtieren. Das schummrige Innere wird von einem Kamin dominiert, vor dem einige Sessel und weiche Kissen zu einem gemütlichen Nickerchen einladen. Feiner Anduner Sisal bezieht die Lehnen der Sessel und verlockt dazu, seine Krallen hinein zu versenken. Auf einem kleinen Ecktisch steht ein großer Korb mit roten Wollknäulen und grauen und braunen Spielmäusen."); - } else { - for (b = r->buildings; b; b = b->next) { - b->size = b->type->maxsize; - } - } - - r = findregion(9524, 9526); - if (!r) { - r = new_region(9524, 9526, 0); - terraform_region(r, terrain_corridor); - r->planep = museum; - rsetname(r, "Nördliche Promenade"); - rsethorses(r, 0); - rsetmoney(r, 0); - rsetpeasants(r, 0); - set_string(&r->display, - "Die Nördliche Promenade führt direkt in den naturgeschichtlichen Teil des Museums."); - } - r = findregion(9525, 9524); - if (!r) { - r = new_region(9525, 9524, 0); - terraform_region(r, terrain_corridor); - r->planep = museum; - rsetname(r, "Südliche Promenade"); - rsethorses(r, 0); - rsetmoney(r, 0); - rsetpeasants(r, 0); - set_string(&r->display, - "Die Südliche Promenade führt den Besucher in den kulturgeschichtlichen Teil des Museums."); - } -#endif -} - static int use_museumexitticket(unit * u, const struct item_type *itype, int amount, order * ord) diff --git a/src/modules/museum.h b/src/modules/museum.h index 704d38604..de2b73c76 100644 --- a/src/modules/museum.h +++ b/src/modules/museum.h @@ -38,9 +38,6 @@ extern "C" { } museumgiveback; extern void register_museum(void); - extern void create_museum(void); - extern void warden_add_give(struct unit *src, struct unit *u, - const struct item_type *itype, int n); #ifdef __cplusplus } diff --git a/src/move.c b/src/move.c index 069c6ff7d..19dc628d1 100644 --- a/src/move.c +++ b/src/move.c @@ -700,8 +700,7 @@ int check_ship_allowed(struct ship *sh, const region * r) } if (bt_harbour && buildingtype_exists(r, bt_harbour, true)) { - unit* harbourmaster = NULL; - harbourmaster = owner_buildingtyp(r, bt_harbour); + unit* harbourmaster = owner_buildingtyp(r, bt_harbour); if (!harbourmaster || !sh->_owner) { return SA_HARBOUR; } diff --git a/src/randenc.c b/src/randenc.c index 499591294..d65425aeb 100644 --- a/src/randenc.c +++ b/src/randenc.c @@ -621,12 +621,11 @@ void create_icebergs(void) if (r->terrain == t_sleep && chance(0.05)) { bool has_ocean_neighbour = false; direction_t dir; - region *rc; unit *u; freset(r, RF_SELECT); for (dir = 0; dir < MAXDIRECTIONS; dir++) { - rc = rconnect(r, dir); + region *rc = rconnect(r, dir); if (rc && fval(rc->terrain, SEA_REGION)) { has_ocean_neighbour = true; break; diff --git a/src/report.c b/src/report.c index e86ac031a..6cf3a81ff 100644 --- a/src/report.c +++ b/src/report.c @@ -2278,9 +2278,11 @@ report_plaintext(const char *filename, report_context * ctx, m = msg_message("nr_market_info_p", "p1 p2", lux->rtype, herb->rtype); } - else if (lux || herb) { - m = msg_message("nr_market_info_s", "p1", - lux ? lux->rtype : herb->rtype); + else if (lux) { + m = msg_message("nr_market_info_s", "p1",lux->rtype); + } + else if (herb) { + m = msg_message("nr_market_info_s", "p1", herb->rtype); } if (m) { newline(out); diff --git a/src/reports.c b/src/reports.c index 602edb83c..f52ac8407 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1082,14 +1082,6 @@ struct message *msg_curse(const struct curse *c, const void *obj, objtype_t typ, } } -const struct unit *ucansee(const struct faction *f, const struct unit *u, - const struct unit *x) -{ - if (cansee(f, u->region, u, 0)) - return u; - return x; -} - int stealth_modifier(const region *r, const faction *f, seen_mode mode) { switch (mode) { diff --git a/src/reports.h b/src/reports.h index 0c285257e..bbf274b64 100644 --- a/src/reports.h +++ b/src/reports.h @@ -69,9 +69,6 @@ extern "C" { int init_reports(void); void reorder_units(struct region * r); - const struct unit *ucansee(const struct faction *f, - const struct unit *u, const struct unit *x); - int stealth_modifier(const struct region *r, const struct faction *f, seen_mode mode); typedef struct report_context { diff --git a/src/spells.c b/src/spells.c index 7bab3fd2e..36f42c23b 100644 --- a/src/spells.c +++ b/src/spells.c @@ -1883,10 +1883,9 @@ static int sp_treewalkexit(castorder * co) rt = pa->param[0]->data.r; tax = rt->x; tay = rt->y; - rt = NULL; rl = astralregions(r, inhabitable); - rt = 0; + rt = NULL; rl2 = rl; while (rl2) { @@ -1991,7 +1990,6 @@ static int sp_treewalkexit(castorder * co) */ static int sp_holyground(castorder * co) { - const curse_type *ctype = NULL; region *r = co_get_region(co); unit *mage = co->magician.u; int cast_level = co->level; @@ -2000,8 +1998,7 @@ static int sp_holyground(castorder * co) report_spell(mage, r, msg); msg_release(msg); - ctype = &ct_holyground; - create_curse(mage, &r->attribs, ctype, power * power, 1, zero_effect, 0); + create_curse(mage, &r->attribs, &ct_holyground, power * power, 1, zero_effect, 0); a_removeall(&r->attribs, &at_deathcount); @@ -6445,7 +6442,7 @@ static spelldata spell_functions[] = { { "illaundestroymagic", sp_destroy_magic, 0 }, { "clone", sp_clonecopy, 0 }, { "bad_dreams", sp_baddreams, 0 }, - { "mindblast", sp_mindblast_temp, 0 }, + { "mindblast", sp_mindblast, 0 }, { "orkdream", sp_sweetdreams, 0 }, /* M_CERDDOR */ { "appeasement", sp_appeasement, 0 }, diff --git a/src/spells/combatspells.c b/src/spells/combatspells.c index ce737f570..6b9bd0556 100644 --- a/src/spells/combatspells.c +++ b/src/spells/combatspells.c @@ -472,7 +472,7 @@ static skill_t random_skill(unit * u, bool weighted) /** The mind blast spell for regular folks. * This spell temporarily reduces the skill of the victims */ -int sp_mindblast_temp(struct castorder * co) +int sp_mindblast(struct castorder * co) { fighter * fi = co->magician.fig; int level = co->level; @@ -534,85 +534,6 @@ int sp_mindblast_temp(struct castorder * co) return level; } -/** A mind blast spell for monsters. - * This spell PERMANENTLY reduces the skill of the victims or kills them - * when they have no skills left. Not currently in use. - */ -int sp_mindblast(struct castorder * co) -{ - fighter * fi = co->magician.fig; - int level = co->level; - double power = co->force; - const spell * sp = co->sp; - battle *b = fi->side->battle; - unit *mage = fi->unit; - int killed = 0, k = 0, reset = 0; - message *m; - int force = lovar(power * 25); - int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); - - if (!enemies) { - m = msg_message("spell_out_of_range", "mage spell", fi->unit, sp); - message_all(b, m); - msg_release(m); - return 0; - } - - while (enemies > 0 && force > 0) { - unit *du; - troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); - - assert(dt.fighter); - du = dt.fighter->unit; - if (du->flags & UFL_MARK) { - /* not this one again */ - continue; - } - - if (humanoidrace(u_race(du)) && force >= du->number) { - if (!is_magic_resistant(mage, du, 0)) { - skill_t sk = random_skill(du, false); - if (sk != NOSKILL) { - skill *sv = unit_skill(du, sk); - if (sv) { - int n = 1 + rng_int() % 3; - - reduce_skill(du, sv, n); - k += du->number; - } - } - else { - /* unit has no skill. kill it. */ - kill_troop(dt); - ++killed; - } - } - force -= du->number; - } - else { - /* only works against humanoids, don't try others. but do remove them - * from 'force' once or we may never terminate. */ - du->flags |= UFL_MARK; - reset = 1; - } - enemies -= du->number; - } - - if (reset) { - unit *u; - for (u = b->region->units; u; u = u->next) { - u->flags &= ~UFL_MARK; - } - } - - m = - msg_message("sp_mindblast_effect", "mage spell amount dead", mage, sp, k, - killed); - message_all(b, m); - msg_release(m); - return level; -} - int sp_dragonodem(struct castorder * co) { fighter * fi = co->magician.fig; diff --git a/src/spells/combatspells.h b/src/spells/combatspells.h index edd041704..91da5cdeb 100644 --- a/src/spells/combatspells.h +++ b/src/spells/combatspells.h @@ -38,7 +38,6 @@ extern "C" { int sp_hero(struct castorder * co); int sp_frighten(struct castorder * co); int sp_mindblast(struct castorder * co); - int sp_mindblast_temp(struct castorder * co); int sp_speed(struct castorder * co); int sp_wolfhowl(struct castorder * co); int sp_igjarjuk(struct castorder * co); diff --git a/src/triggers/changerace.c b/src/triggers/changerace.c index 5ab56b346..0f644c47b 100644 --- a/src/triggers/changerace.c +++ b/src/triggers/changerace.c @@ -111,7 +111,7 @@ trigger *trigger_changerace(struct unit * u, const struct race * prace, trigger *t = t_new(&tt_changerace); changerace_data *td = (changerace_data *)t->data.v; - assert(u_race(u) == u_irace(u) || "!changerace-triggers cannot stack!"); + assert(u_race(u) == u_irace(u) || !"changerace-triggers cannot stack!"); td->u = u; td->race = prace; td->irace = irace; diff --git a/src/util/language.c b/src/util/language.c index 689ccfcd7..c6da88f2a 100644 --- a/src/util/language.c +++ b/src/util/language.c @@ -258,7 +258,7 @@ void ** get_translations(const struct locale *lang, int index) { assert(lang); assert(lang->index < MAXLOCALES - || "you have to increase MAXLOCALES and recompile"); + || !"you have to increase MAXLOCALES and recompile"); if (lang->index < MAXLOCALES) { return lstrs[lang->index].tokens + index; } diff --git a/src/util/strings.c b/src/util/strings.c index b33f657ef..4959fba6c 100644 --- a/src/util/strings.c +++ b/src/util/strings.c @@ -111,25 +111,6 @@ size_t str_slprintf(char * dst, size_t size, const char * format, ...) return (size_t)result; } -char *set_string(char **s, const char *neu) -{ - if (neu == NULL) { - free(*s); - *s = NULL; - } - else if (*s == NULL) { - *s = malloc(strlen(neu) + 1); - strcpy(*s, neu); - } - else { - char *rs = realloc(*s, strlen(neu) + 1); - assert_alloc(rs); - *s = rs; - strcpy(*s, neu); - } - return *s; -} - void str_replace(char *buffer, size_t size, const char *tmpl, const char *var, const char *value) { size_t val_len = strlen(value); diff --git a/src/util/strings.h b/src/util/strings.h index 76bc5a12a..b50f27a30 100644 --- a/src/util/strings.h +++ b/src/util/strings.h @@ -27,7 +27,6 @@ extern "C" { void str_replace(char *buffer, size_t size, const char *tmpl, const char *var, const char *value); const char *str_escape(const char *str, char *buffer, size_t len); - char *set_string(char **s, const char *neu); unsigned int str_hash(const char *s); size_t str_slprintf(char * dst, size_t size, const char * format, ...); size_t str_strlcpy(char *dst, const char *src, size_t len); diff --git a/src/util/unicode.c b/src/util/unicode.c index 10d43f947..90b63205d 100644 --- a/src/util/unicode.c +++ b/src/util/unicode.c @@ -107,10 +107,6 @@ int unicode_utf8_tolower(utf8_t * op, size_t outlen, const utf8_t * ip) outlen -= size; } } - - if (outlen <= 0) { - return ENOMEM; - } *op = 0; return 0; }