forked from github/server
- Changed a couple of compiler-settings
- Removed a bunch of warnings (shadowing variables)
This commit is contained in:
parent
2557e013fa
commit
5d731316c3
13 changed files with 158 additions and 144 deletions
|
@ -68,9 +68,10 @@ CCFLAGS += -Wwrite-strings
|
||||||
-Wpointer-arith
|
-Wpointer-arith
|
||||||
# -Wshadow
|
# -Wshadow
|
||||||
# -Wcast-qual
|
# -Wcast-qual
|
||||||
# -Wcast-align
|
-Wcast-align
|
||||||
# -Wconversion
|
# -Wconversion
|
||||||
# -Wunreachable-code
|
# -Wunreachable-code
|
||||||
|
-Werror
|
||||||
;
|
;
|
||||||
|
|
||||||
# this require the latet luabind from CVS
|
# this require the latet luabind from CVS
|
||||||
|
@ -139,8 +140,8 @@ rule TargetDirectory
|
||||||
LOCATE_TARGET = $(ALL_LOCATE_TARGET) $(path) ;
|
LOCATE_TARGET = $(ALL_LOCATE_TARGET) $(path) ;
|
||||||
SOURCE_GRIST = $(path) ;
|
SOURCE_GRIST = $(path) ;
|
||||||
if $(DEBUG) = 1 {
|
if $(DEBUG) = 1 {
|
||||||
SubDirCcFlags -ggdb ;
|
SubDirCcFlags -ggdb -DDEBUG=1 ;
|
||||||
SubDirC++Flags -ggdb ;
|
SubDirC++Flags -ggdb -DDEBUG=1 ;
|
||||||
OPTIM = -O0 ;
|
OPTIM = -O0 ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -41,19 +41,19 @@ use_skillpotion(struct unit * u, const struct item_type * itype, int amount, str
|
||||||
* currently saved, it doesn't look likely (can't make eressea::list
|
* currently saved, it doesn't look likely (can't make eressea::list
|
||||||
* from them)
|
* from them)
|
||||||
*/
|
*/
|
||||||
int i;
|
int n;
|
||||||
for (i=0;i!=amount;++i) {
|
for (n=0;n!=amount;++n) {
|
||||||
skill * sv = u->skills;
|
skill * sv = u->skills;
|
||||||
while (sv!=u->skills+u->skill_size) {
|
while (sv!=u->skills+u->skill_size) {
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i!=3;++i) learn_skill(u, sv->id, 1.0);
|
for (i=0;i!=3;++i) learn_skill(u, sv->id, 1.0);
|
||||||
++sv;
|
++sv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ADDMSG(&u->faction->msgs, msg_message("skillpotion_use", "unit", u));
|
ADDMSG(&u->faction->msgs, msg_message("skillpotion_use", "unit", u));
|
||||||
|
|
||||||
res_changeitem(u, itype->rtype, -amount);
|
res_changeitem(u, itype->rtype, -amount);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -73,36 +73,36 @@ const attrib_type at_kick = { "kick",
|
||||||
static attrib *
|
static attrib *
|
||||||
make_kick(void)
|
make_kick(void)
|
||||||
{
|
{
|
||||||
return a_new(&at_kick);
|
return a_new(&at_kick);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
add_kick(attrib * a, const faction * f)
|
add_kick(attrib * a, faction * f)
|
||||||
{
|
{
|
||||||
faction_list * flist = (faction_list*)a->data.v;
|
faction_list * flist = (faction_list*)a->data.v;
|
||||||
while (flist && flist->data!=f) flist = flist->next;
|
while (flist && flist->data!=f) flist = flist->next;
|
||||||
if (flist) return;
|
if (flist) return;
|
||||||
flist = calloc(1, sizeof(faction_list));
|
flist = calloc(1, sizeof(faction_list));
|
||||||
flist->data = (void*)f;
|
flist->data = (void*)f;
|
||||||
flist->next = (faction_list*)a->data.v;
|
flist->next = (faction_list*)a->data.v;
|
||||||
a->data.v = flist;
|
a->data.v = flist;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
alliance_kick(const tnode * tnext, void * data, struct order * ord)
|
alliance_kick(const tnode * tnext, void * data, struct order * ord)
|
||||||
{
|
{
|
||||||
unit * u = (unit*)data;
|
unit * u = (unit*)data;
|
||||||
faction * f = findfaction(getid());
|
faction * f = findfaction(getid());
|
||||||
attrib * a;
|
attrib * a;
|
||||||
unused(tnext);
|
unused(tnext);
|
||||||
|
|
||||||
if (f==NULL || f->alliance!=u->faction->alliance) {
|
if (f==NULL || f->alliance!=u->faction->alliance) {
|
||||||
/* does not belong to our alliance */
|
/* does not belong to our alliance */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a = a_find(f->attribs, &at_kick);
|
a = a_find(f->attribs, &at_kick);
|
||||||
if (a==NULL) a = a_add(&f->attribs, make_kick());
|
if (a==NULL) a = a_add(&f->attribs, make_kick());
|
||||||
add_kick(a, f);
|
add_kick(a, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -25,26 +25,19 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* this should always be the first thing included after config.h */
|
||||||
* Features enabled:
|
|
||||||
* If you are lacking the settings.h, create a new file common/settings.h,
|
|
||||||
* and write #include <settings-eressea.h> (or whatever settings you want
|
|
||||||
* your game to use) in there.
|
|
||||||
* !!! DO NOT COMMIT THE SETTINGS.H FILE TO CVS !!!
|
|
||||||
*/
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define ALLIED(f1, f2) (f1==f2 || (f1->alliance && f1->alliance==f2->alliance))
|
/* experimental gameplay features (that don't affect the savefile) */
|
||||||
|
/* TODO: move these settings to settings.h or into configuration files */
|
||||||
/* experimental gameplay features (that don't affect the savefile) */
|
|
||||||
#define GOBLINKILL /* Goblin-Spezialklau kann tödlich enden */
|
#define GOBLINKILL /* Goblin-Spezialklau kann tödlich enden */
|
||||||
#define HERBS_ROT /* herbs owned by units have a chance to rot. */
|
#define HERBS_ROT /* herbs owned by units have a chance to rot. */
|
||||||
#define SHIPDAMAGE /* Schiffsbeschädigungen */
|
#define SHIPDAMAGE /* Schiffsbeschädigungen */
|
||||||
#define INSECT_POTION /* Spezialtrank für Insekten */
|
#define INSECT_POTION /* Spezialtrank für Insekten */
|
||||||
#define ORCIFICATION /* giving snotlings to the peasants gets counted */
|
#define ORCIFICATION /* giving snotlings to the peasants gets counted */
|
||||||
#undef TROLLSAVE /* saving throw for dead trolls */
|
#undef TROLLSAVE /* saving throw for dead trolls */
|
||||||
|
|
||||||
#include <settings.h>
|
#define ALLIED(f1, f2) (f1==f2 || (f1->alliance && f1->alliance==f2->alliance))
|
||||||
|
|
||||||
#ifndef MAXREGIONS
|
#ifndef MAXREGIONS
|
||||||
# define MAXREGIONS 262139 /* must be prime for hashing. 262139=last<2^18 */
|
# define MAXREGIONS 262139 /* must be prime for hashing. 262139=last<2^18 */
|
||||||
|
|
|
@ -21,6 +21,15 @@
|
||||||
#ifndef ERESSEA_TYPES_H
|
#ifndef ERESSEA_TYPES_H
|
||||||
#define ERESSEA_TYPES_H
|
#define ERESSEA_TYPES_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Features enabled:
|
||||||
|
* If you are lacking the settings.h, create a new file common/settings.h,
|
||||||
|
* and write #include <settings-eressea.h> (or whatever settings you want
|
||||||
|
* your game to use) in there.
|
||||||
|
* !!! DO NOT COMMIT THE SETTINGS.H FILE TO CVS !!!
|
||||||
|
* settings.h should always be the first thing you include (after config.h).
|
||||||
|
*/
|
||||||
|
#include <settings.h>
|
||||||
#include <util/variant.h>
|
#include <util/variant.h>
|
||||||
|
|
||||||
typedef short terrain_t;
|
typedef short terrain_t;
|
||||||
|
|
|
@ -78,22 +78,22 @@ static region * tower_region[6];
|
||||||
static region * start_region[6];
|
static region * start_region[6];
|
||||||
|
|
||||||
static region *
|
static region *
|
||||||
arena_region(int magic)
|
arena_region(int school)
|
||||||
{
|
{
|
||||||
return tower_region[magic];
|
return tower_region[school];
|
||||||
}
|
}
|
||||||
|
|
||||||
static building *
|
static building *
|
||||||
arena_tower(int magic)
|
arena_tower(int school)
|
||||||
{
|
{
|
||||||
return arena_region(magic)->buildings;
|
return arena_region(school)->buildings;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
leave_fail(unit * u)
|
leave_fail(unit * u)
|
||||||
{
|
{
|
||||||
ADDMSG(&u->faction->msgs, msg_message("arena_leave_fail", "unit", u));
|
ADDMSG(&u->faction->msgs, msg_message("arena_leave_fail", "unit", u));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -167,25 +167,25 @@ enter_arena(unit * u, const item_type * itype, int amount, order * ord)
|
||||||
static int
|
static int
|
||||||
use_wand_of_tears(unit * user, const struct item_type * itype, int amount, order * ord)
|
use_wand_of_tears(unit * user, const struct item_type * itype, int amount, order * ord)
|
||||||
{
|
{
|
||||||
int i;
|
int n;
|
||||||
unused(ord);
|
unused(ord);
|
||||||
for (i=0;i!=amount;++i) {
|
for (n=0;n!=amount;++n) {
|
||||||
unit * u;
|
unit * u;
|
||||||
for (u=user->region->units;u;u=u->next) {
|
for (u=user->region->units;u;u=u->next) {
|
||||||
if (u->faction != user->faction) {
|
if (u->faction != user->faction) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0;i!=u->skill_size;++i) {
|
for (i=0;i!=u->skill_size;++i) {
|
||||||
if (rng_int()%3) reduce_skill(u, u->skills+i, 1);
|
if (rng_int()%3) reduce_skill(u, u->skills+i, 1);
|
||||||
}
|
}
|
||||||
ADDMSG(&u->faction->msgs, msg_message("wand_of_tears_effect",
|
ADDMSG(&u->faction->msgs, msg_message("wand_of_tears_effect",
|
||||||
"unit", u));
|
"unit", u));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ADDMSG(&user->region->msgs, msg_message("wand_of_tears_usage",
|
ADDMSG(&user->region->msgs, msg_message("wand_of_tears_usage",
|
||||||
"unit", user));
|
"unit", user));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -104,7 +104,7 @@ f_nolux(const region * r)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fix_demand(region *r)
|
fix_demand(region *rd)
|
||||||
{
|
{
|
||||||
region_list *rl, *rlist = NULL;
|
region_list *rl, *rlist = NULL;
|
||||||
static const struct luxury_type **mlux = 0, ** ltypes;
|
static const struct luxury_type **mlux = 0, ** ltypes;
|
||||||
|
@ -113,7 +113,7 @@ fix_demand(region *r)
|
||||||
int maxluxuries = get_maxluxuries();
|
int maxluxuries = get_maxluxuries();
|
||||||
|
|
||||||
if (maxluxuries==0) return 0;
|
if (maxluxuries==0) return 0;
|
||||||
recurse_regions(r, &rlist, f_nolux);
|
recurse_regions(rd, &rlist, f_nolux);
|
||||||
if (mlux==0) {
|
if (mlux==0) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
mlux = (const luxury_type **)gc_add(calloc(maxluxuries, sizeof(const luxury_type *)));
|
mlux = (const luxury_type **)gc_add(calloc(maxluxuries, sizeof(const luxury_type *)));
|
||||||
|
|
|
@ -281,16 +281,16 @@ gm_teleport(const tnode * tnext, void * data, struct order * ord)
|
||||||
static void
|
static void
|
||||||
gm_messageplane(const tnode * tnext, void * data, struct order * ord)
|
gm_messageplane(const tnode * tnext, void * data, struct order * ord)
|
||||||
{
|
{
|
||||||
unit * u = (unit*)data;
|
unit * gm = (unit*)data;
|
||||||
const struct plane * p = rplane(u->region);
|
const struct plane * p = rplane(gm->region);
|
||||||
const char * zmsg = getstrtoken();
|
const char * zmsg = getstrtoken();
|
||||||
if (p==NULL) {
|
if (p==NULL) {
|
||||||
mistake(u, ord, "In diese Ebene kann keine Nachricht gesandt werden.");
|
mistake(gm, ord, "In diese Ebene kann keine Nachricht gesandt werden.");
|
||||||
} else {
|
} else {
|
||||||
/* checking permissions */
|
/* checking permissions */
|
||||||
attrib * permissions = a_find(u->faction->attribs, &at_permissions);
|
attrib * permissions = a_find(gm->faction->attribs, &at_permissions);
|
||||||
if (!permissions || !has_permission(permissions, atoi36("gmmsgr"))) {
|
if (!permissions || !has_permission(permissions, atoi36("gmmsgr"))) {
|
||||||
mistake(u, ord, "permission denied.");
|
mistake(gm, ord, "permission denied.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
message * msg = msg_message("msg_event", "string", zmsg);
|
message * msg = msg_message("msg_event", "string", zmsg);
|
||||||
|
@ -316,14 +316,14 @@ gm_messageplane(const tnode * tnext, void * data, struct order * ord)
|
||||||
static void
|
static void
|
||||||
gm_messagefaction(const tnode * tnext, void * data, struct order * ord)
|
gm_messagefaction(const tnode * tnext, void * data, struct order * ord)
|
||||||
{
|
{
|
||||||
unit * u = (unit*)data;
|
unit * gm = (unit*)data;
|
||||||
int n = getid();
|
int n = getid();
|
||||||
faction * f = findfaction(n);
|
faction * f = findfaction(n);
|
||||||
const char * msg = getstrtoken();
|
const char * msg = getstrtoken();
|
||||||
plane * p = rplane(u->region);
|
plane * p = rplane(gm->region);
|
||||||
attrib * permissions = a_find(u->faction->attribs, &at_permissions);
|
attrib * permissions = a_find(gm->faction->attribs, &at_permissions);
|
||||||
if (!permissions || !has_permission(permissions, atoi36("gmmsgr"))) {
|
if (!permissions || !has_permission(permissions, atoi36("gmmsgr"))) {
|
||||||
mistake(u, ord, "permission denied.");
|
mistake(gm, ord, "permission denied.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (f!=NULL) {
|
if (f!=NULL) {
|
||||||
|
@ -336,7 +336,7 @@ gm_messagefaction(const tnode * tnext, void * data, struct order * ord)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mistake(u, ord, "cannot send messages to this faction.");
|
mistake(gm, ord, "cannot send messages to this faction.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -705,12 +705,12 @@ gm_addfaction(const char * email, plane * p, region * r)
|
||||||
f->options = want(O_COMPRESS) | want(O_REPORT) | want(O_COMPUTER) | want(O_ADRESSEN);
|
f->options = want(O_COMPRESS) | want(O_REPORT) | want(O_COMPUTER) | want(O_ADRESSEN);
|
||||||
{
|
{
|
||||||
faction * xist;
|
faction * xist;
|
||||||
int i = atoi36("gm00")-1;
|
int id = atoi36("gm00")-1;
|
||||||
do {
|
do {
|
||||||
xist = findfaction(++i);
|
xist = findfaction(++id);
|
||||||
} while (xist);
|
} while (xist);
|
||||||
|
|
||||||
f->no = i;
|
f->no = id;
|
||||||
addlist(&factions, f);
|
addlist(&factions, f);
|
||||||
fhash(f);
|
fhash(f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,11 +67,11 @@ score(void)
|
||||||
{
|
{
|
||||||
FILE *scoreFP;
|
FILE *scoreFP;
|
||||||
region *r;
|
region *r;
|
||||||
faction *f;
|
faction *fc;
|
||||||
int allscores = 0;
|
int allscores = 0;
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
for (f = factions; f; f = f->next) f->score = 0;
|
for (fc = factions; fc; fc = fc->next) fc->score = 0;
|
||||||
|
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
unit * u;
|
unit * u;
|
||||||
|
@ -108,9 +108,9 @@ score(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (s = r->ships; s; s = s->next) {
|
for (s = r->ships; s; s = s->next) {
|
||||||
unit * u = shipowner(s);
|
unit * cap = shipowner(s);
|
||||||
if (u && u->faction) {
|
if (cap && cap->faction) {
|
||||||
u->faction->score += s->size * 2;
|
cap->faction->score += s->size * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
|
@ -154,10 +154,10 @@ score(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (f = factions; f; f = f->next) {
|
for (fc = factions; fc; fc = fc->next) {
|
||||||
f->score = f->score / 5;
|
fc->score = fc->score / 5;
|
||||||
if (f->no != MONSTER_FACTION && f->race != new_race[RC_TEMPLATE]) {
|
if (fc->no != MONSTER_FACTION && fc->race != new_race[RC_TEMPLATE]) {
|
||||||
allscores += f->score;
|
allscores += fc->score;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (allscores == 0) {
|
if (allscores == 0) {
|
||||||
|
@ -168,6 +168,7 @@ score(void)
|
||||||
scoreFP = fopen(path, "w");
|
scoreFP = fopen(path, "w");
|
||||||
if (scoreFP) {
|
if (scoreFP) {
|
||||||
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf };
|
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf };
|
||||||
|
faction * f;
|
||||||
fwrite(utf8_bom, 1, 3, scoreFP);
|
fwrite(utf8_bom, 1, 3, scoreFP);
|
||||||
for (f = factions; f; f = f->next) if (f->num_total != 0) {
|
for (f = factions; f; f = f->next) if (f->num_total != 0) {
|
||||||
fprintf(scoreFP, "%8d (%8d/%4.2f%%/%5.2f) %30.30s (%3.3s) %5s (%3d)\n",
|
fprintf(scoreFP, "%8d (%8d/%4.2f%%/%5.2f) %30.30s (%3.3s) %5s (%3d)\n",
|
||||||
|
@ -193,6 +194,7 @@ score(void)
|
||||||
for (a = alliances; a; a = a->next) {
|
for (a = alliances; a; a = a->next) {
|
||||||
int alliance_score = 0, alliance_number = 0, alliance_factions = 0;
|
int alliance_score = 0, alliance_number = 0, alliance_factions = 0;
|
||||||
int grails = 0;
|
int grails = 0;
|
||||||
|
faction * f;
|
||||||
|
|
||||||
for (f = factions; f; f = f->next) {
|
for (f = factions; f; f = f->next) {
|
||||||
if (f->alliance && f->alliance->id == a->id) {
|
if (f->alliance && f->alliance->id == a->id) {
|
||||||
|
|
|
@ -38,11 +38,20 @@
|
||||||
#define ROW_FACTOR 3 /* factor for combat row advancement rule */
|
#define ROW_FACTOR 3 /* factor for combat row advancement rule */
|
||||||
#define HEROES
|
#define HEROES
|
||||||
|
|
||||||
#define SCORE_MODULE
|
/* optional game components. TODO: These should either be
|
||||||
#undef MUSEUM_MODULE
|
* configuration variables (XML), script extensions (lua),
|
||||||
#undef ARENA_MODULE
|
* or both. We don't want separate binaries for different games
|
||||||
#undef WORMHOLE_MODULE
|
*/
|
||||||
#undef XECMD_MODULE
|
#define SCORE_MODULE 1
|
||||||
|
#define MUSEUM_MODULE 0
|
||||||
|
#define ARENA_MODULE 0
|
||||||
|
#define WORMHOLE_MODULE 0
|
||||||
|
#define XECMD_MODULE 0
|
||||||
|
#define KARMA_MODULE 0
|
||||||
|
#define DUNGEON_MODULE 0
|
||||||
|
#define INFOCMD_MODULE 0
|
||||||
|
#define CHANGED_CROSSBOWS 0 /* use the WTF_ARMORPIERCING flag */
|
||||||
|
#define GLOBAL_WARMING 0 /* number of turns before global warming sets in */
|
||||||
|
|
||||||
#define SIMPLE_COMBAT
|
#define SIMPLE_COMBAT
|
||||||
#define SIMPLE_ESCAPE
|
#define SIMPLE_ESCAPE
|
||||||
|
|
|
@ -2736,7 +2736,7 @@ static void do_check_malloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s;
|
||||||
display chunk addresses, sizes, bins, and other instrumentation.
|
display chunk addresses, sizes, bins, and other instrumentation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void do_check_malloc_state()
|
static void do_check_malloc_state(void)
|
||||||
{
|
{
|
||||||
mstate av = get_malloc_state();
|
mstate av = get_malloc_state();
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -753,18 +753,18 @@ handlekey(state * st, int c)
|
||||||
if (regions!=NULL) {
|
if (regions!=NULL) {
|
||||||
map_region * mr = cursor_region(&st->display, cursor);
|
map_region * mr = cursor_region(&st->display, cursor);
|
||||||
region * first = mr->r;
|
region * first = mr->r;
|
||||||
region * r = (first&&first->next)?first->next:regions;
|
region * cur = (first&&first->next)?first->next:regions;
|
||||||
while (r!=first) {
|
while (cur!=first) {
|
||||||
coordinate coord;
|
coordinate coord;
|
||||||
region2coord(r, &coord);
|
region2coord(cur, &coord);
|
||||||
if (tagged_region(st->selected, &coord)) {
|
if (tagged_region(st->selected, &coord)) {
|
||||||
st->cursor = coord;
|
st->cursor = coord;
|
||||||
st->wnd_info->update |= 1;
|
st->wnd_info->update |= 1;
|
||||||
st->wnd_status->update |= 1;
|
st->wnd_status->update |= 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
r = r->next;
|
cur = cur->next;
|
||||||
if (!r && first) r = regions;
|
if (!cur && first) cur = regions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -773,16 +773,16 @@ handlekey(state * st, int c)
|
||||||
if (regions!=NULL) {
|
if (regions!=NULL) {
|
||||||
map_region * mr = cursor_region(&st->display, cursor);
|
map_region * mr = cursor_region(&st->display, cursor);
|
||||||
if (mr->r) {
|
if (mr->r) {
|
||||||
region * r = mr->r;
|
region * cur = mr->r;
|
||||||
if (r->planep==NULL) {
|
if (cur->planep==NULL) {
|
||||||
r = r_standard_to_astral(r);
|
cur = r_standard_to_astral(cur);
|
||||||
} else if (r->planep==get_astralplane()) {
|
} else if (r->planep==get_astralplane()) {
|
||||||
r = r_astral_to_standard(r);
|
cur = r_astral_to_standard(cur);
|
||||||
} else {
|
} else {
|
||||||
r = NULL;
|
cur = NULL;
|
||||||
}
|
}
|
||||||
if (r!=NULL) {
|
if (cur!=NULL) {
|
||||||
region2coord(r, &st->cursor);
|
region2coord(cur, &st->cursor);
|
||||||
} else {
|
} else {
|
||||||
beep();
|
beep();
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,12 +183,12 @@ verify_owners(boolean bOnce)
|
||||||
|
|
||||||
/* make sure that this is done only once! */
|
/* make sure that this is done only once! */
|
||||||
static void
|
static void
|
||||||
do_once(const char * magic, int (*fptr)(void))
|
do_once(const char * magic_id, int (*fptr)(void))
|
||||||
{
|
{
|
||||||
attrib * a = find_key(global.attribs, atoi36(magic));
|
attrib * a = find_key(global.attribs, atoi36(magic_id));
|
||||||
if (!a) {
|
if (!a) {
|
||||||
log_warning(("[do_once] a unique fix %d=\"%s\" was applied.\n", atoi36(magic), magic));
|
log_warning(("[do_once] a unique fix %d=\"%s\" was applied.\n", atoi36(magic_id), magic_id));
|
||||||
if (fptr() == 0) a_add(&global.attribs, make_key(atoi36(magic)));
|
if (fptr() == 0) a_add(&global.attribs, make_key(atoi36(magic_id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ fix_undead(void)
|
||||||
skill * sa = get_skill(u, SK_HERBALISM);
|
skill * sa = get_skill(u, SK_HERBALISM);
|
||||||
|
|
||||||
if (sm && sa) {
|
if (sm && sa) {
|
||||||
int level = sm->level;
|
int lvl = sm->level;
|
||||||
attrib * a = a_find(u->attribs, &at_mage);
|
attrib * a = a_find(u->attribs, &at_mage);
|
||||||
if (a) {
|
if (a) {
|
||||||
a_remove(&u->attribs, a);
|
a_remove(&u->attribs, a);
|
||||||
|
@ -451,14 +451,14 @@ fix_undead(void)
|
||||||
u->skills = 0;
|
u->skills = 0;
|
||||||
u->skill_size = 0;
|
u->skill_size = 0;
|
||||||
|
|
||||||
log_warning(("fixing skills for %s %s, level %d.\n", u->race->_name[0], itoa36(u->no), level));
|
log_warning(("fixing skills for %s %s, level %d.\n", u->race->_name[0], itoa36(u->no), lvl));
|
||||||
|
|
||||||
if (level>0) {
|
if (lvl>0) {
|
||||||
const race * rc = u->race;
|
const race * rc = u->race;
|
||||||
skill_t sk;
|
skill_t sk;
|
||||||
for (sk=0;sk!=MAXSKILLS;++sk) {
|
for (sk=0;sk!=MAXSKILLS;++sk) {
|
||||||
if (rc->bonus[sk]>0) {
|
if (rc->bonus[sk]>0) {
|
||||||
set_level(u, sk, level);
|
set_level(u, sk, lvl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -483,12 +483,12 @@ fix_gates(void)
|
||||||
while (t && t->type!= &tt_gate) t=t->next;
|
while (t && t->type!= &tt_gate) t=t->next;
|
||||||
if (t!=NULL) {
|
if (t!=NULL) {
|
||||||
gate_data * gd = (gate_data*)t->data.v;
|
gate_data * gd = (gate_data*)t->data.v;
|
||||||
struct building * b = gd->gate;
|
struct building * bgate = gd->gate;
|
||||||
struct region * rtarget = gd->target;
|
struct region * rtarget = gd->target;
|
||||||
if (r!=b->region) {
|
if (r!=bgate->region) {
|
||||||
add_trigger(&b->attribs, "timer", trigger_gate(b, rtarget));
|
add_trigger(&bgate->attribs, "timer", trigger_gate(bgate, rtarget));
|
||||||
add_trigger(&b->attribs, "create", trigger_unguard(b));
|
add_trigger(&bgate->attribs, "create", trigger_unguard(bgate));
|
||||||
fset(b, BLD_UNGUARDED);
|
fset(bgate, BLD_UNGUARDED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
remove_triggers(&u->attribs, "timer", &tt_gate);
|
remove_triggers(&u->attribs, "timer", &tt_gate);
|
||||||
|
@ -502,14 +502,14 @@ fix_gates(void)
|
||||||
while (t && t->type!= &tt_gate) t=t->next;
|
while (t && t->type!= &tt_gate) t=t->next;
|
||||||
if (t!=NULL) {
|
if (t!=NULL) {
|
||||||
gate_data * gd = (gate_data*)t->data.v;
|
gate_data * gd = (gate_data*)t->data.v;
|
||||||
struct building * b = gd->gate;
|
struct building * bgate = gd->gate;
|
||||||
struct region * rtarget = gd->target;
|
struct region * rtarget = gd->target;
|
||||||
remove_triggers(&b->attribs, "timer", &tt_gate);
|
remove_triggers(&bgate->attribs, "timer", &tt_gate);
|
||||||
remove_triggers(&b->attribs, "create", &tt_unguard);
|
remove_triggers(&bgate->attribs, "create", &tt_unguard);
|
||||||
if (r!=b->region) {
|
if (r!=bgate->region) {
|
||||||
add_trigger(&b->attribs, "timer", trigger_gate(b, rtarget));
|
add_trigger(&bgate->attribs, "timer", trigger_gate(bgate, rtarget));
|
||||||
add_trigger(&b->attribs, "create", trigger_unguard(b));
|
add_trigger(&bgate->attribs, "create", trigger_unguard(bgate));
|
||||||
fset(b, BLD_UNGUARDED);
|
fset(bgate, BLD_UNGUARDED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -654,7 +654,7 @@ static int
|
||||||
fix_astralplane(void)
|
fix_astralplane(void)
|
||||||
{
|
{
|
||||||
plane * astralplane = get_astralplane();
|
plane * astralplane = get_astralplane();
|
||||||
region * r;
|
region * rs;
|
||||||
region_list * rlist = NULL;
|
region_list * rlist = NULL;
|
||||||
faction * monsters = findfaction(MONSTER_FACTION);
|
faction * monsters = findfaction(MONSTER_FACTION);
|
||||||
|
|
||||||
|
@ -664,15 +664,15 @@ fix_astralplane(void)
|
||||||
freset(astralplane, PFL_NOFEED);
|
freset(astralplane, PFL_NOFEED);
|
||||||
set_ursprung(monsters, astralplane->id, 0, 0);
|
set_ursprung(monsters, astralplane->id, 0, 0);
|
||||||
|
|
||||||
for (r=regions;r;r=r->next) if (rplane(r)==astralplane) {
|
for (rs=regions;rs;rs=rs->next) if (rplane(rs)==astralplane) {
|
||||||
region * ra = r_standard_to_astral(r);
|
region * ra = r_standard_to_astral(rs);
|
||||||
if (ra==NULL) continue;
|
if (ra==NULL) continue;
|
||||||
if (rterrain(r)!=T_FIREWALL) continue;
|
if (rterrain(rs)!=T_FIREWALL) continue;
|
||||||
if (rterrain(ra)==T_ASTRALB) continue;
|
if (rterrain(ra)==T_ASTRALB) continue;
|
||||||
if (ra->units!=NULL) {
|
if (ra->units!=NULL) {
|
||||||
add_regionlist(&rlist, ra);
|
add_regionlist(&rlist, ra);
|
||||||
}
|
}
|
||||||
log_printf("protecting firewall in %s by blocking astral space in %s.\n", regionname(r, NULL), regionname(ra, NULL));
|
log_printf("protecting firewall in %s by blocking astral space in %s.\n", regionname(rs, NULL), regionname(ra, NULL));
|
||||||
terraform(ra, T_ASTRALB);
|
terraform(ra, T_ASTRALB);
|
||||||
}
|
}
|
||||||
while (rlist!=NULL) {
|
while (rlist!=NULL) {
|
||||||
|
@ -718,11 +718,11 @@ fix_road_borders(void)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (incomplete_data) return;
|
if (incomplete_data) return;
|
||||||
for(hash=0; hash<BMAXHASH && i!=MAXDEL; hash++) {
|
for (hash=0; hash<BMAXHASH && i!=MAXDEL; hash++) {
|
||||||
border * bhash;
|
border * blist;
|
||||||
for (bhash=borders[hash];bhash && i!=MAXDEL;bhash=bhash->nexthash) {
|
for (blist=borders[hash];blist && i!=MAXDEL;blist=blist->nexthash) {
|
||||||
border * b;
|
border * b;
|
||||||
for (b=bhash;b && i!=MAXDEL;b=b->next) {
|
for (b=blist;b && i!=MAXDEL;b=b->next) {
|
||||||
if (b->type == &bt_road) {
|
if (b->type == &bt_road) {
|
||||||
short x1, x2, y1, y2;
|
short x1, x2, y1, y2;
|
||||||
region *r1, *r2;
|
region *r1, *r2;
|
||||||
|
|
Loading…
Reference in a new issue