rename _log_error to log_error and get rid of the cumbersome #define

This commit is contained in:
Enno Rehling 2012-05-16 16:52:01 -07:00
parent 14d62afb0d
commit ecbe770fce
51 changed files with 165 additions and 248 deletions

View File

@ -44,7 +44,7 @@ static void init_ext(attrib * a)
lua_rawgeti(L, LUA_REGISTRYINDEX, a->data.i);
if (lua_pcall(L, 1, 0, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("attrib_init '%d': %s.\n", a->data.i, error));
log_error("attrib_init '%d': %s.\n", a->data.i, error);
}
}
}
@ -140,7 +140,7 @@ static void write_ext_i(lua_State * L, const char *name, bson_buffer * bb)
oid.ints[1] = b->no;
bson_append_oid(bb, name, &oid);
} else {
log_error(("unsuported type.\n"));
log_error("unsuported type.\n");
bson_append_null(bb, name);
}
}
@ -253,8 +253,7 @@ static int read_ext_i(lua_State * L, bson_iterator * it, bson_type type)
else
lua_pushnil(L);
} else {
log_error(("unknown oid %d %d %d\n", oid->ints[0], oid->ints[1],
oid->ints[2]));
log_error("unknown oid %d %d %d\n", oid->ints[0], oid->ints[1], oid->ints[2]);
lua_pushnil(L);
}
}

View File

@ -299,7 +299,7 @@ static int tolua_faction_create(lua_State * L)
f = addfaction(email, NULL, frace, loc, 0);
}
if (!f) {
log_error(("faction.create(%s, %s, %s)\n", email, racename, lang));
log_error("faction.create(%s, %s, %s)\n", email, racename, lang);
}
tolua_pushusertype(L, f, TOLUA_CAST "faction");
return 1;

View File

@ -167,7 +167,7 @@ static void lua_paint_info(struct window *wnd, const struct state *st)
tolua_pushnumber(L, ny);
if (lua_pcall(L, 2, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("paint function failed: %s\n", error));
log_error("paint function failed: %s\n", error);
lua_pop(L, 1);
tolua_error(L, TOLUA_CAST "event handler call failed", NULL);
} else {

View File

@ -309,7 +309,7 @@ static int tolua_region_get_resourcelevel(lua_State * L)
return 0;
}
#define LUA_ASSERT(c, s) if (!(c)) { log_error(("%s(%d): %s\n", __FILE__, __LINE__, (s))); return 0; }
#define LUA_ASSERT(c, s) if (!(c)) { log_error("%s(%d): %s\n", __FILE__, __LINE__, (s)); return 0; }
static critbit_tree * special_resources(void)
{

View File

@ -394,7 +394,7 @@ int fctr_handle(struct trigger *tp, void *data)
tolua_pushusertype(L, &evt, TOLUA_CAST "event");
if (lua_pcall(L, 2, 0, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("event (%s): %s\n", unitname(u), error));
log_error("event (%s): %s\n", unitname(u), error);
lua_pop(L, 1);
tolua_error(L, TOLUA_CAST "event handler call failed", NULL);
}
@ -462,7 +462,7 @@ static void unit_castspell(unit * u, const char *name)
spell *sp = (spell *) ql_get(ql, qi);
if (strcmp(name, sp->sname) == 0) {
if (!sp->cast) {
log_error(("spell '%s' has no function.\n", sp->sname));
log_error("spell '%s' has no function.\n", sp->sname);
} else {
castorder co;
create_castorder(&co, u, 0, sp, u->region, sp->level, sp->level * MagicPower(), 0, 0, 0);
@ -487,7 +487,7 @@ static int unit_addspell(unit * u, const char *name)
spell *spadd = find_spell(name);
if (!spadd) {
log_error(("spell %s could not be found\n", name));
log_error("spell %s could not be found\n", name);
return EINVAL;
} else {
quicklist **starget = get_spelllist(m, u->faction);

View File

@ -71,7 +71,7 @@ without prior permission by the authors of Eressea.
int log_lua_error(lua_State * L)
{
const char *error = lua_tostring(L, -1);
log_error(("LUA call failed.\n%s\n", error));
log_error("LUA call failed.\n%s\n", error);
lua_pop(L, 1);
return 1;
}

View File

@ -57,15 +57,14 @@ lua_giveitem(unit * s, unit * d, const item_type * itype, int n,
if (lua_pcall(L, 4, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("unit %s calling '%s': %s.\n", unitname(s), fname, error));
log_error("unit %s calling '%s': %s.\n", unitname(s), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("unit %s trying to call '%s' : not a function.\n",
unitname(s), fname));
log_error("unit %s trying to call '%s' : not a function.\n", unitname(s), fname);
lua_pop(L, 1);
}
@ -87,16 +86,14 @@ static int limit_resource(const region * r, const resource_type * rtype)
if (lua_pcall(L, 1, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("limit(%s) calling '%s': %s.\n",
regionname(r, NULL), fname, error));
log_error("limit(%s) calling '%s': %s.\n", regionname(r, NULL), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("limit(%s) calling '%s': not a function.\n",
regionname(r, NULL), fname));
log_error("limit(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
lua_pop(L, 1);
}
@ -118,13 +115,11 @@ produce_resource(region * r, const resource_type * rtype, int norders)
if (lua_pcall(L, 2, 0, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("produce(%s) calling '%s': %s.\n",
regionname(r, NULL), fname, error));
log_error("produce(%s) calling '%s': %s.\n", regionname(r, NULL), fname, error);
lua_pop(L, 1);
}
} else {
log_error(("produce(%s) calling '%s': not a function.\n",
regionname(r, NULL), fname));
log_error("produce(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
lua_pop(L, 1);
}
}
@ -151,16 +146,14 @@ static int lc_age(struct attrib *a)
if (lua_pcall(L, fparam ? 2 : 1, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("lc_age(%s) calling '%s': %s.\n",
buildingname(b), fname, error));
log_error("lc_age(%s) calling '%s': %s.\n", buildingname(b), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("lc_age(%s) calling '%s': not a function.\n",
buildingname(b), fname));
log_error("lc_age(%s) calling '%s': not a function.\n", buildingname(b), fname);
lua_pop(L, 1);
}
}
@ -180,7 +173,7 @@ static void push_param(lua_State * L, char c, spllprm * param)
else if (c == 'c')
tolua_pushstring(L, param->data.s);
else {
log_error(("unsupported syntax %c.\n", c));
log_error("unsupported syntax %c.\n", c);
lua_pushnil(L);
}
}
@ -232,16 +225,14 @@ static int lua_callspell(castorder * co)
if (lua_pcall(L, nparam, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("spell(%s) calling '%s': %s.\n",
unitname(caster), fname, error));
log_error("spell(%s) calling '%s': %s.\n", unitname(caster), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("spell(%s) calling '%s': not a function.\n",
unitname(caster), fname));
log_error("spell(%s) calling '%s': not a function.\n", unitname(caster), fname);
lua_pop(L, 1);
}
@ -263,8 +254,7 @@ static void lua_initfamiliar(unit * u)
if (lua_pcall(L, 1, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("familiar(%s) calling '%s': %s.\n",
unitname(u), fname, error));
log_error("familiar(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
@ -297,15 +287,14 @@ lua_changeresource(unit * u, const struct resource_type *rtype, int delta)
if (lua_pcall(L, 2, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("change(%s) calling '%s': %s.\n", unitname(u), fname, error));
log_error("change(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("change(%s) calling '%s': not a function.\n",
unitname(u), fname));
log_error("change(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
@ -326,14 +315,14 @@ static int lua_getresource(unit * u, const struct resource_type *rtype)
if (lua_pcall(L, 1, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("get(%s) calling '%s': %s.\n", unitname(u), fname, error));
log_error("get(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("get(%s) calling '%s': not a function.\n", unitname(u), fname));
log_error("get(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
@ -357,7 +346,7 @@ static boolean lua_canuse_item(const unit * u, const struct item_type *itype)
if (lua_pcall(L, 2, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("get(%s) calling '%s': %s.\n", unitname(u), fname, error));
log_error("get(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
result = lua_toboolean(L, -1);
@ -365,8 +354,7 @@ static boolean lua_canuse_item(const unit * u, const struct item_type *itype)
}
} else {
function_exists = 0;
log_error(("get(%s) calling '%s': not a function.\n",
unitname(u), fname));
log_error("get(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
}
@ -390,16 +378,14 @@ lua_wage(const region * r, const faction * f, const race * rc, int in_turn)
if (lua_pcall(L, 3, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("wage(%s) calling '%s': %s.\n",
regionname(r, NULL), fname, error));
log_error("wage(%s) calling '%s': %s.\n", regionname(r, NULL), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("wage(%s) calling '%s': not a function.\n",
regionname(r, NULL), fname));
log_error("wage(%s) calling '%s': not a function.\n", regionname(r, NULL), fname);
lua_pop(L, 1);
}
@ -420,13 +406,11 @@ static void lua_agebuilding(building * b)
if (lua_pcall(L, 1, 0, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("agebuilding(%s) calling '%s': %s.\n",
buildingname(b), fname, error));
log_error("agebuilding(%s) calling '%s': %s.\n", buildingname(b), fname, error);
lua_pop(L, 1);
}
} else {
log_error(("agebuilding(%s) calling '%s': not a function.\n",
buildingname(b), fname));
log_error("agebuilding(%s) calling '%s': not a function.\n", buildingname(b), fname);
lua_pop(L, 1);
}
}
@ -445,16 +429,14 @@ static int lua_building_protection(building * b, unit * u)
if (lua_pcall(L, 2, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("building_protection(%s, %s) calling '%s': %s.\n",
buildingname(b), unitname(u), fname, error));
log_error("building_protection(%s, %s) calling '%s': %s.\n", buildingname(b), unitname(u), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("building_protection(%s, %s) calling '%s': not a function.\n",
buildingname(b), unitname(u), fname));
log_error("building_protection(%s, %s) calling '%s': not a function.\n", buildingname(b), unitname(u), fname);
lua_pop(L, 1);
}
return result;
@ -476,16 +458,14 @@ static double lua_building_taxes(building * b, int level)
if (lua_pcall(L, 2, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("building_taxes(%s) calling '%s': %s.\n",
buildingname(b), fname, error));
log_error("building_taxes(%s) calling '%s': %s.\n", buildingname(b), fname, error);
lua_pop(L, 1);
} else {
result = (double)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("building_taxes(%s) calling '%s': not a function.\n",
buildingname(b), fname));
log_error("building_taxes(%s) calling '%s': not a function.\n", buildingname(b), fname);
lua_pop(L, 1);
}
return result;
@ -504,16 +484,14 @@ static int lua_maintenance(const unit * u)
if (lua_pcall(L, 1, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("maintenance(%s) calling '%s': %s.\n",
unitname(u), fname, error));
log_error("maintenance(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("maintenance(%s) calling '%s': not a function.\n",
unitname(u), fname));
log_error("maintenance(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
@ -534,15 +512,14 @@ static void lua_equipmentcallback(const struct equipment *eq, unit * u)
if (lua_pcall(L, 1, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("equip(%s) calling '%s': %s.\n", unitname(u), fname, error));
log_error("equip(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("equip(%s) calling '%s': not a function.\n",
unitname(u), fname));
log_error("equip(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
}
@ -565,14 +542,14 @@ lua_useitem(struct unit *u, const struct item_type *itype, int amount,
if (lua_pcall(L, 2, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("use(%s) calling '%s': %s.\n", unitname(u), fname, error));
log_error("use(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("use(%s) calling '%s': not a function.\n", unitname(u), fname));
log_error("use(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
@ -594,14 +571,14 @@ static int lua_recruit(struct unit *u, const struct archetype *arch, int amount)
if (lua_pcall(L, 2, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error(("use(%s) calling '%s': %s.\n", unitname(u), fname, error));
log_error("use(%s) calling '%s': %s.\n", unitname(u), fname, error);
lua_pop(L, 1);
} else {
result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);
}
} else {
log_error(("use(%s) calling '%s': not a function.\n", unitname(u), fname));
log_error("use(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
return result;

View File

@ -527,8 +527,7 @@ static void render_messages(FILE * F, faction * f, message_list * msgs)
if (crbuffer[0])
fputs(crbuffer, F);
} else {
log_error(("could not render cr-message %p: %s\n", m->msg,
m->msg->type->name));
log_error("could not render cr-message %p: %s\n", m->msg, m->msg->type->name);
}
if (printed) {
unsigned int ihash = hash % MTMAXHASH;

View File

@ -2132,8 +2132,7 @@ static int email_cmd(unit * u, struct order *ord)
} else {
faction *f = u->faction;
if (set_email(&f->email, (const char *)s) != 0) {
log_error(("Invalid email address for faction %s: %s\n",
itoa36(f->no), s));
log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), s);
ADDMSG(&f->msgs, msg_message("changemail_invalid", "value", s));
} else {
ADDMSG(&f->msgs, msg_message("changemail", "value", f->email));
@ -3826,8 +3825,7 @@ static int use_cmd(unit * u, struct order *ord)
int i = use_item(u, itype, n, ord);
assert(i <= 0 || !"use_item should not return positive values.");
if (i > 0) {
log_error(("use_item returned a value>0 for %s\n",
resourcename(itype->rtype, 0)));
log_error("use_item returned a value>0 for %s\n", resourcename(itype->rtype, 0));
}
} else {
cmistake(u, ord, 43, MSG_PRODUCE);

View File

@ -341,6 +341,6 @@ int change_effect(unit * u, const potion_type * effect, int delta)
data->value = delta;
return data->value;
}
log_error(("change effect with delta==0 for unit %s\n", itoa36(u->no)));
log_error("change effect with delta==0 for unit %s\n", itoa36(u->no));
return 0;
}

View File

@ -1585,7 +1585,7 @@ troop select_enemy(fighter * af, int minrow, int maxrow, int select)
}
}
if (enemies != 0) {
log_error(("select_enemies has a bug.\n"));
log_error("select_enemies has a bug.\n");
}
#ifdef DEBUG_SELECT
return result;
@ -1779,7 +1779,7 @@ void do_combatmagic(battle * b, combatmagic_t was)
int level = co->level;
if (!sp->cast) {
log_error(("spell '%s' has no function.\n", sp->sname));
log_error("spell '%s' has no function.\n", sp->sname);
} else {
level = sp->cast(co);
if (level > 0) {
@ -1878,7 +1878,7 @@ static void do_combatspell(troop at)
}
if (!sp->cast) {
log_error(("spell '%s' has no function.\n", sp->sname));
log_error("spell '%s' has no function.\n", sp->sname);
} else {
level = cast_combatspell(at, sp, level, power);
}
@ -1894,7 +1894,7 @@ static void do_extra_spell(troop at, const att * a)
const spell *sp = a->data.sp;
if (sp->cast == NULL) {
log_error(("spell '%s' has no function.\n", sp->sname));
log_error("spell '%s' has no function.\n", sp->sname);
} else {
cast_combatspell(at, sp, sp->level, sp->level * MagicPower());
}
@ -2133,7 +2133,7 @@ static void make_heroes(battle * b)
if (fval(u, UFL_HERO)) {
int i;
if (!playerrace(u->race)) {
log_error(("Hero %s is a %s.\n", unitname(u), u->race->_name[0]));
log_error("Hero %s is a %s.\n", unitname(u), u->race->_name[0]);
}
for (i = 0; i != u->number; ++i) {
fig->person[i].speed += (hero_speed - 1);
@ -2915,8 +2915,7 @@ static void aftermath(battle * b)
dead_players += dead;
}
if (du->hp < du->number) {
log_error(("%s has less hitpoints (%u) than people (%u)\n",
itoa36(du->no), du->hp, du->number));
log_error("%s has less hitpoints (%u) than people (%u)\n", itoa36(du->no), du->hp, du->number);
du->hp = du->number;
}
}
@ -3684,7 +3683,7 @@ battle *make_battle(region * r)
sprintf(zFilename, "%s/battle-%d-%s.log", zText, obs_count, simplename(r));
bdebug = fopen(zFilename, "w");
if (!bdebug)
log_error(("battles cannot be debugged\n"));
log_error("battles cannot be debugged\n");
else {
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf, 0 };
fwrite(utf8_bom, 1, 3, bdebug);

View File

@ -156,8 +156,7 @@ static char *bin_r_str(struct storage *store)
{
char *p = strpbrk(result, "\n\r");
while (p) {
log_error(("Invalid character %d in input string \"%s\".\n", *p,
result));
log_error("Invalid character %d in input string \"%s\".\n", *p, result);
strcpy(p, p + 1);
p = strpbrk(p, "\n\r");
}
@ -165,7 +164,7 @@ static char *bin_r_str(struct storage *store)
#endif
return result;
} else if (len < 0) {
log_error(("invalid string-length %d in input.\n", len));
log_error("invalid string-length %d in input.\n", len);
}
return NULL;
}
@ -193,8 +192,7 @@ static void bin_r_str_buf(struct storage *store, char *result, size_t size)
{
char *p = strpbrk(result, "\n\r");
while (p) {
log_error(("Invalid character %d in input string \"%s\".\n", *p,
result));
log_error("Invalid character %d in input string \"%s\".\n", *p, result);
strcpy(p, p + 1);
p = strpbrk(p, "\n\r");
}
@ -220,7 +218,7 @@ static void bin_r_bin(struct storage *store, void *result, size_t size)
int len = store->r_int(store);
if (len > 0) {
if ((size_t) len > size) {
log_error(("destination buffer too small %d %u.\n", len, size));
log_error("destination buffer too small %d %u.\n", len, size);
fseek(file(store), len, SEEK_CUR);
} else {
fread(result, len, 1, file(store));

View File

@ -420,9 +420,7 @@ int destroy_cmd(unit * u, struct order *ord)
"unit region ship", u, r, sh));
}
} else {
log_error(
("Die Einheit %s von %s war owner eines objects, war aber weder in einer Burg noch in einem Schiff.\n",
unitname(u), u->faction->name, u->faction->email));
log_error("Die Einheit %s von %s war owner eines objects, war aber weder in einer Burg noch in einem Schiff.\n", unitname(u), u->faction->name, u->faction->email);
}
if (con) {

View File

@ -750,9 +750,9 @@ void verify_data(void)
}
}
if (f->no != 0 && ((mage > 3 && f->race != new_race[RC_ELF]) || mage > 4))
log_error(("Partei %s hat %d Magier.\n", factionid(f), mage));
log_error("Partei %s hat %d Magier.\n", factionid(f), mage);
if (alchemist > 3)
log_error(("Partei %s hat %d Alchemisten.\n", factionid(f), alchemist));
log_error("Partei %s hat %d Alchemisten.\n", factionid(f), alchemist);
}
#endif
}
@ -1224,8 +1224,7 @@ int count_all(const faction * f)
}
}
if (f->num_people != n) {
log_error(("# of people in %s is != num_people: %d should be %d.\n",
factionid(f), f->num_people, n));
log_error("# of people in %s is != num_people: %d should be %d.\n", factionid(f), f->num_people, n);
}
#endif
return f->num_people;
@ -2130,7 +2129,7 @@ static void init_locale(const struct locale *lang)
cb_new_kv(str, &i, sizeof(int), buffer);
cb_insert(cb, buffer, strlen(str)+1+sizeof(int));
} else {
log_error(("could not transliterate param '%s'\n", key));
log_error("could not transliterate param '%s'\n", key);
}
}
#ifdef PTRIES

View File

@ -646,16 +646,14 @@ int read_borders(struct storage *store)
type = find_bordertype(zText);
if (type == NULL) {
log_error(("[read_borders] unknown connection type %s in %s\n", zText,
regionname(from, NULL)));
log_error("[read_borders] unknown connection type %s in %s\n", zText, regionname(from, NULL));
assert(type || !"connection type not registered");
}
if (to == from && type && from) {
direction_t dir = (direction_t) (rng_int() % MAXDIRECTIONS);
region *r = rconnect(from, dir);
log_error(("[read_borders] invalid %s in %s\n", type->__name,
regionname(from, NULL)));
log_error("[read_borders] invalid %s in %s\n", type->__name, regionname(from, NULL));
if (r != NULL)
to = r;
}

View File

@ -213,8 +213,7 @@ int curse_read(attrib * a, void *owner, struct storage *store)
if (c->type == NULL) {
int result = read_ccompat(cursename, store);
if (result != 0) {
log_error(("missing curse %s, no compatibility code either.\n",
cursename));
log_error("missing curse %s, no compatibility code either.\n", cursename);
}
assert(result == 0);
return AT_READ_FAIL;
@ -766,7 +765,7 @@ message *cinfo_simple(const void *obj, typ_t typ, const struct curse * c,
msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
if (msg == NULL) {
log_error(("There is no curseinfo for %s.\n", c->type->cname));
log_error("There is no curseinfo for %s.\n", c->type->cname);
}
return msg;
}

View File

@ -198,8 +198,7 @@ faction *addfaction(const char *email, const char *password,
assert(frace);
if (set_email(&f->email, email) != 0) {
log_error(("Invalid email address for faction %s: %s\n", itoa36(f->no),
email));
log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), email);
}
f->override = strdup(itoa36(rng_int()));

View File

@ -494,8 +494,7 @@ item *i_change(item ** pi, const item_type * itype, int delta)
item *i = *pi;
i->number += delta;
if (i->number < 0) {
log_error(("serious accounting error. number of items is %d.\n",
i->number));
log_error("serious accounting error. number of items is %d.\n", i->number);
/* FIXME what's this supposed to mean??
assert(i >= 0);
*/

View File

@ -221,7 +221,7 @@ void read_spells(struct quicklist **slistp, magic_t mtype,
break;
sp = find_spell(spname);
if (!sp) {
log_error(("read_spells: could not find spell '%s' in school '%s'\n", spname, magic_school[mtype]));
log_error("read_spells: could not find spell '%s' in school '%s'\n", spname, magic_school[mtype]);
}
}
if (sp) {
@ -257,7 +257,7 @@ static int read_mage(attrib * a, void *owner, struct storage *store)
if (strcmp("none", spname) != 0) {
sp = find_spell(spname);
if (!sp) {
log_error(("read_mage: could not find combat spell '%s' in school '%s'\n", spname, magic_school[mage->magietyp]));
log_error("read_mage: could not find combat spell '%s' in school '%s'\n", spname, magic_school[mage->magietyp]);
}
}
}
@ -356,7 +356,7 @@ static int read_seenspell(attrib * a, void *owner, struct storage *store)
mtype = store->r_int(store);
sp = find_spell(token);
if (!sp) {
log_error(("read_seenspell: could not find spell '%s' in school '%s'\n", token, magic_school[mtype]));
log_error("read_seenspell: could not find spell '%s' in school '%s'\n", token, magic_school[mtype]);
}
}
if (!sp) {
@ -547,8 +547,7 @@ void add_spellname(sc_mage * mage, const spell * sp)
void add_spell(struct quicklist **slistp, spell * sp)
{
if (ql_set_insert(slistp, sp) != 0) {
log_error(("add_spell: the list already contains the spell '%s'.\n",
sp->sname));
log_error("add_spell: the list already contains the spell '%s'.\n", sp->sname);
}
}
@ -2599,7 +2598,7 @@ static castorder *cast_cmd(unit * u, order * ord)
sp = get_spellfromtoken(mage, s, caster->faction->locale);
} else {
/* somehow, this familiar has no mage! */
log_error(("cast_cmd: familiar %s is without a mage?\n", unitname(u)));
log_error("cast_cmd: familiar %s is without a mage?\n", unitname(u));
caster = u;
}
}

View File

@ -90,7 +90,7 @@ struct message *msg_feedback(const struct unit *u, struct order *ord,
ord = u->thisorder;
if (!mtype) {
log_error(("trying to create message of unknown type \"%s\"\n", name));
log_error("trying to create message of unknown type \"%s\"\n", name);
return msg_message("missing_feedback", "unit region command name", u,
u->region, ord, name);
}
@ -126,8 +126,7 @@ struct message *msg_feedback(const struct unit *u, struct order *ord,
assert(!"unknown variant type");
}
} else {
log_error(("invalid parameter %s for message type %s\n", paramname,
mtype->name));
log_error("invalid parameter %s for message type %s\n", paramname, mtype->name);
assert(!"program aborted.");
}
while (*ic && !isalnum(*ic))
@ -180,8 +179,7 @@ message *msg_message(const char *name, const char *sig, ...)
assert(!"unknown variant type");
}
} else {
log_error(("invalid parameter %s for message type %s\n", paramname,
mtype->name));
log_error("invalid parameter %s for message type %s\n", paramname, mtype->name);
assert(!"program aborted.");
}
while (*ic && !isalnum(*ic))

View File

@ -63,7 +63,7 @@ int get_resource(const unit * u, const resource_type * rtype)
return get_spellpoints(u);
if (rtype == oldresourcetype[R_PERMAURA])
return max_spellpoints(u->region, u);
log_error(("trying to get unknown resource '%s'.\n", rtype->_name[0]));
log_error("trying to get unknown resource '%s'.\n", rtype->_name[0]);
return 0;
}

View File

@ -103,7 +103,7 @@ race *rc_new(const char *zName)
rc->hitpoints = 1;
if (strchr(zName, ' ') != NULL) {
log_error(("race '%s' has an invalid name. remove spaces\n", zName));
log_error("race '%s' has an invalid name. remove spaces\n", zName);
assert(strchr(zName, ' ') == NULL);
}
strcpy(zBuffer, zName);

View File

@ -236,8 +236,7 @@ void register_special_direction(const char *name)
dir_name_lookup = dl;
}
} else {
log_error(("no translation for spec_direction '%s' in locale '%s'\n",
name, locale_name(lang)));
log_error("no translation for spec_direction '%s' in locale '%s'\n", name, locale_name(lang));
}
}
}
@ -266,7 +265,7 @@ static int a_readdirection(attrib * a, void *owner, struct storage *store)
}
}
if (dl == NULL) {
log_error(("unknown spec_direction '%s'\n", lbuf));
log_error("unknown spec_direction '%s'\n", lbuf);
assert(!"not implemented");
}
} else {
@ -942,10 +941,9 @@ region *new_region(int x, int y, struct plane *pl, unsigned int uid)
r = rfindhash(x, y);
if (r) {
log_error(("duplicate region discovered: %s(%d,%d)\n", regionname(r, NULL),
x, y));
log_error("duplicate region discovered: %s(%d,%d)\n", regionname(r, NULL), x, y);
if (r->units)
log_error(("duplicate region contains units\n"));
log_error("duplicate region contains units\n");
return r;
}
r = calloc(1, sizeof(region));

View File

@ -215,7 +215,7 @@ int update_nmrs(void)
} else if (!is_monsters(f) && f->alive) {
int nmr = turn - f->lastorders + 1;
if (nmr < 0 || nmr > NMRTimeout()) {
log_error(("faction %s has %d NMRS\n", factionid(f), nmr));
log_error("faction %s has %d NMRS\n", factionid(f), nmr);
nmr = MAX(0, nmr);
nmr = MIN(nmr, NMRTimeout());
}
@ -294,7 +294,7 @@ report_items(const item * items, item * result, int size, const unit * owner,
}
if (ishow == result + n) {
if (n == size) {
log_error(("too many items to report, increase buffer size.\n"));
log_error("too many items to report, increase buffer size.\n");
return -1;
}
result[n].number = itm->number;
@ -988,11 +988,9 @@ struct message *msg_curse(const struct curse *c, const void *obj, typ_t typ,
{ "unit_unknown", "region_unknown", "building_unknown",
"ship_unknown" };
msg = msg_message(mkname("curseinfo", unknown[typ]), "id", c->no);
log_error(("no curseinfo function for %s and no fallback either.\n",
c->type->cname));
log_error("no curseinfo function for %s and no fallback either.\n", c->type->cname);
} else {
log_error(("no curseinfo function for %s, using cinfo_simple fallback.\n",
c->type->cname));
log_error("no curseinfo function for %s, using cinfo_simple fallback.\n", c->type->cname);
}
return msg;
}
@ -1668,7 +1666,7 @@ int reports(void)
sprintf(path, "%s/reports.txt", reportpath());
mailit = fopen(path, "w");
if (mailit == NULL) {
log_error(("%s could not be opened!\n", path));
log_error("%s could not be opened!\n", path);
}
for (f = factions; f; f = f->next) {

View File

@ -180,7 +180,7 @@ int freadstr(FILE * F, int encoding, char *start, size_t size)
if (ret > 0)
str += ret;
else {
log_error(("input data was not iso-8859-1! assuming utf-8\n"));
log_error("input data was not iso-8859-1! assuming utf-8\n");
encoding = XML_CHAR_ENCODING_ERROR;
*str++ = (char)c;
}
@ -200,7 +200,7 @@ int freadstr(FILE * F, int encoding, char *start, size_t size)
if (ret > 0)
str += ret;
else {
log_error(("input data was not iso-8859-1! assuming utf-8\n"));
log_error("input data was not iso-8859-1! assuming utf-8\n");
encoding = XML_CHAR_ENCODING_ERROR;
*str++ = (char)c;
}
@ -538,8 +538,7 @@ void read_items(struct storage *store, item ** ilist)
itype = it_find(ibuf);
i = store->r_int(store);
if (i <= 0) {
log_error(("data contains an entry with %d %s\n", i,
itype->rtype->_name[1]));
log_error("data contains an entry with %d %s\n", i, itype->rtype->_name[1]);
} else {
assert(itype != NULL);
if (itype != NULL) {
@ -621,7 +620,7 @@ static int resolve_owner(variant id, void *address)
if (id.i != 0) {
f = findfaction(id.i);
if (f == NULL) {
log_error(("region has an invalid owner (%s)\n", itoa36(id.i)));
log_error("region has an invalid owner (%s)\n", itoa36(id.i));
f = get_monsters();
}
}
@ -782,7 +781,7 @@ unit *read_unit(struct storage *store)
}
}
if (u->faction == NULL) {
log_error(("unit %s has faction == NULL\n", unitname(u)));
log_error("unit %s has faction == NULL\n", unitname(u));
u_setfaction(u, get_monsters());
set_number(u, 0);
}
@ -857,8 +856,7 @@ unit *read_unit(struct storage *store)
read_items(store, &u->items);
u->hp = store->r_int(store);
if (u->hp < u->number) {
log_error(("Einheit %s hat %u Personen, und %u Trefferpunkte\n",
itoa36(u->no), u->number, u->hp));
log_error("Einheit %s hat %u Personen, und %u Trefferpunkte\n", itoa36(u->no), u->number, u->hp);
u->hp = u->number;
}
@ -888,8 +886,7 @@ void write_unit(struct storage *store, const unit * u)
if (++p < MAXPERSISTENT) {
writeorder(store, ord, u->faction->locale);
} else {
log_error(("%s had %d or more persistent orders\n", unitname(u),
MAXPERSISTENT));
log_error("%s had %d or more persistent orders\n", unitname(u), MAXPERSISTENT);
break;
}
}
@ -900,8 +897,7 @@ void write_unit(struct storage *store, const unit * u)
if (++p < MAXPERSISTENT) {
writeorder(store, ord, u->faction->locale);
} else {
log_error(("%s had %d or more persistent orders\n", unitname(u),
MAXPERSISTENT));
log_error("%s had %d or more persistent orders\n", unitname(u), MAXPERSISTENT);
break;
}
}
@ -926,7 +922,7 @@ void write_unit(struct storage *store, const unit * u)
write_items(store, u->items);
store->w_brk(store);
if (u->hp == 0) {
log_error(("unit %s has 0 hitpoints, adjusting.\n", itoa36(u->no)));
log_error("unit %s has 0 hitpoints, adjusting.\n", itoa36(u->no));
((unit *) u)->hp = u->number;
}
store->w_int(store, u->hp);
@ -977,9 +973,7 @@ static region *readregion(struct storage *store, int x, int y)
int ter = store->r_int(store);
terrain = newterrain((terrain_t) ter);
if (terrain == NULL) {
log_error(
("while reading datafile from pre-TERRAIN_VERSION, could not find terrain #%d.\n",
ter));
log_error("while reading datafile from pre-TERRAIN_VERSION, could not find terrain #%d.\n", ter);
terrain = newterrain(T_PLAIN);
}
} else {
@ -987,7 +981,7 @@ static region *readregion(struct storage *store, int x, int y)
store->r_str_buf(store, name, sizeof(name));
terrain = get_terrain(name);
if (terrain == NULL) {
log_error(("Unknown terrain '%s'\n", name));
log_error("Unknown terrain '%s'\n", name);
assert(!"unknown terrain");
}
}
@ -1006,20 +1000,19 @@ static region *readregion(struct storage *store, int x, int y)
i = store->r_int(store);
if (i < 0) {
log_error(("number of trees in %s is %d.\n", regionname(r, NULL), i));
log_error("number of trees in %s is %d.\n", regionname(r, NULL), i);
i = 0;
}
rsettrees(r, 0, i);
i = store->r_int(store);
if (i < 0) {
log_error(("number of young trees in %s is %d.\n",
regionname(r, NULL), i));
log_error("number of young trees in %s is %d.\n", regionname(r, NULL), i);
i = 0;
}
rsettrees(r, 1, i);
i = store->r_int(store);
if (i < 0) {
log_error(("number of seeds in %s is %d.\n", regionname(r, NULL), i));
log_error("number of seeds in %s is %d.\n", regionname(r, NULL), i);
i = 0;
}
rsettrees(r, 2, i);
@ -1035,7 +1028,7 @@ static region *readregion(struct storage *store, int x, int y)
res = malloc(sizeof(rawmaterial));
res->type = rmt_find(token);
if (res->type == NULL) {
log_error(("invalid resourcetype %s in data.\n", token));
log_error("invalid resourcetype %s in data.\n", token);
}
assert(res->type != NULL);
res->level = store->r_int(store);
@ -1650,8 +1643,7 @@ int readgame(const char *filename, int mode, int backup)
faction *f = u->faction;
int skl = effskill(u, SK_MAGIC);
if (!is_monsters(f) && f->magiegebiet == M_GRAY) {
log_error(("faction %s had magic=gray, fixing (%s)\n",
factionname(f), magic_school[mage->magietyp]));
log_error("faction %s had magic=gray, fixing (%s)\n", factionname(f), magic_school[mage->magietyp]);
f->magiegebiet = mage->magietyp;
}
if (f->max_spelllevel < skl) {

View File

@ -92,7 +92,7 @@ void enable_skill(const char *skname, boolean value)
return;
}
}
log_error(("Trying to set unknown skill %s to %u", skname, value));
log_error("Trying to set unknown skill %s to %u", skname, value);
}
skill_t sk_find(const char *name)

View File

@ -233,8 +233,7 @@ int db_update_factions(sqlite3 * db, boolean force)
for (f = factions; f; f = f->next) {
if (!fval(f, FFL_MARK)) {
log_error(("%s (sub=%d, email=%s) has no entry in the database\n",
factionname(f), f->subscription, f->email));
log_error("%s (sub=%d, email=%s) has no entry in the database\n", factionname(f), f->subscription, f->email);
} else {
freset(f, FFL_MARK);
}

View File

@ -68,7 +68,7 @@ region_list *astralregions(const region * r, boolean(*valid) (const region *))
assert(is_astral(r));
if (!is_astral(r)) {
log_error(("astralregions was called with a non-astral region.\n"));
log_error("astralregions was called with a non-astral region.\n");
return NULL;
}
r = r_astral_to_standard(r);

View File

@ -182,8 +182,7 @@ xml_readconstruction(xmlXPathContextPtr xpath, xmlNodeSetPtr nodeSet,
if (propValue != NULL) {
sk = sk_find((const char *)propValue);
if (sk == NOSKILL) {
log_error(("construction requires skill '%s' that does not exist.\n",
(const char *)propValue));
log_error("construction requires skill '%s' that does not exist.\n", (const char *)propValue);
xmlFree(propValue);
continue;
}
@ -313,8 +312,7 @@ static int parse_buildings(xmlDocPtr doc)
parse_function(node, &fun, &propValue);
if (fun == NULL) {
log_error(("unknown function name '%s' for building %s\n",
(const char *)propValue, btype->_name));
log_error("unknown function name '%s' for building %s\n", (const char *)propValue, btype->_name);
xmlFree(propValue);
continue;
}
@ -334,8 +332,7 @@ static int parse_buildings(xmlDocPtr doc)
} else if (strcmp((const char *)propValue, "age") == 0) {
btype->age = (void (*)(struct building *))fun;
} else {
log_error(("unknown function type '%s' for building %s\n",
(const char *)propValue, btype->_name));
log_error("unknown function type '%s' for building %s\n", (const char *)propValue, btype->_name);
}
xmlFree(propValue);
}
@ -818,8 +815,7 @@ static weapon_type *xml_readweapon(xmlXPathContextPtr xpath, item_type * itype)
parse_function(node, &fun, &propValue);
if (fun == NULL) {
log_error(("unknown function name '%s' for item '%s'\n",
(const char *)propValue, itype->rtype->_name[0]));
log_error("unknown function name '%s' for item '%s'\n", (const char *)propValue, itype->rtype->_name[0]);
xmlFree(propValue);
continue;
}
@ -829,8 +825,7 @@ static weapon_type *xml_readweapon(xmlXPathContextPtr xpath, item_type * itype)
(boolean(*)(const struct troop *, const struct weapon_type *,
int *))fun;
} else {
log_error(("unknown function type '%s' for item '%s'\n",
(const char *)propValue, itype->rtype->_name[0]));
log_error("unknown function type '%s' for item '%s'\n", (const char *)propValue, itype->rtype->_name[0]);
}
xmlFree(propValue);
}
@ -926,8 +921,7 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
parse_function(node, &fun, &propValue);
if (fun == NULL) {
log_error(("unknown function name '%s' for item '%s'\n",
(const char *)propValue, rtype->_name[0]));
log_error("unknown function name '%s' for item '%s'\n", (const char *)propValue, rtype->_name[0]);
xmlFree(propValue);
continue;
}
@ -948,8 +942,7 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
(int (*)(struct unit *, int, const struct item_type *, int,
struct order *))fun;
} else {
log_error(("unknown function type '%s' for item '%s'\n",
(const char *)propValue, rtype->_name[0]));
log_error("unknown function type '%s' for item '%s'\n", (const char *)propValue, rtype->_name[0]);
}
xmlFree(propValue);
}
@ -977,8 +970,7 @@ static int parse_rules(xmlDocPtr doc)
parse_function(node, &fun, &propValue);
if (fun == NULL) {
log_error(("unknown function for rule '%s' %s\n",
(const char *)propValue));
log_error("unknown function for rule '%s' %s\n", (const char *)propValue);
xmlFree(propValue);
continue;
}
@ -990,7 +982,7 @@ static int parse_rules(xmlDocPtr doc)
} else if (strcmp((const char *)propValue, "maintenance") == 0) {
global.functions.maintenance = (int (*)(const struct unit *))fun;
} else {
log_error(("unknown function for rule '%s'\n", (const char *)propValue));
log_error("unknown function for rule '%s'\n", (const char *)propValue);
}
xmlFree(propValue);
}
@ -1085,8 +1077,7 @@ static int parse_resources(xmlDocPtr doc)
parse_function(node, &fun, &propValue);
if (fun == NULL) {
log_error(("unknown function name '%s' for resource %s\n",
(const char *)propValue, rtype->_name[0]));
log_error("unknown function name '%s' for resource %s\n", (const char *)propValue, rtype->_name[0]);
xmlFree(propValue);
continue;
}
@ -1099,8 +1090,7 @@ static int parse_resources(xmlDocPtr doc)
} else if (strcmp((const char *)propValue, "name") == 0) {
rtype->name = (rtype_name) fun;
} else {
log_error(("unknown function type '%s' for resource %s\n",
(const char *)propValue, rtype->_name[0]));
log_error("unknown function type '%s' for resource %s\n", (const char *)propValue, rtype->_name[0]);
}
xmlFree(propValue);
}
@ -1168,8 +1158,7 @@ static int parse_resources(xmlDocPtr doc)
xmlFree(propBldg);
}
} else {
log_error(("unknown type '%s' for resourcelimit-modifier '%s'\n",
(const char *)propValue, rtype->_name[0]));
log_error("unknown type '%s' for resourcelimit-modifier '%s'\n", (const char *)propValue, rtype->_name[0]);
}
xmlFree(propValue);
}
@ -1204,8 +1193,7 @@ static int parse_resources(xmlDocPtr doc)
assert(propValue != NULL);
fun = get_function((const char *)propValue);
if (fun == NULL) {
log_error(("unknown limit '%s' for resource %s\n",
(const char *)propValue, rtype->_name[0]));
log_error("unknown limit '%s' for resource %s\n", (const char *)propValue, rtype->_name[0]);
xmlFree(propValue);
continue;
}
@ -1218,8 +1206,7 @@ static int parse_resources(xmlDocPtr doc)
} else if (strcmp((const char *)propValue, "limit") == 0) {
rdata->limit = (rlimit_limit) fun;
} else {
log_error(("unknown limit '%s' for resource %s\n",
(const char *)propValue, rtype->_name[0]));
log_error("unknown limit '%s' for resource %s\n", (const char *)propValue, rtype->_name[0]);
}
xmlFree(propValue);
}
@ -1323,8 +1310,7 @@ static void add_spells(equipment * eq, xmlNodeSetPtr nsetItems)
assert(propValue != NULL);
sp = find_spell((const char *)propValue);
if (!sp) {
log_error(("no spell '%s' in school '%s' for equipment-set '%s'\n",
(const char *)propValue, magic_school[mtype], eq->name));
log_error("no spell '%s' in school '%s' for equipment-set '%s'\n", (const char *)propValue, magic_school[mtype], eq->name);
} else {
equipment_addspell(eq, sp);
}
@ -1346,8 +1332,7 @@ static void add_skills(equipment * eq, xmlNodeSetPtr nsetSkills)
assert(propValue != NULL);
sk = sk_find((const char *)propValue);
if (sk == NOSKILL) {
log_error(("unknown skill '%s' in equipment-set %s\n",
(const char *)propValue, eq->name));
log_error("unknown skill '%s' in equipment-set %s\n", (const char *)propValue, eq->name);
xmlFree(propValue);
} else {
xmlFree(propValue);
@ -1410,8 +1395,7 @@ add_subsets(xmlDocPtr doc, equipment * eq, xmlNodeSetPtr nsetSubsets)
}
}
if (totalChance > 1.0f) {
log_error(("total chance exceeds 1.0: %f in equipment set %s.\n",
totalChance, eq->name));
log_error("total chance exceeds 1.0: %f in equipment set %s.\n", totalChance, eq->name);
}
}
xmlXPathFreeObject(xpathResult);
@ -1558,7 +1542,7 @@ static int parse_spells(xmlDocPtr doc)
if (result->nodesetval->nodeNr == 0) {
cast = get_function(sp->sname);
if (!cast) {
log_error(("no spell cast function registered for '%s'\n", sp->sname));
log_error("no spell cast function registered for '%s'\n", sp->sname);
valid = 0;
}
strlcpy(zText+7, sp->sname, sizeof(zText)-7);
@ -1575,15 +1559,13 @@ static int parse_spells(xmlDocPtr doc)
cast = fun;
valid = 1;
} else {
log_error(("unknown function name '%s' for spell '%s'\n",
(const char *)propValue, sp->sname));
log_error("unknown function name '%s' for spell '%s'\n", (const char *)propValue, sp->sname);
valid = 0;
}
} else if (fun && strcmp((const char *)propValue, "fumble") == 0) {
fumble = fun;
} else {
log_error(("unknown function type '%s' for spell '%s'\n",
(const char *)propValue, sp->sname));
log_error("unknown function type '%s' for spell '%s'\n", (const char *)propValue, sp->sname);
}
xmlFree(propValue);
}
@ -1611,8 +1593,7 @@ static int parse_spells(xmlDocPtr doc)
assert(propValue);
rtype = rt_find((const char *)propValue);
if (!rtype) {
log_error(("spell %s uses unknown component %s.\n", sp->sname,
(const char *)propValue));
log_error("spell %s uses unknown component %s.\n", sp->sname, (const char *)propValue);
xmlFree(propValue);
continue;
}
@ -1831,8 +1812,7 @@ static int parse_races(xmlDocPtr doc)
rc->study_speed[sk] = (char)speed;
}
} else {
log_error(("unknown skill '%s' in race '%s'\n",
(const char *)propValue, rc->_name[0]));
log_error("unknown skill '%s' in race '%s'\n", (const char *)propValue, rc->_name[0]);
}
xmlFree(propValue);
}
@ -1848,8 +1828,7 @@ static int parse_races(xmlDocPtr doc)
parse_function(node, &fun, &propValue);
if (fun == NULL) {
log_error(("unknown function name '%s' for race %s\n",
(const char *)propValue, rc->_name[0]));
log_error("unknown function name '%s' for race %s\n", (const char *)propValue, rc->_name[0]);
xmlFree(propValue);
continue;
}
@ -1869,8 +1848,7 @@ static int parse_races(xmlDocPtr doc)
} else if (strcmp((const char *)propValue, "initfamiliar") == 0) {
rc->init_familiar = (void (*)(struct unit *))fun;
} else {
log_error(("unknown function type '%s' for race %s\n",
(const char *)propValue, rc->_name[0]));
log_error("unknown function type '%s' for race %s\n", (const char *)propValue, rc->_name[0]);
}
xmlFree(propValue);
}
@ -2320,8 +2298,7 @@ static int parse_main(xmlDocPtr doc)
}
}
if (k == MAXKEYWORDS) {
log_error(("trying to disable unknown comand %s\n",
(const char *)propName));
log_error("trying to disable unknown comand %s\n", (const char *)propName);
}
}
xmlFree(propName);

View File

@ -247,7 +247,7 @@ static int read_hurting(attrib * a, void *owner, struct storage *store)
i = store->r_int(store);
a->data.v = (void *)findbuilding(i);
if (a->data.v == NULL) {
log_error(("temple of pain is broken\n"));
log_error("temple of pain is broken\n");
return AT_READ_FAIL;
}
return AT_READ_OK;
@ -263,7 +263,7 @@ static void make_temple(region * r)
const building_type *btype = bt_find("temple");
building *b;
if (btype == NULL) {
log_error(("could not find buildingtype 'temple'\n"));
log_error("could not find buildingtype 'temple'\n");
return;
}
@ -428,7 +428,7 @@ static int caldera_handle(trigger * t, void *data)
up = &u->next;
}
} else {
log_error(("could not perform caldera::handle()\n"));
log_error("could not perform caldera::handle()\n");
}
unused(data);
return 0;

View File

@ -266,8 +266,7 @@ newfaction *read_newfactions(const char *filename)
continue;
nf = calloc(sizeof(newfaction), 1);
if (set_email(&nf->email, email) != 0) {
log_error(("Invalid email address for subscription %s: %s\n",
itoa36(subscription), email));
log_error("Invalid email address for subscription %s: %s\n", itoa36(subscription), email);
continue;
}
nf->password = strdup(password);
@ -296,7 +295,7 @@ newfaction *read_newfactions(const char *filename)
buffer[outbytes] = 0;
nf->race = findrace(buffer, default_locale);
if (nf->race == NULL) {
log_error(("new faction has unknown race '%s'.\n", race));
log_error("new faction has unknown race '%s'.\n", race);
free(nf);
continue;
}

View File

@ -109,7 +109,7 @@ static int read_gmcreate(attrib * a, void *owner, struct storage *store)
store->r_tok_buf(store, zText, sizeof(zText));
a->data.v = it_find(zText);
if (a->data.v == NULL) {
log_error(("unknown itemtype %s in gmcreate attribute\n", zText));
log_error("unknown itemtype %s in gmcreate attribute\n", zText);
return AT_READ_FAIL;
}
return AT_READ_OK;
@ -667,8 +667,7 @@ faction *gm_addfaction(const char *email, plane * p, region * r)
f->passw = strdup(itoa36(rng_int()));
f->override = strdup(itoa36(rng_int()));
if (set_email(&f->email, email) != 0) {
log_error(("Invalid email address for faction %s: %s\n", itoa36(f->no),
email));
log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), email);
}
f->race = new_race[RC_TEMPLATE];
f->age = 0;

View File

@ -67,7 +67,7 @@ static int changefaction_handle(trigger * t, void *data)
if (td->unit && td->faction) {
u_setfaction(td->unit, td->faction);
} else {
log_error(("could not perform changefaction::handle()\n"));
log_error("could not perform changefaction::handle()\n");
}
unused(data);
return 0;

View File

@ -70,7 +70,7 @@ static int changerace_handle(trigger * t, void *data)
if (td->irace != NULL)
td->u->irace = td->irace;
} else {
log_error(("could not perform changerace::handle()\n"));
log_error("could not perform changerace::handle()\n");
}
unused(data);
return 0;

View File

@ -54,7 +54,7 @@ static int clonedied_handle(trigger * t, void *data)
if (a)
a_remove(&u->attribs, a);
} else
log_error(("could not perform clonedied::handle()\n"));
log_error("could not perform clonedied::handle()\n");
unused(data);
return 0;
}

View File

@ -73,7 +73,7 @@ static int createcurse_handle(trigger * t, void *data)
create_curse(td->mage, &td->target->attribs,
td->type, td->vigour, td->duration, td->effect, td->men);
} else {
log_error(("could not perform createcurse::handle()\n"));
log_error("could not perform createcurse::handle()\n");
}
unused(data);
return 0;

View File

@ -71,7 +71,7 @@ static int createunit_handle(trigger * t, void *data)
if (td->r != NULL && td->f != NULL) {
create_unit(td->r, td->f, td->number, td->race, 0, NULL, NULL);
} else {
log_error(("could not perform createunit::handle()\n"));
log_error("could not perform createunit::handle()\n");
}
unused(data);
return 0;

View File

@ -53,7 +53,7 @@ static int gate_handle(trigger * t, void *data)
up = &u->next;
}
} else {
log_error(("could not perform gate::handle()\n"));
log_error("could not perform gate::handle()\n");
return -1;
}
unused(data);

View File

@ -66,7 +66,7 @@ static int giveitem_handle(trigger * t, void *data)
if (td->u && td->u->number) {
i_change(&td->u->items, td->itype, td->number);
} else {
log_error(("could not perform giveitem::handle()\n"));
log_error("could not perform giveitem::handle()\n");
}
unused(data);
return 0;

View File

@ -65,7 +65,7 @@ static int removecurse_handle(trigger * t, void *data)
if (a) {
a_remove(&td->target->attribs, a);
} else
log_error(("could not perform removecurse::handle()\n"));
log_error("could not perform removecurse::handle()\n");
}
unused(data);
return 0;

View File

@ -111,8 +111,7 @@ static void shock_write(const trigger * t, struct storage *store)
next = next->next;
}
if (next && u) {
log_error(("more than one shock-attribut for %s on a unit. FIXED.\n",
unitid(u)));
log_error("more than one shock-attribut for %s on a unit. FIXED.\n", unitid(u));
write_unit_reference(NULL, store);
} else {
write_unit_reference(u, store);

View File

@ -35,7 +35,7 @@ static int unguard_handle(trigger * t, void *data)
if (b) {
fset(b, BLD_UNGUARDED);
} else {
log_error(("could not perform unguard::handle()\n"));
log_error("could not perform unguard::handle()\n");
return -1;
}
unused(data);

View File

@ -119,8 +119,7 @@ int cr_render(const message * msg, char *buffer, const void *userdata)
return -1;
for (i = 0; i != msg->type->nparameters; ++i) {
if (crt->renderers[i] == NULL) {
log_error(("No renderer for argument %s:%s of \"%s\"\n",
msg->type->pnames[i], msg->type->types[i]->name, msg->type->name));
log_error("No renderer for argument %s:%s of \"%s\"\n", msg->type->pnames[i], msg->type->types[i]->name, msg->type->name);
continue; /* strcpy(c, (const char*)msg->locale_string(u->faction->locale, parameters[i])); */
} else {
if (crt->renderers[i] (msg->parameters[i], c, userdata) != 0)

View File

@ -160,7 +160,7 @@ static const char *getbuf_latin1(FILE * F)
if (ret > 0)
cp += ret;
else {
log_error(("input data was not iso-8859-1! assuming utf-8\n"));
log_error("input data was not iso-8859-1! assuming utf-8\n");
return NULL;
}

View File

@ -181,7 +181,7 @@ void locale_setstring(locale * lang, const char *key, const char *value)
find->str = strdup(value);
} else {
if (strcmp(find->str, value) != 0) {
log_error(("duplicate translation '%s' for key %s\n", value, key));
log_error("duplicate translation '%s' for key %s\n", value, key);
}
assert(!strcmp(find->str, value) || !"duplicate string for key");
}

View File

@ -224,7 +224,7 @@ void log_warning(const char *format, ...)
}
}
void _log_error(const char *format, ...)
void log_error(const char *format, ...)
{
const char * prefix = "ERROR";
const int mask = LOG_CPERROR;

View File

@ -19,12 +19,11 @@ extern "C" {
extern void log_close(void);
extern void log_flush(void);
#define log_error(x) _log_error x
#define log_debug _log_debug
/* use macros above instead of these: */
extern void log_warning(const char *format, ...);
extern void _log_error(const char *format, ...);
extern void log_error(const char *format, ...);
extern void _log_debug(const char *format, ...);
extern void log_info(const char *format, ...);
extern void log_printf(FILE * ios, const char *format, ...);

View File

@ -39,7 +39,7 @@ message_type *mt_new(const char *name, const char *args[])
assert(name != NULL);
if (name == NULL) {
log_error(("Trying to create message_type with name=0x0\n"));
log_error("Trying to create message_type with name=0x0\n");
return NULL;
}
if (args != NULL)
@ -67,8 +67,7 @@ message_type *mt_new(const char *name, const char *args[])
mtype->pnames[i] = cp;
mtype->types[i] = find_argtype(spos + 1);
if (mtype->types[i] == NULL) {
log_error(("unknown argument type %s for message type %s\n",
spos + 1, mtype->name));
log_error("unknown argument type %s for message type %s\n", spos + 1, mtype->name);
}
assert(mtype->types[i]);
}
@ -141,7 +140,7 @@ message *msg_create(const struct message_type *mtype, variant args[])
assert(mtype != NULL);
if (mtype == NULL) {
log_error(("Trying to create message with type=0x0\n"));
log_error("Trying to create message with type=0x0\n");
return NULL;
}
msg->type = mtype;

View File

@ -107,7 +107,7 @@ nrt_register(const struct message_type *mtype, const struct locale *lang,
nrt = nrt->next;
}
if (nrt) {
log_error(("duplicate message-type %s\n", mtype->name));
log_error("duplicate message-type %s\n", mtype->name);
assert(!nrt || !"trying to register same nr-type twice");
} else {
int i;
@ -151,7 +151,7 @@ nr_render(const struct message *msg, const struct locale *lang, char *buffer,
if (m) {
return strlcpy((char *)buffer, m, size);
} else {
log_error(("Couldn't render message %s\n", nrt->mtype->name));
log_error("Couldn't render message %s\n", nrt->mtype->name);
}
}
if (size > 0 && buffer)

View File

@ -210,7 +210,7 @@ static const char *parse_symbol(opstack ** stack, const char *in,
++in;
foo = find_function(symbol);
if (foo == NULL) {
log_error(("parser does not know about \"%s\" function.\n", symbol));
log_error("parser does not know about \"%s\" function.\n", symbol);
return NULL;
}
foo(stack, userdata); /* will pop parameters from stack (reverse order!) and push the result */
@ -221,7 +221,7 @@ static const char *parse_symbol(opstack ** stack, const char *in,
}
/* it's a constant (variable is a misnomer, but heck, const was taken;)) */
if (var == NULL) {
log_error(("parser does not know about \"%s\" variable.\n", symbol));
log_error("parser does not know about \"%s\" variable.\n", symbol);
return NULL;
}
opush(stack, var->value);
@ -352,7 +352,7 @@ static const char *parse(opstack ** stack, const char *inn,
++b;
}
}
log_error(("could not parse \"%s\". Probably invalid message syntax.", inn));
log_error("could not parse \"%s\". Probably invalid message syntax.", inn);
return NULL;
}
@ -390,7 +390,7 @@ const char *translate(const char *format, const void *userdata,
}
if (rv != NULL) {
if (rv[0]) {
log_error(("residual data after parsing: %s\n", rv));
log_error("residual data after parsing: %s\n", rv);
}
rv = (const char *)opop(&stack).v;
free(stack->begin);

View File

@ -118,7 +118,7 @@ int read_xml(const char *filename, const char *catalog)
doc = xmlParseFile(filename);
#endif
if (doc == NULL) {
log_error(("could not open %s\n", filename));
log_error("could not open %s\n", filename);
return -1;
}