gcc 4.6 is a lot more picky about unused variables, so I shall appease it.

This commit is contained in:
Enno Rehling 2012-05-20 00:16:12 -07:00
parent 7dea6457d1
commit 08adc91534
13 changed files with 34 additions and 57 deletions

View file

@ -95,11 +95,10 @@ static void a_finalizegive(struct attrib *a)
static int a_giveitem(attrib * a)
{
give_data *gdata = (give_data *) a->data.v;
region *r;
unit *u;
if (gdata->building == NULL || gdata->items == NULL)
return 0;
r = gdata->building->region;
u = building_owner(gdata->building);
if (u == NULL)
return 1;

View file

@ -240,7 +240,7 @@ static int lua_callspell(castorder * co)
}
/** callback to initialize a familiar from lua. */
static void lua_initfamiliar(unit * u)
static int lua_initfamiliar(unit * u)
{
lua_State *L = (lua_State *) global.vm_state;
char fname[64];
@ -269,6 +269,7 @@ static void lua_initfamiliar(unit * u)
snprintf(fname, sizeof(fname), "%s_familiar", u->race->_name[0]);
equip_unit(u, get_equipment(fname));
return result;
}
static int
@ -447,11 +448,9 @@ static double lua_building_taxes(building * b, int level)
lua_State *L = (lua_State *) global.vm_state;
const char *fname = "building_taxes";
double result = 0.0F;
int type;
lua_pushstring(L, fname);
lua_rawget(L, LUA_GLOBALSINDEX);
type = lua_type(L, 1);
if (lua_isfunction(L, 1)) {
tolua_pushusertype(L, (void *)b, TOLUA_CAST "building");
tolua_pushnumber(L, level);
@ -498,7 +497,7 @@ static int lua_maintenance(const unit * u)
return result;
}
static void lua_equipmentcallback(const struct equipment *eq, unit * u)
static int lua_equipmentcallback(const struct equipment *eq, unit * u)
{
lua_State *L = (lua_State *) global.vm_state;
char fname[64];
@ -522,6 +521,7 @@ static void lua_equipmentcallback(const struct equipment *eq, unit * u)
log_error("equip(%s) calling '%s': not a function.\n", unitname(u), fname);
lua_pop(L, 1);
}
return result;
}
/** callback for an item-use function written in lua. */

View file

@ -1432,7 +1432,6 @@ static void allocate_resource(unit * u, const resource_type * rtype, int want)
{
const item_type *itype = resource2item(rtype);
region *r = u->region;
int busy = u->number;
int dm = 0;
allocation_list *alist;
allocation *al;
@ -1555,8 +1554,6 @@ static void allocate_resource(unit * u, const resource_type * rtype, int want)
if (want > 0 && want < amount)
amount = want;
busy = (amount + skill - 1) / skill; /* wieviel leute tun etwas? */
alist = allocations;
while (alist && alist->type != rtype)
alist = alist->next;

View file

@ -276,7 +276,6 @@ int teach_cmd(unit * u, struct order *ord)
plane *pl;
region *r = u->region;
int teaching, i, j, count, academy = 0;
unit *u2;
skill_t sk = NOSKILL;
if (gbdream_ct == 0)
@ -312,7 +311,6 @@ int teach_cmd(unit * u, struct order *ord)
if (teaching == 0)
return 0;
u2 = 0;
count = 0;
init_tokens(ord);

View file

@ -502,14 +502,13 @@ terraform_selection(selection * selected, const terrain_type * terrain)
static faction *select_faction(state * st)
{
list_selection *prev, *ilist = NULL, **iinsert;
list_selection *ilist = NULL, **iinsert;
list_selection *selected = NULL;
faction *f = factions;
if (!f)
return NULL;
iinsert = &ilist;
prev = ilist;
while (f) {
char buffer[32];
@ -530,14 +529,13 @@ static faction *select_faction(state * st)
static const terrain_type *select_terrain(state * st,
const terrain_type * default_terrain)
{
list_selection *prev, *ilist = NULL, **iinsert;
list_selection *ilist = NULL, **iinsert;
list_selection *selected = NULL;
const terrain_type *terrain = terrains();
if (!terrain)
return NULL;
iinsert = &ilist;
prev = ilist;
while (terrain) {
insert_selection(iinsert, NULL, terrain->_name, (void *)terrain);

View file

@ -847,7 +847,6 @@ void
build_building(unit * u, const building_type * btype, int want, order * ord)
{
region *r = u->region;
boolean newbuilding = false;
int n = want, built = 0, id;
building *b = NULL;
/* einmalige Korrektur */
@ -983,7 +982,6 @@ build_building(unit * u, const building_type * btype, int want, order * ord)
}
#endif
newbuilding = true;
}
btname = LOC(lang, btype->_name);

View file

@ -1292,14 +1292,11 @@ static void make_route(unit * u, order * ord, region_list ** routep)
}
while (next != NULL) {
direction_t reldir;
if (current == next) {
/* PAUSE */
break;
}
next = next_region(u, current, next);
reldir = reldirection(current, next);
add_regionlist(iroute, next);
iroute = &(*iroute)->next;
@ -1718,7 +1715,6 @@ sail(unit * u, order * ord, boolean move_on_land, region_list ** routep)
const terrain_type *tthis = current_point->terrain;
/* these values need to be updated if next_point changes (due to storms): */
const terrain_type *tnext = next_point->terrain;
direction_t dir = reldirection(current_point, next_point);
assert(sh == u->ship || !"ship has sunk, but we didn't notice it");
@ -1781,7 +1777,6 @@ sail(unit * u, order * ord, boolean move_on_land, region_list ** routep)
next_point = rnext;
/* these values need to be updated if next_point changes (due to storms): */
tnext = next_point->terrain;
dir = reldirection(current_point, next_point);
}
}
}

View file

@ -787,21 +787,21 @@ void rsetroad(region * r, direction_t d, short val)
short rroad(const region * r, direction_t d)
{
int rval;
connection *b;
region *r2 = rconnect(r, d);
if (!r2)
if (!r2) {
return 0;
}
b = get_borders(r, r2);
while (b && b->type != &bt_road)
while (b && b->type != &bt_road) {
b = b->next;
if (!b)
}
if (!b) {
return 0;
rval = b->data.i;
if (r == b->from)
return b->data.sa[0];
return b->data.sa[1];
}
return (r == b->from) ? b->data.sa[0] : b->data.sa[1];
}
boolean r_isforest(const region * r)

View file

@ -1744,7 +1744,6 @@ int reports(void)
faction *f;
FILE *mailit;
time_t ltime = time(NULL);
const char *str;
int retval = 0;
char path[MAX_PATH];
@ -1771,11 +1770,13 @@ int reports(void)
if (mailit)
fclose(mailit);
free_seen();
str = get_param(global.parameters, "globalreport");
#ifdef GLOBAL_REPORT
if (str != NULL) {
sprintf(path, "%s/%s.%u.cr", reportpath(), str, turn);
global_report(path);
{
const char *str = get_param(global.parameters, "globalreport");
if (str != NULL) {
sprintf(path, "%s/%s.%u.cr", reportpath(), str, turn);
global_report(path);
}
}
#endif
return retval;

View file

@ -406,20 +406,19 @@ int readorders(const char *filename)
while (b) {
const struct locale *lang = f ? f->locale : default_locale;
int p;
const char *s;
switch (igetparam(b, lang)) {
case P_LOCALE:
s = getstrtoken();
#undef LOCALE_CHANGE
#ifdef LOCALE_CHANGE
if (f && find_locale(s)) {
f->locale = find_locale(s);
case P_LOCALE:
{
const char *s = getstrtoken();
if (f && find_locale(s)) {
f->locale = find_locale(s);
}
}
#endif
b = getbuf(F, enc_gamedata);
break;
#endif
case P_GAMENAME:
case P_FACTION:
f = factionorders();
@ -1292,11 +1291,10 @@ faction *readfaction(struct storage * store)
read_items(store, &f->items);
}
for (;;) {
int level;
store->r_tok_buf(store, token, sizeof(token));
if (strcmp("end", token) == 0)
break;
level = store->r_int(store);
store->r_int(store); /* there used to be a level here, which is now ignored */
}
planes = store->r_int(store);
while (--planes >= 0) {

View file

@ -38,12 +38,12 @@ static int cache_insert;
static sqlite3_stmt *stmt_cache_get(sqlite3 * db, const char *sql)
{
int i, res;
int i;
for (i = 0; i != MAX_STMT_CACHE && cache[i].db; ++i) {
if (cache[i].sql == sql && cache[i].db == db) {
cache[i].inuse = 1;
res = sqlite3_reset(cache[i].stmt);
sqlite3_reset(cache[i].stmt);
return cache[i].stmt;
}
}
@ -53,12 +53,12 @@ static sqlite3_stmt *stmt_cache_get(sqlite3 * db, const char *sql)
cache_insert = (cache_insert + 1) & (MAX_STMT_CACHE - 1);
}
i = cache_insert;
res = sqlite3_finalize(cache[i].stmt);
sqlite3_finalize(cache[i].stmt);
}
cache[i].inuse = 1;
cache[i].db = db;
cache[i].sql = sql;
res = sqlite3_prepare_v2(db, sql, -1, &cache[i].stmt, NULL);
sqlite3_prepare_v2(db, sql, -1, &cache[i].stmt, NULL);
return cache[i].stmt;
}

View file

@ -873,14 +873,11 @@ boolean can_survive(const unit * u, const region * r)
void move_unit(unit * u, region * r, unit ** ulist)
{
int maxhp = 0;
assert(u && r);
assert(u->faction || !"this unit is dead");
if (u->region == r)
return;
if (u->region != NULL)
maxhp = unit_max_hp(u);
if (!ulist)
ulist = (&r->units);
if (u->region) {
@ -904,8 +901,6 @@ void move_unit(unit * u, region * r, unit ** ulist)
update_interval(u->faction, r);
#endif
u->region = r;
/* keine automatische hp reduzierung bei bewegung */
/* if (maxhp>0) u->hp = u->hp * unit_max_hp(u) / maxhp; */
}
/* ist mist, aber wegen nicht skalierender attribute notwendig: */

View file

@ -968,7 +968,6 @@ static void smooth_island(region_list * island)
static void starting_region(region * r, region * rn[])
{
unit *u;
int n;
oceans_around(r, rn);
@ -978,8 +977,7 @@ static void starting_region(region * r, region * rn[])
}
terraform_region(r, newterrain(T_PLAIN));
prepare_starting_region(r);
u = addplayer(r, addfaction("enno@eressea.de", itoa36(rng_int()), races,
default_locale, 0));
addplayer(r, addfaction("enno@eressea.de", itoa36(rng_int()), races, default_locale, 0));
}
/* E3A island generation */