delete dead code

This commit is contained in:
Enno Rehling 2016-09-11 16:39:41 +02:00
parent fb0fc9e361
commit 0124bafdc4
6 changed files with 3 additions and 75 deletions

View File

@ -17,7 +17,7 @@ function setup()
end end
function test_faction_flags() function test_faction_flags()
assert_equal(0, f.flags) assert_equal(2, f.flags) -- FFL_ISNEW
f.flags = 42 f.flags = 42
assert_equal(42, f.flags) assert_equal(42, f.flags)
end end

View File

@ -88,7 +88,6 @@ static FILE *bdebug;
#define TDIFF_CHANGE 5 /* 5% höher pro Stufe */ #define TDIFF_CHANGE 5 /* 5% höher pro Stufe */
#define DAMAGE_QUOTIENT 2 /* damage += skilldiff/DAMAGE_QUOTIENT */ #define DAMAGE_QUOTIENT 2 /* damage += skilldiff/DAMAGE_QUOTIENT */
#undef DEBUG_FAST /* should be disabled when b->fast and b->rowcache works */
#define DEBUG_SELECT /* should be disabled if select_enemy works */ #define DEBUG_SELECT /* should be disabled if select_enemy works */
typedef enum combatmagic { typedef enum combatmagic {
@ -205,12 +204,7 @@ static const char *sideabkz(side * s, bool truename)
const faction *f = (s->stealthfaction const faction *f = (s->stealthfaction
&& !truename) ? s->stealthfaction : s->faction; && !truename) ? s->stealthfaction : s->faction;
#undef SIDE_ABKZ
#ifdef SIDE_ABKZ
abkz(f->name, sideabkz_buf, sizeof(sideabkz_buf), 3);
#else
strlcpy(sideabkz_buf, itoa36(f->no), sizeof(sideabkz_buf)); strlcpy(sideabkz_buf, itoa36(f->no), sizeof(sideabkz_buf));
#endif
return sideabkz_buf; return sideabkz_buf;
} }
@ -471,13 +465,7 @@ static int get_unitrow(const fighter * af, const side * vs)
b->rowcache.result = get_row(af->side, row, vs); b->rowcache.result = get_row(af->side, row, vs);
return b->rowcache.result; return b->rowcache.result;
} }
#ifdef DEBUG_FAST /* validation code */ return b->rowcache.result;
{
int i = get_row(af->side, row, vs);
assert(i == b->rowcache.result);
}
#endif
return b->rowcache.result;
} }
} }
@ -1445,18 +1433,10 @@ int select)
if (b->alive == b->fast.alive && as == b->fast.side && sr == b->fast.status if (b->alive == b->fast.alive && as == b->fast.side && sr == b->fast.status
&& minrow == b->fast.minrow && maxrow == b->fast.maxrow) { && minrow == b->fast.minrow && maxrow == b->fast.maxrow) {
if (b->fast.enemies[select] >= 0) { if (b->fast.enemies[select] >= 0) {
#ifdef DEBUG_FAST
int i = count_enemies_i(b, af, minrow, maxrow, select);
assert(i == b->fast.enemies[select]);
#endif
return b->fast.enemies[select]; return b->fast.enemies[select];
} }
else if (select & SELECT_FIND) { else if (select & SELECT_FIND) {
if (b->fast.enemies[select - SELECT_FIND] >= 0) { if (b->fast.enemies[select - SELECT_FIND] >= 0) {
#ifdef DEBUG_FAST
int i = count_enemies_i(b, af, minrow, maxrow, select);
assert((i > 0) == (b->fast.enemies[select - SELECT_FIND] > 0));
#endif
return b->fast.enemies[select - SELECT_FIND]; return b->fast.enemies[select - SELECT_FIND];
} }
} }

View File

@ -233,15 +233,7 @@ void tolua_ship_open(lua_State * L)
tolua_variable(L, TOLUA_CAST "type", tolua_ship_get_type, 0); tolua_variable(L, TOLUA_CAST "type", tolua_ship_get_type, 0);
tolua_variable(L, TOLUA_CAST "damage", tolua_ship_get_damage, tolua_variable(L, TOLUA_CAST "damage", tolua_ship_get_damage,
tolua_ship_set_damage); tolua_ship_set_damage);
tolua_variable(L, TOLUA_CAST "objects", tolua_ship_get_objects, 0);
#ifdef TODO
.property("weight", &ship_getweight)
.property("capacity", &ship_getcapacity)
.property("maxsize", &ship_maxsize)
.def_readwrite("damage", &ship::damage)
.def_readwrite("size", &ship::size)
#endif
tolua_variable(L, TOLUA_CAST "objects", tolua_ship_get_objects, 0);
tolua_function(L, TOLUA_CAST "create", tolua_ship_create); tolua_function(L, TOLUA_CAST "create", tolua_ship_create);
} }

View File

@ -767,25 +767,6 @@ static int tolua_unit_get_spells(lua_State * L)
return tolua_quicklist_push(L, "spellbook", "spell_entry", slist); return tolua_quicklist_push(L, "spellbook", "spell_entry", slist);
} }
#ifdef TODO /* spellbooks */
static void unit_removespell(unit * u, spell * sp)
{
quicklist **isptr;
isptr = get_spelllist(get_mage(u), u->faction);
ql_set_remove(isptr, sp);
}
static int tolua_unit_removespell(lua_State * L)
{
unit *self = (unit *) tolua_tousertype(L, 1, 0);
spell *sp = (spell *) tolua_tousertype(L, 2, 0);
unit_removespell(self, sp);
return 0;
}
#endif
static int tolua_unit_get_orders(lua_State * L) static int tolua_unit_get_orders(lua_State * L)
{ {
unit *self = (unit *)tolua_tousertype(L, 1, 0); unit *self = (unit *)tolua_tousertype(L, 1, 0);
@ -1019,9 +1000,6 @@ void tolua_unit_open(lua_State * L)
tolua_variable(L, TOLUA_CAST "race_name", &tolua_unit_get_racename, tolua_variable(L, TOLUA_CAST "race_name", &tolua_unit_get_racename,
&tolua_unit_set_racename); &tolua_unit_set_racename);
tolua_function(L, TOLUA_CAST "add_spell", &tolua_unit_addspell); tolua_function(L, TOLUA_CAST "add_spell", &tolua_unit_addspell);
#ifdef TODO /* spellbooks */
tolua_function(L, TOLUA_CAST "remove_spell", &tolua_unit_removespell);
#endif
tolua_variable(L, TOLUA_CAST "spells", &tolua_unit_get_spells, 0); tolua_variable(L, TOLUA_CAST "spells", &tolua_unit_get_spells, 0);
tolua_function(L, TOLUA_CAST "cast_spell", &tolua_unit_castspell); tolua_function(L, TOLUA_CAST "cast_spell", &tolua_unit_castspell);

View File

@ -322,10 +322,6 @@ int main(int argc, char **argv)
log_error("script %s failed with code %d\n", luafile, err); log_error("script %s failed with code %d\n", luafile, err);
return err; return err;
} }
#ifdef MSPACES
malloc_stats();
#endif
game_done(); game_done();
lua_done(L); lua_done(L);
log_close(); log_close();

View File

@ -2128,23 +2128,6 @@ const char *charset)
RENDER(f, buf, sizeof(buf), ("nr_score", "score average", score, avg)); RENDER(f, buf, sizeof(buf), ("nr_score", "score average", score, avg));
centre(out, buf, true); centre(out, buf, true);
} }
#ifdef COUNT_AGAIN
no_units = 0;
no_people = 0;
for (u = f->units; u; u = u->nextF) {
if (playerrace(u_race(u))) {
++no_people;
no_units += u->number;
assert(f == u->faction);
}
}
if (no_units != f->no_units) {
f->no_units = no_units;
}
if (no_people != f->num_people) {
f->num_people = no_people;
}
#else
no_units = count_units(f); no_units = count_units(f);
no_people = count_all(f); no_people = count_all(f);
if (f->flags & FFL_NPC) { if (f->flags & FFL_NPC) {
@ -2153,7 +2136,6 @@ const char *charset)
else { else {
no_people = f->num_people; no_people = f->num_people;
} }
#endif
m = msg_message("nr_population", "population units limit", no_people, no_units, rule_faction_limit()); m = msg_message("nr_population", "population units limit", no_people, no_units, rule_faction_limit());
nr_render(m, f->locale, buf, sizeof(buf), f); nr_render(m, f->locale, buf, sizeof(buf), f);
msg_release(m); msg_release(m);