cleanup, fix a TODO, eliminate dead code.

This commit is contained in:
Enno Rehling 2014-12-10 09:39:11 +01:00
parent 0c54c7e32d
commit 01877f5169
8 changed files with 4 additions and 122 deletions

View File

@ -215,10 +215,6 @@ static int age_potiondelay(attrib * a)
return AT_AGE_REMOVE;
}
/* TODO:
* - this should be a more general item_delay
* - it should not just happen in age(), but be done with eventhandling
*/
attrib_type at_potiondelay = {
"potiondelay",
init_potiondelay,

View File

@ -2052,9 +2052,6 @@ void dazzle(battle * b, troop * td)
td->fighter->person[td->index].defence--;
}
/* TODO: Gebäude/Schiffe sollten auch zerstörbar sein. Schwierig im Kampf,
* besonders bei Schiffen. */
void damage_building(battle * b, building * bldg, int damage_abs)
{
bldg->size = _max(1, bldg->size - damage_abs);
@ -2262,9 +2259,9 @@ static void attack(battle * b, troop ta, const att * a, int numattack)
ta.fighter->person[ta.index].last_action = b->turn;
}
if (td.fighter->unit->ship) {
/* FIXME should use damage_ship here? */
td.fighter->unit->ship->damage +=
DAMAGE_SCALE * dice_rand(a->data.dice);
int dice = dice_rand(a->data.dice);
ship * sh = td.fighter->unit->ship;
damage_ship(sh, dice / sh->type->damage / sh->size);
}
else if (td.fighter->unit->building) {
damage_building(b, td.fighter->unit->building, dice_rand(a->data.dice));
@ -3689,18 +3686,6 @@ static void free_battle(battle * b)
static int *get_alive(side * s)
{
#if 0
static int alive[NUMROWS];
fighter *fig;
memset(alive, 0, NUMROWS * sizeof(int));
for (fig = s->fighters; fig; fig = fig->next) {
if (fig->alive > 0) {
int row = statusrow(fig);
alive[row] += fig->alive;
}
}
return alive;
#endif
return s->size;
}

View File

@ -243,10 +243,6 @@ void tolua_building_open(lua_State * L)
tolua_variable(L, TOLUA_CAST "size", tolua_building_get_size,
tolua_building_set_size);
tolua_function(L, TOLUA_CAST "get_typename", tolua_building_get_typename);
#ifdef TODO
.property("type", &building_gettype)
.def_readwrite("size", &building::size)
#endif
tolua_variable(L, TOLUA_CAST "objects", tolua_building_get_objects, 0);
tolua_variable(L, TOLUA_CAST "working", tolua_building_get_working, tolua_building_set_working);

View File

@ -734,20 +734,6 @@ int alliedunit(const unit * u, const faction * f2, int mode)
return 0;
}
#ifndef NDEBUG
const char *strcheck(const char *s, size_t maxlen)
{
static char buffer[16 * 1024]; // FIXME: static return value
if (strlen(s) > maxlen) {
assert(maxlen < 16 * 1024);
log_warning("[strcheck] string was shortened to %d bytes:\n%s\n", (int)maxlen, s);
strlcpy(buffer, s, maxlen);
return buffer;
}
return s;
}
#endif
static attrib_type at_lighthouse = {
"lighthouse"
/* Rest ist NULL; temporäres, nicht alterndes Attribut */

View File

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

View File

@ -552,43 +552,6 @@ static int parse_ships(xmlDocPtr doc)
return 0;
}
#if 0
static void race_compat(void)
{
/* required for old_race, do not change order! */
const char *oldracenames[MAXRACES] = {
"dwarf", "elf", NULL, "goblin", "human", "troll", "demon", "insect",
"halfling", "cat", "aquarian", "orc", "snotling", "undead", "illusion",
"youngdragon", "dragon", "wyrm", "ent", "catdragon", "dracoid",
"special", "spell", "irongolem", "stonegolem", "shadowdemon",
"shadowmaster", "mountainguard", "alp", "toad", "braineater", "peasant",
"wolf", NULL, NULL, NULL, NULL, "songdragon", NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, "seaserpent",
"shadowknight", "centaur", "skeleton", "skeletonlord", "zombie",
"juju-zombie", "ghoul", "ghast", "museumghost", "gnome", "template",
"clone"
};
int i;
for (i = 0; i != MAXRACES; ++i) {
const char *rcname = oldracenames[i];
if (rcname == NULL) {
new_race[i] = NULL;
} else {
race *rc = rc_get_or_create(oldracenames[i]);
if (rc) {
new_race[i] = rc;
if (rc == new_race[RC_TROLL]) {
a_add(&rc->attribs, make_skillmod(NOSKILL, SMF_RIDING, NULL, 0.0,
-1));
}
}
}
}
}
#endif
static potion_type *xml_readpotion(xmlXPathContextPtr xpath, item_type * itype)
{
int level = xml_ivalue(xpath->node, "level", 0);

View File

@ -394,46 +394,10 @@ int report_action(region * r, unit * actor, message * msg, int flags)
static void
report_effect(region * r, unit * mage, message * seen, message * unseen)
{
#if 0
unit *u;
/* melden, 1x pro Partei */
freset(mage->faction, FFL_SELECT);
for (u = r->units; u; u = u->next)
freset(u->faction, FFL_SELECT);
for (u = r->units; u; u = u->next) {
if (!fval(u->faction, FFL_SELECT)) {
fset(u->faction, FFL_SELECT);
/* Bei Fernzaubern sieht nur die eigene Partei den Magier */
if (u->faction != mage->faction) {
if (r == mage->region) {
/* kein Fernzauber, pruefe, ob der Magier ueberhaupt gesehen
* wird */
if (cansee(u->faction, r, mage, 0)) {
r_addmessage(r, u->faction, seen);
} else {
r_addmessage(r, u->faction, unseen);
}
} else { /* Fernzauber, fremde Partei sieht den Magier niemals */
r_addmessage(r, u->faction, unseen);
}
} else { /* Partei des Magiers, sieht diesen immer */
r_addmessage(r, u->faction, seen);
}
}
}
/* Ist niemand von der Partei des Magiers in der Region, dem Magier
* nochmal gesondert melden */
if (!fval(mage->faction, FFL_SELECT)) {
add_message(&mage->faction->msgs, seen);
}
#else
int err = report_action(r, mage, seen, ACTION_RESET | ACTION_CANSEE);
if (err) {
report_action(r, mage, seen, ACTION_CANNOTSEE);
}
#endif
}
/* ------------------------------------------------------------- */
@ -3613,11 +3577,6 @@ static int sp_charmingsong(castorder * co)
/* Magieresistenz */
if (target_resists_magic(mage, target, TYP_UNIT, resist_bonus)) {
report_failure(mage, co->order);
#if 0
sprintf(buf, "%s fuehlt sich einen Moment lang benommen und desorientiert.",
unitname(target));
addmessage(target->region, target->faction, buf, MSG_EVENT, ML_WARN);
#endif
return 0;
}

View File

@ -23,7 +23,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* kernel includes */
#include <kernel/unit.h>
#include <kernel/save.h>
#include <kernel/faction.h> /* FIXME: resolve_faction */
#include <kernel/faction.h>
/* util includes */
#include <util/attrib.h>