forked from github/server
cppcheck warnings and scope reductions.
This commit is contained in:
parent
26c31708dc
commit
17ee0e50b6
17 changed files with 42 additions and 61 deletions
|
@ -710,7 +710,6 @@ static int config_get_resource(lua_State * L)
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
}
|
}
|
||||||
if (itype->construction) {
|
if (itype->construction) {
|
||||||
int i;
|
|
||||||
lua_pushstring(L, "build_skill_min");
|
lua_pushstring(L, "build_skill_min");
|
||||||
lua_pushinteger(L, itype->construction->minskill);
|
lua_pushinteger(L, itype->construction->minskill);
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
|
@ -718,6 +717,7 @@ static int config_get_resource(lua_State * L)
|
||||||
lua_pushstring(L, skillnames[itype->construction->skill]);
|
lua_pushstring(L, skillnames[itype->construction->skill]);
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
if (itype->construction->materials) {
|
if (itype->construction->materials) {
|
||||||
|
int i;
|
||||||
lua_pushstring(L, "materials");
|
lua_pushstring(L, "materials");
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
for (i = 0; itype->construction->materials[i].number; ++i) {
|
for (i = 0; itype->construction->materials[i].number; ++i) {
|
||||||
|
@ -774,7 +774,6 @@ static int config_get_btype(lua_State * L)
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
}
|
}
|
||||||
if (btype->construction) {
|
if (btype->construction) {
|
||||||
int i;
|
|
||||||
lua_pushstring(L, "build_skill_min");
|
lua_pushstring(L, "build_skill_min");
|
||||||
lua_pushinteger(L, btype->construction->minskill);
|
lua_pushinteger(L, btype->construction->minskill);
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
|
@ -782,6 +781,7 @@ static int config_get_btype(lua_State * L)
|
||||||
lua_pushstring(L, skillnames[btype->construction->skill]);
|
lua_pushstring(L, skillnames[btype->construction->skill]);
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
if (btype->construction->materials) {
|
if (btype->construction->materials) {
|
||||||
|
int i;
|
||||||
lua_pushstring(L, "materials");
|
lua_pushstring(L, "materials");
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
for (i = 0; btype->construction->materials[i].number; ++i) {
|
for (i = 0; btype->construction->materials[i].number; ++i) {
|
||||||
|
@ -840,7 +840,6 @@ static int config_get_stype(lua_State * L)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stype->construction) {
|
if (stype->construction) {
|
||||||
int i;
|
|
||||||
lua_pushstring(L, "build_skill_min");
|
lua_pushstring(L, "build_skill_min");
|
||||||
lua_pushinteger(L, stype->construction->minskill);
|
lua_pushinteger(L, stype->construction->minskill);
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
|
@ -848,6 +847,7 @@ static int config_get_stype(lua_State * L)
|
||||||
lua_pushstring(L, skillnames[stype->construction->skill]);
|
lua_pushstring(L, skillnames[stype->construction->skill]);
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
if (stype->construction->materials) {
|
if (stype->construction->materials) {
|
||||||
|
int i;
|
||||||
lua_pushstring(L, "materials");
|
lua_pushstring(L, "materials");
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
for (i = 0; stype->construction->materials[i].number; ++i) {
|
for (i = 0; stype->construction->materials[i].number; ++i) {
|
||||||
|
@ -922,12 +922,6 @@ int tolua_read_xml(lua_State * L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct event_args {
|
|
||||||
int hfunction;
|
|
||||||
int hargs;
|
|
||||||
const char *sendertype;
|
|
||||||
} event_args;
|
|
||||||
|
|
||||||
static int tolua_report_unit(lua_State * L)
|
static int tolua_report_unit(lua_State * L)
|
||||||
{
|
{
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
|
|
|
@ -1763,8 +1763,6 @@ static void expandselling(region * r, econ_request * sellorders, int limit)
|
||||||
price = ltype->price * multi;
|
price = ltype->price * multi;
|
||||||
|
|
||||||
if (money >= price) {
|
if (money >= price) {
|
||||||
int abgezogenhafen = 0;
|
|
||||||
int abgezogensteuer = 0;
|
|
||||||
unit *u = g_requests[j].unit;
|
unit *u = g_requests[j].unit;
|
||||||
item *itm;
|
item *itm;
|
||||||
attrib *a = a_find(u->attribs, &at_luxuries);
|
attrib *a = a_find(u->attribs, &at_luxuries);
|
||||||
|
@ -1779,7 +1777,7 @@ static void expandselling(region * r, econ_request * sellorders, int limit)
|
||||||
|
|
||||||
if (hafenowner != NULL) {
|
if (hafenowner != NULL) {
|
||||||
if (hafenowner->faction != u->faction) {
|
if (hafenowner->faction != u->faction) {
|
||||||
abgezogenhafen = price / 10;
|
int abgezogenhafen = price / 10;
|
||||||
hafencollected += abgezogenhafen;
|
hafencollected += abgezogenhafen;
|
||||||
price -= abgezogenhafen;
|
price -= abgezogenhafen;
|
||||||
money -= abgezogenhafen;
|
money -= abgezogenhafen;
|
||||||
|
@ -1787,7 +1785,7 @@ static void expandselling(region * r, econ_request * sellorders, int limit)
|
||||||
}
|
}
|
||||||
if (maxb != NULL) {
|
if (maxb != NULL) {
|
||||||
if (maxowner->faction != u->faction) {
|
if (maxowner->faction != u->faction) {
|
||||||
abgezogensteuer = price * tax_per_size[maxeffsize] / 100;
|
int abgezogensteuer = price * tax_per_size[maxeffsize] / 100;
|
||||||
taxcollected += abgezogensteuer;
|
taxcollected += abgezogensteuer;
|
||||||
price -= abgezogensteuer;
|
price -= abgezogensteuer;
|
||||||
money -= abgezogensteuer;
|
money -= abgezogensteuer;
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <CuTest.h>
|
|
||||||
#include <stream.h>
|
|
||||||
#include <memstream.h>
|
|
||||||
|
|
||||||
#include <kernel/region.h>
|
|
||||||
#include <kernel/terrain.h>
|
|
||||||
|
|
||||||
#include "json.h"
|
#include "json.h"
|
||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
|
|
||||||
|
#include <kernel/region.h>
|
||||||
|
#include <kernel/terrain.h>
|
||||||
|
|
||||||
|
#include <stream.h>
|
||||||
|
#include <memstream.h>
|
||||||
|
|
||||||
#include <cJSON.h>
|
#include <cJSON.h>
|
||||||
|
#include <CuTest.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
static char *strip(char *str) {
|
static char *strip(char *str) {
|
||||||
char *s = str, *b = str, *e = str;
|
char *s = str, *b = str, *e = str;
|
||||||
/* b is where text begins, e where it ends, s where we insert it. */
|
/* b is where text begins, e where it ends, s where we insert it. */
|
||||||
|
|
|
@ -422,7 +422,7 @@ const char *alliancename(const alliance * al)
|
||||||
char *ibuf = idbuf[(++nextbuf) % 8];
|
char *ibuf = idbuf[(++nextbuf) % 8];
|
||||||
|
|
||||||
if (al && al->name) {
|
if (al && al->name) {
|
||||||
slprintf(ibuf, sizeof(name), "%s (%s)", al->name, itoa36(al->id));
|
slprintf(ibuf, sizeof(idbuf[0]), "%s (%s)", al->name, itoa36(al->id));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -499,7 +499,7 @@ const char *buildingname(const building * b)
|
||||||
static name idbuf[8];
|
static name idbuf[8];
|
||||||
static int nextbuf = 0;
|
static int nextbuf = 0;
|
||||||
char *ibuf = idbuf[(++nextbuf) % 8];
|
char *ibuf = idbuf[(++nextbuf) % 8];
|
||||||
return write_buildingname(b, ibuf, sizeof(name));
|
return write_buildingname(b, ibuf, sizeof(idbuf[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void building_set_owner(struct unit * owner)
|
void building_set_owner(struct unit * owner)
|
||||||
|
|
|
@ -596,7 +596,7 @@ const resource_type *get_resourcetype(resource_t type) {
|
||||||
static struct resource_type * rtypes[MAX_RESOURCES];
|
static struct resource_type * rtypes[MAX_RESOURCES];
|
||||||
const resource_type *rtype = NULL;
|
const resource_type *rtype = NULL;
|
||||||
if (update != num_resources) {
|
if (update != num_resources) {
|
||||||
memset(rtypes, 0, sizeof(rtypes));
|
memset(rtypes, 0, sizeof(resource_type *) * MAX_RESOURCES);
|
||||||
update = num_resources;
|
update = num_resources;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -301,7 +301,7 @@ int current_turn(void)
|
||||||
perror(zText);
|
perror(zText);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int c = fscanf(F, "%d\n", &cturn);
|
int c = fscanf(F, "%4d\n", &cturn);
|
||||||
fclose(F);
|
fclose(F);
|
||||||
if (c != 1) {
|
if (c != 1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -386,7 +386,7 @@ const char *shipname(const ship * sh)
|
||||||
static name idbuf[8];
|
static name idbuf[8];
|
||||||
static int nextbuf = 0;
|
static int nextbuf = 0;
|
||||||
char *ibuf = idbuf[(++nextbuf) % 8];
|
char *ibuf = idbuf[(++nextbuf) % 8];
|
||||||
return write_shipname(sh, ibuf, sizeof(name));
|
return write_shipname(sh, ibuf, sizeof(idbuf[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
int shipcapacity(const ship * sh)
|
int shipcapacity(const ship * sh)
|
||||||
|
|
|
@ -1711,7 +1711,6 @@ void unit_addorder(unit * u, order * ord)
|
||||||
int unit_max_hp(const unit * u)
|
int unit_max_hp(const unit * u)
|
||||||
{
|
{
|
||||||
int h;
|
int h;
|
||||||
double p;
|
|
||||||
static int config;
|
static int config;
|
||||||
static bool rule_stamina;
|
static bool rule_stamina;
|
||||||
h = u_race(u)->hitpoints;
|
h = u_race(u)->hitpoints;
|
||||||
|
@ -1720,7 +1719,7 @@ int unit_max_hp(const unit * u)
|
||||||
rule_stamina = config_get_int("rules.stamina", 1)!=0;
|
rule_stamina = config_get_int("rules.stamina", 1)!=0;
|
||||||
}
|
}
|
||||||
if (rule_stamina) {
|
if (rule_stamina) {
|
||||||
p = pow(effskill(u, SK_STAMINA, u->region) / 2.0, 1.5) * 0.2;
|
double p = pow(effskill(u, SK_STAMINA, u->region) / 2.0, 1.5) * 0.2;
|
||||||
h += (int)(h * p + 0.5);
|
h += (int)(h * p + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1890,7 +1889,7 @@ char *write_unitname(const unit * u, char *buffer, size_t size)
|
||||||
const char *unitname(const unit * u)
|
const char *unitname(const unit * u)
|
||||||
{
|
{
|
||||||
char *ubuf = idbuf[(++nextbuf) % 8];
|
char *ubuf = idbuf[(++nextbuf) % 8];
|
||||||
return write_unitname(u, ubuf, sizeof(name));
|
return write_unitname(u, ubuf, sizeof(idbuf[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool unit_name_equals_race(const unit *u) {
|
bool unit_name_equals_race(const unit *u) {
|
||||||
|
|
|
@ -18,6 +18,6 @@ const char *eressea_version(void) {
|
||||||
|
|
||||||
int version_no(const char *str) {
|
int version_no(const char *str) {
|
||||||
int maj = 0, min = 0, pat = 0;
|
int maj = 0, min = 0, pat = 0;
|
||||||
sscanf(str, "%d.%d.%d", &maj, &min, &pat);
|
sscanf(str, "%4d.%4d.%4d", &maj, &min, &pat);
|
||||||
return (maj << 16) | (min << 8) | pat;
|
return (maj << 16) | (min << 8) | pat;
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,13 +284,13 @@ static int parse_buildings(xmlDocPtr doc)
|
||||||
{
|
{
|
||||||
xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
|
xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
|
||||||
xmlXPathObjectPtr buildings;
|
xmlXPathObjectPtr buildings;
|
||||||
int i;
|
|
||||||
|
|
||||||
/* reading eressea/buildings/building */
|
/* reading eressea/buildings/building */
|
||||||
buildings =
|
buildings =
|
||||||
xmlXPathEvalExpression(BAD_CAST "/eressea/buildings/building", xpath);
|
xmlXPathEvalExpression(BAD_CAST "/eressea/buildings/building", xpath);
|
||||||
if (buildings->nodesetval != NULL) {
|
if (buildings->nodesetval != NULL) {
|
||||||
xmlNodeSetPtr nodes = buildings->nodesetval;
|
xmlNodeSetPtr nodes = buildings->nodesetval;
|
||||||
|
int i;
|
||||||
for (i = 0; i != nodes->nodeNr; ++i) {
|
for (i = 0; i != nodes->nodeNr; ++i) {
|
||||||
xmlNodePtr node = nodes->nodeTab[i];
|
xmlNodePtr node = nodes->nodeTab[i];
|
||||||
xmlChar *propValue;
|
xmlChar *propValue;
|
||||||
|
@ -396,12 +396,12 @@ static int parse_ships(xmlDocPtr doc)
|
||||||
{
|
{
|
||||||
xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
|
xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
|
||||||
xmlXPathObjectPtr ships;
|
xmlXPathObjectPtr ships;
|
||||||
int i;
|
|
||||||
|
|
||||||
/* reading eressea/ships/ship */
|
/* reading eressea/ships/ship */
|
||||||
ships = xmlXPathEvalExpression(BAD_CAST "/eressea/ships/ship", xpath);
|
ships = xmlXPathEvalExpression(BAD_CAST "/eressea/ships/ship", xpath);
|
||||||
if (ships->nodesetval != NULL) {
|
if (ships->nodesetval != NULL) {
|
||||||
xmlNodeSetPtr nodes = ships->nodesetval;
|
xmlNodeSetPtr nodes = ships->nodesetval;
|
||||||
|
int i;
|
||||||
for (i = 0; i != nodes->nodeNr; ++i) {
|
for (i = 0; i != nodes->nodeNr; ++i) {
|
||||||
xmlNodePtr child, node = nodes->nodeTab[i];
|
xmlNodePtr child, node = nodes->nodeTab[i];
|
||||||
xmlChar *propValue;
|
xmlChar *propValue;
|
||||||
|
@ -810,7 +810,6 @@ static int parse_resources(xmlDocPtr doc)
|
||||||
resource_type *rtype;
|
resource_type *rtype;
|
||||||
unsigned int flags = RTF_NONE;
|
unsigned int flags = RTF_NONE;
|
||||||
xmlXPathObjectPtr result;
|
xmlXPathObjectPtr result;
|
||||||
int k;
|
|
||||||
|
|
||||||
if (xml_bvalue(node, "pooled", true))
|
if (xml_bvalue(node, "pooled", true))
|
||||||
flags |= RTF_POOLED;
|
flags |= RTF_POOLED;
|
||||||
|
@ -828,7 +827,8 @@ static int parse_resources(xmlDocPtr doc)
|
||||||
/* reading eressea/resources/resource/function */
|
/* reading eressea/resources/resource/function */
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
|
||||||
if (result->nodesetval != NULL)
|
if (result->nodesetval != NULL) {
|
||||||
|
int k;
|
||||||
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
||||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||||
pf_generic fun;
|
pf_generic fun;
|
||||||
|
@ -852,6 +852,7 @@ static int parse_resources(xmlDocPtr doc)
|
||||||
}
|
}
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
xmlXPathFreeObject(result);
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
if (xml_bvalue(node, "material", false)) {
|
if (xml_bvalue(node, "material", false)) {
|
||||||
|
|
21
src/laws.c
21
src/laws.c
|
@ -433,14 +433,15 @@ static void horses(region * r)
|
||||||
rsethorses(r, (int)(horses * 0.9));
|
rsethorses(r, (int)(horses * 0.9));
|
||||||
}
|
}
|
||||||
else if (maxhorses) {
|
else if (maxhorses) {
|
||||||
int i;
|
|
||||||
double growth =
|
double growth =
|
||||||
(RESOURCE_QUANTITY * HORSEGROWTH * 200 * (maxhorses -
|
(RESOURCE_QUANTITY * HORSEGROWTH * 200 * (maxhorses -
|
||||||
horses)) / maxhorses;
|
horses)) / maxhorses;
|
||||||
|
|
||||||
if (growth > 0) {
|
if (growth > 0) {
|
||||||
if (a_find(r->attribs, &at_horseluck))
|
int i;
|
||||||
|
if (a_find(r->attribs, &at_horseluck)) {
|
||||||
growth *= 2;
|
growth *= 2;
|
||||||
|
}
|
||||||
/* printf("Horses: <%d> %d -> ", growth, horses); */
|
/* printf("Horses: <%d> %d -> ", growth, horses); */
|
||||||
i = (int)(0.5 + (horses * 0.0001) * growth);
|
i = (int)(0.5 + (horses * 0.0001) * growth);
|
||||||
/* printf("%d\n", horses); */
|
/* printf("%d\n", horses); */
|
||||||
|
@ -562,13 +563,13 @@ growing_trees_e3(region * r, const int current_season,
|
||||||
static void
|
static void
|
||||||
growing_trees(region * r, const int current_season, const int last_weeks_season)
|
growing_trees(region * r, const int current_season, const int last_weeks_season)
|
||||||
{
|
{
|
||||||
int growth, grownup_trees, i, seeds, sprout;
|
int grownup_trees, i, seeds, sprout;
|
||||||
direction_t d;
|
|
||||||
attrib *a;
|
attrib *a;
|
||||||
|
|
||||||
if (current_season == SEASON_SUMMER || current_season == SEASON_AUTUMN) {
|
if (current_season == SEASON_SUMMER || current_season == SEASON_AUTUMN) {
|
||||||
double seedchance = 0.01F * RESOURCE_QUANTITY;
|
double seedchance = 0.01F * RESOURCE_QUANTITY;
|
||||||
int elves = count_race(r, get_race(RC_ELF));
|
int elves = count_race(r, get_race(RC_ELF));
|
||||||
|
direction_t d;
|
||||||
|
|
||||||
a = a_find(r->attribs, &at_germs);
|
a = a_find(r->attribs, &at_germs);
|
||||||
if (a && last_weeks_season == SEASON_SPRING) {
|
if (a && last_weeks_season == SEASON_SPRING) {
|
||||||
|
@ -638,6 +639,7 @@ growing_trees(region * r, const int current_season, const int last_weeks_season)
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (current_season == SEASON_SPRING) {
|
else if (current_season == SEASON_SPRING) {
|
||||||
|
int growth;
|
||||||
|
|
||||||
if (is_cursed(r->attribs, &ct_godcursezone))
|
if (is_cursed(r->attribs, &ct_godcursezone))
|
||||||
return;
|
return;
|
||||||
|
@ -2153,7 +2155,6 @@ int email_cmd(unit * u, struct order *ord)
|
||||||
int password_cmd(unit * u, struct order *ord)
|
int password_cmd(unit * u, struct order *ord)
|
||||||
{
|
{
|
||||||
char pwbuf[32];
|
char pwbuf[32];
|
||||||
int i;
|
|
||||||
const char *s;
|
const char *s;
|
||||||
bool pwok = true;
|
bool pwok = true;
|
||||||
|
|
||||||
|
@ -2161,6 +2162,7 @@ int password_cmd(unit * u, struct order *ord)
|
||||||
s = gettoken(pwbuf, sizeof(pwbuf));
|
s = gettoken(pwbuf, sizeof(pwbuf));
|
||||||
|
|
||||||
if (!s || !*s) {
|
if (!s || !*s) {
|
||||||
|
int i;
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
pwbuf[i] = (char)(97 + rng_int() % 26);
|
pwbuf[i] = (char)(97 + rng_int() % 26);
|
||||||
pwbuf[6] = 0;
|
pwbuf[6] = 0;
|
||||||
|
@ -4272,7 +4274,7 @@ void update_subscriptions(void)
|
||||||
int subscription, fno;
|
int subscription, fno;
|
||||||
faction *f;
|
faction *f;
|
||||||
|
|
||||||
if (fscanf(F, "%d %4s", &subscription, zFaction) <= 0)
|
if (fscanf(F, "%4d %4s", &subscription, zFaction) <= 0)
|
||||||
break;
|
break;
|
||||||
fno = atoi36(zFaction);
|
fno = atoi36(zFaction);
|
||||||
f = findfaction(fno);
|
f = findfaction(fno);
|
||||||
|
@ -4358,7 +4360,7 @@ bool cansee_unit(const unit * u, const unit * target, int modifier)
|
||||||
else if (target->faction == u->faction)
|
else if (target->faction == u->faction)
|
||||||
return true;
|
return true;
|
||||||
else {
|
else {
|
||||||
int n, rings, o;
|
int n, rings;
|
||||||
|
|
||||||
if (is_guard(target) || usiege(target) || target->building
|
if (is_guard(target) || usiege(target) || target->building
|
||||||
|| target->ship) {
|
|| target->ship) {
|
||||||
|
@ -4375,7 +4377,7 @@ bool cansee_unit(const unit * u, const unit * target, int modifier)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (skill_enabled(SK_PERCEPTION)) {
|
if (skill_enabled(SK_PERCEPTION)) {
|
||||||
o = effskill(u, SK_PERCEPTION, target->region);
|
int o = effskill(u, SK_PERCEPTION, target->region);
|
||||||
if (o >= n) {
|
if (o >= n) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4394,7 +4396,6 @@ cansee_durchgezogen(const faction * f, const region * r, const unit * u,
|
||||||
/* und es muss niemand aus f in der region sein, wenn sie vom Turm
|
/* und es muss niemand aus f in der region sein, wenn sie vom Turm
|
||||||
* erblickt wird */
|
* erblickt wird */
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
unit *u2;
|
unit *u2;
|
||||||
|
|
||||||
if (fval(u_race(u), RCF_INVISIBLE) || u->number == 0)
|
if (fval(u_race(u), RCF_INVISIBLE) || u->number == 0)
|
||||||
|
@ -4402,7 +4403,7 @@ cansee_durchgezogen(const faction * f, const region * r, const unit * u,
|
||||||
else if (u->faction == f)
|
else if (u->faction == f)
|
||||||
return true;
|
return true;
|
||||||
else {
|
else {
|
||||||
int rings;
|
int rings, n;
|
||||||
|
|
||||||
if (is_guard(u) || usiege(u) || u->building || u->ship) {
|
if (is_guard(u) || usiege(u) || u->building || u->ship) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -155,7 +155,7 @@ newfaction *read_newfactions(const char *filename)
|
||||||
email[0] = '\0';
|
email[0] = '\0';
|
||||||
password[0] = '\0';
|
password[0] = '\0';
|
||||||
|
|
||||||
if (sscanf(buf, "%54s %19s %7s %15s %d %d", email, race, lang,
|
if (sscanf(buf, "%54s %19s %7s %15s %4d %4d", email, race, lang,
|
||||||
password, &subscription, &alliance) < 3) {
|
password, &subscription, &alliance) < 3) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1764,9 +1764,10 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flying_ship(sh)) {
|
if (!flying_ship(sh)) {
|
||||||
|
int reason;
|
||||||
if (storms_enabled) {
|
if (storms_enabled) {
|
||||||
int stormchance = 0;
|
int stormchance = 0;
|
||||||
int stormyness, reason;
|
int stormyness;
|
||||||
gamedate date;
|
gamedate date;
|
||||||
get_gamedate(turn, &date);
|
get_gamedate(turn, &date);
|
||||||
stormyness = storms ? storms[date.month] * 5 : 0;
|
stormyness = storms ? storms[date.month] * 5 : 0;
|
||||||
|
|
|
@ -537,5 +537,5 @@ void a_write_orig(struct storage *store, const attrib * attribs, const void *own
|
||||||
|
|
||||||
void attrib_done(void) {
|
void attrib_done(void) {
|
||||||
cb_clear(&cb_deprecated);
|
cb_clear(&cb_deprecated);
|
||||||
memset(at_hash, 0, sizeof at_hash);
|
memset(at_hash, 0, sizeof(at_hash[0]) * MAXATHASH);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,16 +76,6 @@ void translist(void *l1, void *l2, void *p)
|
||||||
addlist(l2, p);
|
addlist(l2, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertlist(void_list ** l, void_list * p)
|
|
||||||
{
|
|
||||||
|
|
||||||
/* insert entry p at the beginning of list l */
|
|
||||||
|
|
||||||
p->next = *l;
|
|
||||||
*l = p;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void removelist(void *l, void *p)
|
void removelist(void *l, void *p)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -33,14 +33,8 @@ extern "C" {
|
||||||
void freestrlist(strlist * s);
|
void freestrlist(strlist * s);
|
||||||
void addlist(void *l1, void *p1);
|
void addlist(void *l1, void *p1);
|
||||||
void translist(void *l1, void *l2, void *p);
|
void translist(void *l1, void *l2, void *p);
|
||||||
#ifndef MALLOCDBG
|
|
||||||
void freelist(void *p1);
|
void freelist(void *p1);
|
||||||
void removelist(void *l, void *p);
|
void removelist(void *l, void *p);
|
||||||
#else
|
|
||||||
#define freelist(p) { while (p) { void * p2 = p->next; free(p); p = p2; } }
|
|
||||||
#define removelist(l,p) { choplist(l, p); free(p); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned int listlen(void *l);
|
unsigned int listlen(void *l);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in a new issue