diff --git a/conf/e3/config.json b/conf/e3/config.json index c9a86c8da..30bc7e599 100644 --- a/conf/e3/config.json +++ b/conf/e3/config.json @@ -1,9 +1,9 @@ { - "include": [ - "keywords.json", + "include": [ + "keywords.json", "prefixes.json", "e3/terrains.json" - ], + ], "disabled": [ "herbalism", "alchemy", diff --git a/conf/e4/config.json b/conf/e4/config.json index 7a73de86f..cbe273af6 100644 --- a/conf/e4/config.json +++ b/conf/e4/config.json @@ -1,9 +1,9 @@ { - "include": [ - "keywords.json", + "include": [ + "keywords.json", "prefixes.json", "e3/terrains.json" - ], + ], "disabled": [ "herbalism", "alchemy", diff --git a/conf/keywords.json b/conf/keywords.json index 88ee6c2bd..7117217d7 100644 --- a/conf/keywords.json +++ b/conf/keywords.json @@ -1,69 +1,69 @@ { - "keywords": { - "en" : { - "grow": [ "GROW", "BREED", "PLANT" ], - "combat": [ "COMBAT", "FIGHT" ] - }, - "de": { - "//" : "//", - "banner": "BANNER", - "work": [ "ARBEITE", "ARBEITEN" ], - "attack": ["ATTACKIERE", "ATTACKIEREN"], - "steal": [ "BEKLAUE", "BEKLAUEN" ], - "besiege": ["BELAGERE", "BELAGERN" ], - "name": [ "BENENNE", "BENENNEN" ], - "use": [ "BENUTZE", "BENUTZEN" ], - "describe": [ "BESCHREIBE", "BESCHREIBEN" ], - "enter": ["BETRETE", "BETRETEN"], - "guard": ["BEWACHE", "BEWACHEN"], - "message": "BOTSCHAFT", - "end": "ENDE", - "ride": ["FAHRE", "FAHREN"], - "number": "NUMMER", - "follow": ["FOLGE","FOLGEN"], - "research": ["FORSCHE", "FORSCHEN"], - "give": "GIB", - "help": [ "HELFE", "HELFEN" ], - "combat": [ "KÄMPFE", "KÄMPFEN" ], - "ready" : "KAMPFZAUBER", - "buy" : [ "KAUFE", "KAUFEN"], - "contact": [ "KONTAKT", "KONTAKTIEREN"], - "teach": ["LEHRE", "LEHREN"], - "study": ["LERNE", "LERNEN"], - "make": ["MACHE", "MACHEN"], - "maketemp": ["MACHE TEMP", "MACHETEMP"], - "move" : "NACH", - "password" : "PASSWORT", - "loot" : ["PLÃœNDERE", "PLÃœNDERN"], - "recruit": ["REKRUTIERE", "REKRUTIEREN"], - "reserve": ["RESERVIERE", "RESERVIEREN"], - "route": "ROUTE", - "sabotage": ["SABOTIERE", "SABOTIEREN"], - "option": "OPTION", - "spy": ["SPIONIERE", "SPIONIEREN"], - "quit": "STIRB", - "hide": ["TARNE", "TARNEN"], - "carry": ["TRANSPORTIERE", "TRANSPORTIEREN"], - "tax": ["TREIBE", "TREIBEN", "STEUERN"], - "entertain": ["UNTERHALTE", "UNTERHALTEN"], - "sell": ["VERKAUFE", "VERKAUFEN"], - "leave": ["VERLASSE", "VERLASSEN"], - "forget": ["VERGISS", "VERGESSEN"], - "cast": ["ZAUBERE", "ZAUBERN"], - "show": ["ZEIGE", "ZEIGEN"], - "destroy": ["ZERSTÖRE", "ZERSTÖREN"], - "grow": ["ZÃœCHTE", "PFLANZE", "ZÃœCHTEN", "PFLANZEN"], - "default": "DEFAULT", - "origin": "URSPRUNG", - "email": "EMAIL", - "piracy": "PIRATERIE", - "group": "GRUPPE", - "sort": ["SORTIERE", "SORTIEREN"], - "prefix": "PRÄFIX", - "alliance": "ALLIANZ", - "claim": ["BEANSPRUCHE", "BEANSPRUCHEN"], - "promote": ["BEFÖRDERE", "BEFÖRDERUNG"], - "pay": ["BEZAHLE", "BEZAHLEN"] - } - } + "keywords": { + "en" : { + "grow": [ "GROW", "BREED", "PLANT" ], + "combat": [ "COMBAT", "FIGHT" ] + }, + "de": { + "//" : "//", + "banner": "BANNER", + "work": [ "ARBEITE", "ARBEITEN" ], + "attack": ["ATTACKIERE", "ATTACKIEREN"], + "steal": [ "BEKLAUE", "BEKLAUEN" ], + "besiege": ["BELAGERE", "BELAGERN" ], + "name": [ "BENENNE", "BENENNEN" ], + "use": [ "BENUTZE", "BENUTZEN" ], + "describe": [ "BESCHREIBE", "BESCHREIBEN" ], + "enter": ["BETRETE", "BETRETEN"], + "guard": ["BEWACHE", "BEWACHEN"], + "message": "BOTSCHAFT", + "end": "ENDE", + "ride": ["FAHRE", "FAHREN"], + "number": "NUMMER", + "follow": ["FOLGE","FOLGEN"], + "research": ["FORSCHE", "FORSCHEN"], + "give": "GIB", + "help": [ "HELFE", "HELFEN" ], + "combat": [ "KÄMPFE", "KÄMPFEN" ], + "ready" : "KAMPFZAUBER", + "buy" : [ "KAUFE", "KAUFEN"], + "contact": [ "KONTAKT", "KONTAKTIEREN"], + "teach": ["LEHRE", "LEHREN"], + "study": ["LERNE", "LERNEN"], + "make": ["MACHE", "MACHEN"], + "maketemp": ["MACHE TEMP", "MACHETEMP"], + "move" : "NACH", + "password" : "PASSWORT", + "loot" : ["PLÃœNDERE", "PLÃœNDERN"], + "recruit": ["REKRUTIERE", "REKRUTIEREN"], + "reserve": ["RESERVIERE", "RESERVIEREN"], + "route": "ROUTE", + "sabotage": ["SABOTIERE", "SABOTIEREN"], + "option": "OPTION", + "spy": ["SPIONIERE", "SPIONIEREN"], + "quit": "STIRB", + "hide": ["TARNE", "TARNEN"], + "carry": ["TRANSPORTIERE", "TRANSPORTIEREN"], + "tax": ["TREIBE", "TREIBEN", "STEUERN"], + "entertain": ["UNTERHALTE", "UNTERHALTEN"], + "sell": ["VERKAUFE", "VERKAUFEN"], + "leave": ["VERLASSE", "VERLASSEN"], + "forget": ["VERGISS", "VERGESSEN"], + "cast": ["ZAUBERE", "ZAUBERN"], + "show": ["ZEIGE", "ZEIGEN"], + "destroy": ["ZERSTÖRE", "ZERSTÖREN"], + "grow": ["ZÃœCHTE", "PFLANZE", "ZÃœCHTEN", "PFLANZEN"], + "default": "DEFAULT", + "origin": "URSPRUNG", + "email": "EMAIL", + "piracy": "PIRATERIE", + "group": "GRUPPE", + "sort": ["SORTIERE", "SORTIEREN"], + "prefix": "PRÄFIX", + "alliance": "ALLIANZ", + "claim": ["BEANSPRUCHE", "BEANSPRUCHEN"], + "promote": ["BEFÖRDERE", "BEFÖRDERUNG"], + "pay": ["BEZAHLE", "BEZAHLEN"] + } + } } diff --git a/src/battle.c b/src/battle.c index b4468e843..9e024c1af 100644 --- a/src/battle.c +++ b/src/battle.c @@ -765,7 +765,7 @@ bool missile) skill += CavalryBonus(tu, enemy, BONUS_SKILL); if (wtype) skill = - skillmod(urace(tu)->attribs, tu, tu->region, wtype->skill, skill, + skillmod(u_race(tu)->attribs, tu, tu->region, wtype->skill, skill, SMF_RIDING); } diff --git a/src/economy.c b/src/economy.c index 9d4c80ca0..a7d6740dd 100644 --- a/src/economy.c +++ b/src/economy.c @@ -97,7 +97,7 @@ static request *nextentertainer; static int entertaining; static unsigned int norders; -static request *oa; +static request *g_requests; #define RECRUIT_MERGE 1 static int rules_recruit = -1; @@ -154,21 +154,21 @@ static void expandorders(region * r, request * requests) if (norders > 0) { int i = 0; - oa = (request *)calloc(norders, sizeof(request)); + g_requests = (request *)calloc(norders, sizeof(request)); for (o = requests; o; o = o->next) { if (o->qty > 0) { unsigned int j; for (j = o->qty; j; j--) { - oa[i] = *o; - oa[i].unit->n = 0; + g_requests[i] = *o; + g_requests[i].unit->n = 0; i++; } } } - scramble(oa, norders, sizeof(request)); + scramble(g_requests, norders, sizeof(request)); } else { - oa = NULL; + g_requests = NULL; } while (requests) { request *o = requests->next; @@ -1458,16 +1458,16 @@ static void expandbuying(region * r, request * buyorders) for (j = 0; j != norders; j++) { int price, multi; - ltype = oa[j].type.ltype; + ltype = g_requests[j].type.ltype; trade = trades; while (trade->type != ltype) ++trade; multi = trade->multi; price = ltype->price * multi; - if (get_pooled(oa[j].unit, rsilver, GET_DEFAULT, + if (get_pooled(g_requests[j].unit, rsilver, GET_DEFAULT, price) >= price) { - unit *u = oa[j].unit; + unit *u = g_requests[j].unit; item *items; /* litems zählt die Güter, die verkauft wurden, u->n das Geld, das @@ -1481,7 +1481,7 @@ static void expandbuying(region * r, request * buyorders) items = a->data.v; i_change(&items, ltype->itype, 1); a->data.v = items; - i_change(&oa[j].unit->items, ltype->itype, 1); + i_change(&g_requests[j].unit->items, ltype->itype, 1); use_pooled(u, rsilver, GET_DEFAULT, price); if (u->n < 0) u->n = 0; @@ -1499,7 +1499,7 @@ static void expandbuying(region * r, request * buyorders) fset(u, UFL_LONGACTION | UFL_NOTMOVING); } } - free(oa); + free(g_requests); /* Ausgabe an Einheiten */ @@ -1736,7 +1736,7 @@ static void expandselling(region * r, request * sellorders, int limit) for (j = 0; j != norders; j++) { const luxury_type *search = NULL; - const luxury_type *ltype = oa[j].type.ltype; + const luxury_type *ltype = g_requests[j].type.ltype; int multi = r_demand(r, ltype); int i; int use = 0; @@ -1753,7 +1753,7 @@ static void expandselling(region * r, request * sellorders, int limit) if (money >= price) { int abgezogenhafen = 0; int abgezogensteuer = 0; - unit *u = oa[j].unit; + unit *u = g_requests[j].unit; item *itm; attrib *a = a_find(u->attribs, &at_luxuries); if (a == NULL) @@ -1801,10 +1801,10 @@ static void expandselling(region * r, request * sellorders, int limit) } } if (use > 0) { - use_pooled(oa[j].unit, ltype->itype->rtype, GET_DEFAULT, use); + use_pooled(g_requests[j].unit, ltype->itype->rtype, GET_DEFAULT, use); } } - free(oa); + free(g_requests); /* Steuern. Hier werden die Steuern dem Besitzer der größten Burg gegeben. */ if (maxowner) { @@ -1928,7 +1928,7 @@ static bool sell(unit * u, request ** sellorders, struct order *ord) s = gettoken(token, sizeof(token)); itype = s ? finditemtype(s, u->faction->locale) : 0; ltype = itype ? resource2luxury(itype->rtype) : 0; - if (ltype == NULL) { + if (ltype == NULL || itype == NULL) { cmistake(u, ord, 126, MSG_COMMERCE); return false; } @@ -2010,8 +2010,8 @@ static void expandstealing(region * r, request * stealorders) * u ist die beklaute unit. oa.unit ist die klauende unit. */ - for (j = 0; j != norders && oa[j].unit->n <= oa[j].unit->wants; j++) { - unit *u = findunitg(oa[j].no, r); + for (j = 0; j != norders && g_requests[j].unit->n <= g_requests[j].unit->wants; j++) { + unit *u = findunitg(g_requests[j].no, r); int n = 0; if (u && u->region == r) { n = get_pooled(u, rsilver, GET_ALL, INT_MAX); @@ -2035,17 +2035,17 @@ static void expandstealing(region * r, request * stealorders) n = 10; } if (n > 0) { - n = _min(n, oa[j].unit->wants); + n = _min(n, g_requests[j].unit->wants); use_pooled(u, rsilver, GET_ALL, n); - oa[j].unit->n = n; - change_money(oa[j].unit, n); + g_requests[j].unit->n = n; + change_money(g_requests[j].unit, n); ADDMSG(&u->faction->msgs, msg_message("stealeffect", "unit region amount", u, u->region, n)); } - add_income(oa[j].unit, IC_STEAL, oa[j].unit->wants, oa[j].unit->n); - fset(oa[j].unit, UFL_LONGACTION | UFL_NOTMOVING); + add_income(g_requests[j].unit, IC_STEAL, g_requests[j].unit->wants, g_requests[j].unit->n); + fset(g_requests[j].unit, UFL_LONGACTION | UFL_NOTMOVING); } - free(oa); + free(g_requests); } /* ------------------------------------------------------------- */ @@ -2060,14 +2060,14 @@ static void plant(unit * u, int raw) if (!fval(r->terrain, LAND_REGION)) { return; } - if (rherbtype(r) == NULL) { + itype = rherbtype(r); + if (itype == NULL) { cmistake(u, u->thisorder, 108, MSG_PRODUCE); return; } /* Skill prüfen */ skill = effskill(u, SK_HERBALISM, 0); - itype = rherbtype(r); if (skill < 6) { ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder, "plant_skills", @@ -2702,13 +2702,13 @@ static void expandloot(region * r, request * lootorders) return; for (i = 0; i != norders && startmoney > looted + TAXFRACTION * 2; i++) { - change_money(oa[i].unit, TAXFRACTION); - oa[i].unit->n += TAXFRACTION; + change_money(g_requests[i].unit, TAXFRACTION); + g_requests[i].unit->n += TAXFRACTION; /*Looting destroys double the money*/ looted += TAXFRACTION * 2; } rsetmoney(r, startmoney - looted); - free(oa); + free(g_requests); /* Lowering morale by 1 depending on the looted money (+20%) */ if (rng_int() % 100 < 20 + (looted * 80) / startmoney) { @@ -2737,11 +2737,11 @@ void expandtax(region * r, request * taxorders) return; for (i = 0; i != norders && rmoney(r) > TAXFRACTION; i++) { - change_money(oa[i].unit, TAXFRACTION); - oa[i].unit->n += TAXFRACTION; + change_money(g_requests[i].unit, TAXFRACTION); + g_requests[i].unit->n += TAXFRACTION; rsetmoney(r, rmoney(r) - TAXFRACTION); } - free(oa); + free(g_requests); for (u = r->units; u; u = u->next) { if (u->n >= 0) { @@ -2939,9 +2939,10 @@ static void peasant_taxes(region * r) maxsize = buildingeffsize(b, false); if (maxsize > 0) { double taxfactor = money * b->type->taxes(b, maxsize); - double morale = money * region_get_morale(r) * MORALE_TAX_FACTOR; - if (taxfactor > morale) + double morale = MORALE_TAX_FACTOR * money * region_get_morale(r); + if (taxfactor > morale) { taxfactor = morale; + } if (taxfactor > 0) { int taxmoney = (int)taxfactor; change_money(u, taxmoney); diff --git a/src/give.c b/src/give.c index 781f39ca6..524a27017 100644 --- a/src/give.c +++ b/src/give.c @@ -137,7 +137,7 @@ int give_quota(const unit * src, const unit * dst, const item_type * type, } if (dst && src && src->faction != dst->faction) { divisor = config_get_flt("rules.items.give_divisor", 1); - assert(divisor == 0 || divisor >= 1); + assert(divisor <= 0 || divisor >= 1); if (divisor >= 1) { /* predictable > correct: */ int x = (int)(n / divisor); @@ -781,7 +781,7 @@ void give_cmd(unit * u, order * ord) } if (u2 != NULL) { - if ((u_race(u)->ec_flags & ECF_KEEP_ITEM) && u2 != NULL) { + if ((u_race(u)->ec_flags & ECF_KEEP_ITEM)) { ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "race_nogive", "race", u_race(u))); return; diff --git a/src/items.c b/src/items.c index 5e9a357e6..081f29c14 100644 --- a/src/items.c +++ b/src/items.c @@ -114,10 +114,9 @@ struct order *ord) const resource_type *rt_crystal = NULL; int i; - if (rt_crystal == NULL) { - rt_crystal = rt_find("antimagic"); - assert(rt_crystal != NULL); - } + rt_crystal = rt_find("antimagic"); + assert(rt_crystal != NULL); + for (i = 0; i != amount; ++i) { int effect, duration = 2; double force; diff --git a/src/kernel/building.test.c b/src/kernel/building.test.c index 755e9319f..d15c82c8e 100644 --- a/src/kernel/building.test.c +++ b/src/kernel/building.test.c @@ -405,8 +405,8 @@ static void test_buildingtype_exists(CuTest * tc) r = findregion(-1, 0); b = new_building(btype, r, default_locale); - b->size = 10; CuAssertPtrNotNull(tc, b); + b->size = 10; CuAssertTrue(tc, !buildingtype_exists(r, NULL, false)); CuAssertTrue(tc, !buildingtype_exists(r, btype2, false)); diff --git a/src/kernel/config.c b/src/kernel/config.c index db27d46be..d100dd40c 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -741,10 +741,15 @@ int cmp_current_owner(const building * b, const building * a) int oldsize = buildingeffsize(a, false); double oldtaxes = a->type->taxes(a, oldsize); - if (newtaxes != oldtaxes) - return (newtaxes > oldtaxes) ? 1 : -1; - if (newsize != oldsize) + if (newtaxes > oldtaxes) { + return 1; + } + if (newtaxes < oldtaxes) { + return -1; + } + if (newsize != oldsize) { return newsize - oldsize; + } return (b->size - a->size); } else { @@ -944,7 +949,7 @@ int entertainmoney(const region * r) return 0; } - n = rmoney(r) / ENTERTAINFRACTION; + n = rmoney(r) / (double)ENTERTAINFRACTION; if (is_cursed(r->attribs, C_GENEROUS, 0)) { n *= get_curseeffect(r->attribs, C_GENEROUS, 0); diff --git a/src/kernel/curse.c b/src/kernel/curse.c index 3ecf48899..2ee89799d 100644 --- a/src/kernel/curse.c +++ b/src/kernel/curse.c @@ -825,7 +825,7 @@ double destr_curse(curse * c, int cast_level, double force) c->type->change_vigour(c, -(cast_level + 1) / 2); } else { - c->vigour -= cast_level + 1 / 2; + c->vigour -= (cast_level + 1) / 2.0; } } } diff --git a/src/kernel/faction.c b/src/kernel/faction.c index 6d2430de4..d332bf604 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -827,7 +827,7 @@ int writepasswd(void) log_info("writing passwords..."); for (f = factions; f; f = f->next) { - fprintf(F, "%s:%s:%s:%u\n", + fprintf(F, "%s:%s:%s:%d\n", itoa36(f->no), f->email, f->_password, f->subscription); } fclose(F); diff --git a/src/kernel/item.c b/src/kernel/item.c index f9234368c..cedf15df0 100644 --- a/src/kernel/item.c +++ b/src/kernel/item.c @@ -973,7 +973,7 @@ void init_resources(void) { resource_type *rtype; - rtype = rt_get_or_create(resourcenames[R_PERSON]); // lousy hack + rt_get_or_create(resourcenames[R_PERSON]); // lousy hack rtype = rt_get_or_create(resourcenames[R_PEASANT]); rtype->uchange = res_changepeasants; @@ -1204,7 +1204,7 @@ void read_items(struct storage *store, item ** ilist) itype = it_find(ibuf); READ_INT(store, &i); if (i <= 0) { - log_error("data contains an entry with %d %s", i, resourcename(itype->rtype, NMF_PLURAL)); + log_error("data contains an entry with %d %s", i, ibuf); } else { if (itype && itype->rtype) { diff --git a/src/kernel/pool.c b/src/kernel/pool.c index 6ceeda63d..5609d211f 100644 --- a/src/kernel/pool.c +++ b/src/kernel/pool.c @@ -179,7 +179,7 @@ int count) if (u != v && (v->items || rtype->uget)) { int mask; - if ((urace(v)->ec_flags & ECF_KEEP_ITEM)) + if ((u_race(v)->ec_flags & ECF_KEEP_ITEM)) continue; if (v->faction == f) { @@ -232,7 +232,7 @@ use_pooled(unit * u, const resource_type * rtype, unsigned int mode, int count) for (v = r->units; use > 0 && v != NULL; v = v->next) { if (u != v) { int mask; - if ((urace(v)->ec_flags & ECF_KEEP_ITEM)) + if ((u_race(v)->ec_flags & ECF_KEEP_ITEM)) continue; if (v->items == NULL && rtype->uget == NULL) continue; diff --git a/src/kernel/resources.c b/src/kernel/resources.c index 658445c69..e064150e6 100644 --- a/src/kernel/resources.c +++ b/src/kernel/resources.c @@ -46,7 +46,7 @@ extern int dice_rand(const char *s); static void update_resource(struct rawmaterial *res, double modifier) { - double amount = 1 + (res->level - res->startlevel) * res->divisor / 100.0; + double amount = (res->level - res->startlevel) / 100.0 * res->divisor + 1; amount = ResourceFactor() * res->base * amount * modifier; if (amount < 1.0) res->amount = 1; diff --git a/src/kernel/unit.c b/src/kernel/unit.c index 95c689ded..4aff7d118 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -917,11 +917,6 @@ bool leave(unit * u, bool force) return true; } -const struct race *urace(const struct unit *u) -{ - return u->_race; -} - bool can_survive(const unit * u, const region * r) { if ((fval(r->terrain, WALK_INTO) && (u_race(u)->flags & RCF_WALK)) diff --git a/src/kernel/unit.h b/src/kernel/unit.h index a360321a2..e81c43135 100644 --- a/src/kernel/unit.h +++ b/src/kernel/unit.h @@ -141,8 +141,6 @@ extern "C" { struct unit *utarget(const struct unit *u); void usettarget(struct unit *u, const struct unit *b); - extern const struct race *urace(const struct unit *u); - const char *uprivate(const struct unit *u); void usetprivate(struct unit *u, const char *c); diff --git a/src/laws.c b/src/laws.c index fd4f50b78..7ab6c7560 100644 --- a/src/laws.c +++ b/src/laws.c @@ -648,7 +648,7 @@ growing_trees(region * r, const int current_season, const int last_weeks_season) * verfügbaren Fläche ab. In Gletschern gibt es weniger * Möglichkeiten als in Ebenen. */ sprout = 0; - seedchance = (1000 * region_maxworkers(r2)) / r2->terrain->size; + seedchance = (1000 * region_maxworkers(r2)) / (double)r2->terrain->size; for (i = 0; i < seeds / MAXDIRECTIONS; i++) { if (rng_int() % 10000 < seedchance) sprout++; @@ -3636,7 +3636,7 @@ int pay_cmd(unit * u, struct order *ord) static int reserve_i(unit * u, struct order *ord, int flags) { char token[128]; - if (u->number > 0 && (urace(u)->ec_flags & GETITEM)) { + if (u->number > 0 && (u_race(u)->ec_flags & GETITEM)) { int use, count, para; const item_type *itype; const char *s; @@ -3945,7 +3945,7 @@ int armedmen(const unit * u, bool siege_weapons) { item *itm; int n = 0; - if (!(urace(u)->flags & RCF_NOWEAPONS)) { + if (!(u_race(u)->flags & RCF_NOWEAPONS)) { if (effskill(u, SK_WEAPONLESS, 0) >= 1) { /* kann ohne waffen bewachen: fuer drachen */ n = u->number; diff --git a/src/monster.c b/src/monster.c index 42e334fde..301b1b132 100644 --- a/src/monster.c +++ b/src/monster.c @@ -76,17 +76,13 @@ bool monster_is_waiting(const unit * u) static void eaten_by_monster(unit * u) { /* adjustment for smaller worlds */ - static double multi = 0.0; + double multi = RESOURCE_QUANTITY * newterrain(T_PLAIN)->size / 10000.0; int n = 0; int horse = -1; const resource_type *rhorse = get_resourcetype(R_HORSE); const race *rc = u_race(u); attrib *a; - if (multi == 0.0) { - multi = RESOURCE_QUANTITY * newterrain(T_PLAIN)->size / 10000.0; - } - a = a_find(rc->attribs, &at_scare); if (a) { n = rng_int() & a->data.i * u->number; diff --git a/src/monsters.c b/src/monsters.c index 9f49a2603..cea817589 100644 --- a/src/monsters.c +++ b/src/monsters.c @@ -695,7 +695,7 @@ static order *plan_dragon(unit * u) int attempts = 0; skill_t sk = SK_PERCEPTION; /* study perception (or a random useful skill) */ - while ((!skill_enabled(sk) || (attempts < MAXSKILLS && u_race(u)->bonus[sk] < (++attempts < 10?1:-5 )))) { + while (!skill_enabled(sk) || (attempts < MAXSKILLS && u_race(u)->bonus[sk] < (++attempts < 10?1:-5 ))) { sk = (skill_t)(rng_int() % MAXSKILLS); } long_order = create_order(K_STUDY, u->faction->locale, "'%s'", diff --git a/src/report.c b/src/report.c index dc52c38a3..e9b66c461 100644 --- a/src/report.c +++ b/src/report.c @@ -1730,7 +1730,7 @@ static void rpline(struct stream *out) memset(line, '-', sizeof(line)); line[REPORTWIDTH] = '\n'; } - swrite(line, sizeof(char), sizeof(line), out); + swrite(line, sizeof(line), 1, out); } static void list_address(struct stream *out, const faction * uf, quicklist * seenfactions) diff --git a/src/summary.c b/src/summary.c index b82c3a50e..2311b1994 100644 --- a/src/summary.c +++ b/src/summary.c @@ -220,7 +220,7 @@ void report_summary(summary * s, summary * o, bool full) fprintf(F, " Helden: %s\n", pcomp(s->heroes, o->heroes)); if (full) { - fprintf(F, "Regionen: %d\n", listlen(regions)); + fprintf(F, "Regionen: %d\n", (int)listlen(regions)); fprintf(F, "Bewohnte Regionen: %d\n", s->inhabitedregions); fprintf(F, "Landregionen: %d\n", s->landregionen); fprintf(F, "Spielerregionen: %d\n", s->regionen_mit_spielern); diff --git a/src/util/unicode.test.c b/src/util/unicode.test.c index 6eb3c4c52..ef07c944c 100644 --- a/src/util/unicode.test.c +++ b/src/util/unicode.test.c @@ -29,7 +29,7 @@ static void test_unicode_trim(CuTest * tc) CuAssertIntEquals(tc, 3, unicode_utf8_trim(buffer)); CuAssertStrEquals(tc, "Hello Word", buffer); - buffer[9] = (char)0xc3; + buffer[9] = -61; CuAssertIntEquals(tc, 1, unicode_utf8_trim(buffer)); CuAssertStrEquals(tc, "Hello Wor?", buffer); }