started fixing warnings

remove .o files from repo
This commit is contained in:
rob 2022-08-27 21:02:42 +10:00
parent 415a15a523
commit ef08494ade
5 changed files with 701 additions and 702 deletions

View File

@ -1,7 +1,7 @@
#all: Makefile defs.h nexus.c nexus.h ai.c ai.h attack.c attack.h data.c data.h flag.c flag.h god.c god.h io.c io.h lf.c lf.h map.c map.h move.c move.h objects.c objects.h text.c text.h save.c save.h shops.c shops.h spell.c spell.h vault.c vault.h
# gcc $(CFLAGS) -o nexus nexus.c ai.c attack.c data.c flag.c god.c io.c lf.c map.c move.c objects.c text.c save.c spell.c shops.c vault.c -lncurses -lsqlite3
CFLAGS=-fdiagnostics-color=always -g -Wall -Werror
CFLAGS=-fdiagnostics-color=always -g -Wall -Werror -Wno-format-truncation -Wno-unused-but-set-variable
nexus: ai.o astar.o attack.o data.o flag.o god.o io.o lf.o map.o move.o nexus.o objects.o save.o shops.o spell.o text.o vault.o ai.h attack.h data.h defs.h flag.h god.h io.h lf.h map.h move.h nexus.h objects.h save.h shops.h spell.h text.h vault.h
gcc $(CFLAGS) -o nexus ai.o astar.o attack.o data.o flag.o god.o io.o lf.o map.o move.o nexus.o objects.o save.o shops.o spell.o text.o vault.o -lncurses -lsqlite3

30
ai.c
View File

@ -25,10 +25,10 @@ extern int playerhasmoved;
int wantdb = B_TRUE;
void addignorecell(lifeform_t *lf, cell_t *c) {
int howmany = 0;
//int howmany = 0;
if (!c || !lf) return;
// TEST: just have one ignorecell at once.
howmany = killflagsofid(lf->flags, F_IGNORECELL);
killflagsofid(lf->flags, F_IGNORECELL);
addtempflag(lf->flags, F_IGNORECELL, c->x, c->y, NA, NULL, 10);
//if (c && !lfhasflagval(lf, F_IGNORECELL, c->x, c->y, NA, NULL)) {
// addtempflag(lf->flags, F_IGNORECELL, c->x, c->y, NA, NULL, 10);
@ -38,7 +38,7 @@ void addignorecell(lifeform_t *lf, cell_t *c) {
// returns true on failure
int aiattack(lifeform_t *lf, lifeform_t *victim, int timelimit) {
int db = B_FALSE;
int innocentattack = 0;
//int innocentattack = 0;
flag_t *f;
if (lfhasflag(lf, F_DEBUG)) {
@ -140,14 +140,14 @@ int aiattack(lifeform_t *lf, lifeform_t *victim, int timelimit) {
if (!areenemies(lf, victim)) {
if (getallegiance(victim) == AL_FRIENDLY) {
killflagsofid(lf->flags, F_FRIENDLY);
innocentattack = 3;
//innocentattack = 3;
}
}
// no longer a pet
f = lfhasflagval(lf, F_PETOF, victim->id, NA, NA, NULL);
if (f) {
if (isplayer(victim)) innocentattack = 3;
//if (isplayer(victim)) innocentattack = 3;
killflag(f);
}
@ -160,7 +160,7 @@ void ailoscheck(lifeform_t *lf) {
for (i = 0; i < lf->nlos; i++) {
c = lf->los[i];
if (!c->known) {
if ((c->known < PR_INEPT) || (c->known > PR_MASTER)) {
if (((int)c->known < (int)PR_INEPT) || ((int)c->known > (int)PR_MASTER)) {
ok = B_FALSE; break;
}
}
@ -202,8 +202,7 @@ flag_t *ai_createpathto(lifeform_t *lf, cell_t *targcell) {
return NULL;
}
if (db) dblog("%s pathfind - finding path from %d,%d to %d,%d\n",lfname, lf->cell->x,lf->cell->y,
targcell->x,targcell->y);
if (db) { dblog("%s pathfind - finding path from %d,%d to %d,%d\n",lfname, lf->cell->x,lf->cell->y, targcell->x,targcell->y); }
// add starting cell to open list
open[0].c = lf->cell;
@ -1133,14 +1132,14 @@ flag_t *aigoto(lifeform_t *lf, cell_t *c, enum MOVEREASON why, void *data, int t
int ai_attack_existing_target(lifeform_t *lf) {
lifeform_t *target;
int db = B_FALSE;
enum ATTRBRACKET iqb;
//enum ATTRBRACKET iqb;
if (lfhasflag(lf, F_DEBUG)) db = B_TRUE;
// do we already have a target we are attacking?
target = gettargetlf(lf);
if (!target) return B_FALSE;
iqb = getattrbracket(getattr(lf, A_IQ), A_IQ, NULL);
//iqb = getattrbracket(getattr(lf, A_IQ), A_IQ, NULL);
if (db) dblog(".oO { i have a target: lfid %d (%s). }", target->id, target->race->name);
@ -1637,6 +1636,7 @@ int ai_housekeeping(lifeform_t *lf, lifeform_t *master) {
msgnocap("%c - %s", o->letter, obname);
}
// no longer an ally
if (db) { dblog(".oO { no longer an ally }"); }
killflagsofid(lf->flags, F_FRIENDLY);
killflagsofid(lf->flags, F_PETOF);
killflagsofid(lf->flags, F_ISPRISONER);
@ -1708,7 +1708,7 @@ int ai_inventory_mgt(lifeform_t *lf, int *canattack) {
object_t *curwep = NULL,*bestwep = NULL, *o = NULL;
object_t *curgun = NULL,*bestgun = NULL;
enum BODYPART bp;
int icanattack = B_FALSE;
//int icanattack = B_FALSE;
enum ATTRBRACKET iqb;
iqb = getattrbracket(getattr(lf, A_IQ), A_IQ, NULL);
@ -1819,7 +1819,6 @@ int ai_inventory_mgt(lifeform_t *lf, int *canattack) {
// now check whetehr we have ANY weapon
if (curwep || lfhasflag(lf, F_HASATTACK)) {
icanattack = B_TRUE;
if (canattack) *canattack = B_TRUE;
}
@ -1840,9 +1839,9 @@ int ai_inventory_mgt(lifeform_t *lf, int *canattack) {
int ai_movement(lifeform_t *lf) {
int valid = B_TRUE;
cell_t *c;
int db = B_FALSE;
//int db = B_FALSE;
flag_t *f = NULL;
if (lfhasflag(lf, F_DEBUG)) db = B_TRUE;
//if (lfhasflag(lf, F_DEBUG)) db = B_TRUE;
if (lfhasflagval(lf, F_DOESNTMOVE, NA, NA, B_TRUE, NULL)) return B_FALSE;
if (isimmobile(lf)) return B_FALSE;
@ -3051,12 +3050,11 @@ int aispellok(lifeform_t *lf, enum OBTYPE spellid, lifeform_t *victim, enum FLAG
}
}
} else if (ot->id == OT_S_TELEKINESIS) {
int i,nposs;
int i;
float maxweight;
maxweight = getlfweight(lf, B_NOOBS) +
(getlfweight(lf, B_NOOBS) * (getstatmod(lf, A_IQ) / 100));
nposs = 0;
for (i = 0; i < lf->nlos; i++) {
if (lf->los[i] != lf->cell) {
object_t *o;

View File

@ -68,13 +68,14 @@ int applyarmourdamage(lifeform_t *lf, object_t *wep, int dam, enum DAMTYPE damty
if (armour) {
int actualdam;
int ar = 0;
flag_t *rust, *f;
//int ar = 0;
flag_t *rust;
/*
f = hasflag(armour->flags, F_ARMOURRATING);
if (f) {
ar = f->val[0];
}
*/
rust = hasflag(armour->flags, F_RUSTED);
@ -181,7 +182,6 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
void *attacktarget;
int attacklfid = -1;
int nweps = 0;
int innateattacks = 0;
int i;
int attacktime;
int gotweapon = B_FALSE;
@ -235,7 +235,7 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
) {
switch (getallegiance(c->lf)) {
case AL_PEACEFUL:
if (getlorelevel(lf, getraceclass(c->lf) >= PR_NOVICE) ||
if ((int)getlorelevel(lf, (int)getraceclass(c->lf) >= PR_NOVICE) ||
getskill(lf, SK_SPEECH)) { // need this to KNOW whether they're peaceful
snprintf(warnbuf, BUFLEN, "Really attack the peaceful %s?",noprefix(victimname));
}
@ -533,8 +533,6 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
validwep[i] = B_TRUE;
}
innateattacks = countinnateattacks(lf);
attacktime = getattackspeed(lf);
if (nweps <= 0) {
@ -750,6 +748,7 @@ int attackcell(lifeform_t *lf, cell_t *c, int force) {
// god or map effects...
if (isplayer(lf) && attacktarget) {
int angered = B_FALSE;
(void) angered;
if (attacktype == AT_LF) {
if (!isgod(attacktarget)) {
int h,m,s;
@ -1292,7 +1291,7 @@ int attacklf(lifeform_t *lf, lifeform_t *victim, object_t *wep, flag_t *damflag)
if (lfhasflag(lf, F_HOLYAURA) && isvulnto(victim->flags, DT_HOLY, B_FALSE)) {
damtype[i] = DT_HOLY;
}
sprintf(attackname, "%s%s attack", attackername, getpossessive(attackername));
snprintf(attackname, BUFLEN, "%s%s attack", attackername, getpossessive(attackername));
difficulty = 100 + (gettr(victim)*5) - (gettr(lf)*5);
if (check_for_block(lf, victim, dam[i], damtype[i], difficulty, attackname, isadjacent(lf->cell,victim->cell))) {
blocked = B_TRUE;
@ -2370,7 +2369,7 @@ void criticalhit(lifeform_t *lf, lifeform_t *victim, enum BODYPART hitpos, objec
losehydrahead(victim);
}
} else {
sprintf(dambuf, "a severed %s", bpname);
snprintf(dambuf, BUFLEN, "a severed %s", bpname);
losehp(victim, pctof(100/num, victim->maxhp), DT_DIRECT, lf, dambuf);
}

8
defs.h
View File

@ -451,10 +451,10 @@
enum KNOWNGLYPHTYPE {
KG_UNKNOWN = 0,
KG_MISC,
KG_DFEATURE, // dungeon feature object - door, terrain, etc
KG_STAIRS,
KG_OBJECT,
KG_MISC = 1,
KG_DFEATURE = 2, // dungeon feature object - door, terrain, etc
KG_STAIRS = 3,
KG_OBJECT = 4,
};
enum CELLADJUSTTYPE {

1346
god.c

File diff suppressed because it is too large Load Diff