diff --git a/src/attributes/moved.c b/src/attributes/moved.c index d73b3e541..6ddad1b17 100644 --- a/src/attributes/moved.c +++ b/src/attributes/moved.c @@ -48,7 +48,7 @@ attrib_type at_moved = { "moved", NULL, NULL, age_moved, write_moved, read_moved }; -boolean get_moved(attrib ** alist) +bool get_moved(attrib ** alist) { return a_find(*alist, &at_moved) ? true : false; } diff --git a/src/attributes/moved.h b/src/attributes/moved.h index cce9fe941..bad4dcdd5 100644 --- a/src/attributes/moved.h +++ b/src/attributes/moved.h @@ -25,7 +25,7 @@ extern "C" { struct attrib; struct attrib_type; - extern boolean get_moved(struct attrib **alist); + extern bool get_moved(struct attrib **alist); extern void set_moved(struct attrib **alist); extern struct attrib_type at_moved; diff --git a/src/attributes/movement.c b/src/attributes/movement.c index 8e2515854..1f3bf51c0 100644 --- a/src/attributes/movement.c +++ b/src/attributes/movement.c @@ -42,7 +42,7 @@ attrib_type at_movement = { "movement", NULL, NULL, NULL, write_movement, read_movement }; -boolean get_movement(attrib * const *alist, int type) +bool get_movement(attrib * const *alist, int type) { const attrib *a = a_findc(*alist, &at_movement); if (a == NULL) diff --git a/src/attributes/movement.h b/src/attributes/movement.h index b976a67ec..0fe4cfc83 100644 --- a/src/attributes/movement.h +++ b/src/attributes/movement.h @@ -22,7 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. extern "C" { #endif - extern boolean get_movement(struct attrib *const *alist, int type); + extern bool get_movement(struct attrib *const *alist, int type); extern void set_movement(struct attrib **alist, int type); extern struct attrib_type at_movement; diff --git a/src/bindings/bind_sqlite.c b/src/bindings/bind_sqlite.c index be1eacec7..0df9e530f 100644 --- a/src/bindings/bind_sqlite.c +++ b/src/bindings/bind_sqlite.c @@ -21,7 +21,7 @@ without prior permission by the authors of Eressea. #define LTYPE_DB TOLUA_CAST "db" -extern int db_update_factions(sqlite3 * db, boolean force); +extern int db_update_factions(sqlite3 * db, bool force); static int tolua_db_update_factions(lua_State * L) { sqlite3 *db = (sqlite3 *) tolua_tousertype(L, 1, 0); @@ -29,7 +29,7 @@ static int tolua_db_update_factions(lua_State * L) return 0; } -extern int db_update_scores(sqlite3 * db, boolean force); +extern int db_update_scores(sqlite3 * db, bool force); static int tolua_db_update_scores(lua_State * L) { sqlite3 *db = (sqlite3 *) tolua_tousertype(L, 1, 0); diff --git a/src/bindings/helpers.c b/src/bindings/helpers.c index f2fbae090..d6d73d7b2 100644 --- a/src/bindings/helpers.c +++ b/src/bindings/helpers.c @@ -342,10 +342,10 @@ static int lua_getresource(unit * u, const struct resource_type *rtype) return result; } -static boolean lua_canuse_item(const unit * u, const struct item_type *itype) +static bool lua_canuse_item(const unit * u, const struct item_type *itype) { static int function_exists = 1; - boolean result = true; + bool result = true; if (function_exists) { lua_State *L = (lua_State *) global.vm_state; diff --git a/src/gamecode/archetype.h b/src/gamecode/archetype.h index 963acd286..55c6896cc 100644 --- a/src/gamecode/archetype.h +++ b/src/gamecode/archetype.h @@ -18,7 +18,7 @@ extern "C" { #endif typedef struct rule { - boolean allow; + bool allow; char *property; char *value; } rule; diff --git a/src/gamecode/creport.c b/src/gamecode/creport.c index 3f7d4fe1d..0a4768097 100644 --- a/src/gamecode/creport.c +++ b/src/gamecode/creport.c @@ -80,7 +80,7 @@ without prior permission by the authors of Eressea. /* imports */ extern int verbosity; -boolean opt_cr_absolute_coords = false; +bool opt_cr_absolute_coords = false; /* globals */ #define C_REPORT_VERSION 66 @@ -177,7 +177,7 @@ static void print_items(FILE * F, item * items, const struct locale *lang) static void cr_output_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ) { - boolean header = false; + bool header = false; attrib *a = NULL; int self = 0; region *r; @@ -508,7 +508,7 @@ static void render_messages(FILE * F, faction * f, message_list * msgs) struct mlist *m = msgs->begin; while (m) { char crbuffer[BUFFERSIZE]; /* gross, wegen spionage-messages :-( */ - boolean printed = false; + bool printed = false; const struct message_type *mtype = m->msg->type; unsigned int hash = mtype->key; #ifdef RENDER_CRMESSAGES @@ -637,7 +637,7 @@ cr_output_ship(FILE * F, const ship * sh, const unit * u, int fcaptain, static void fwriteorder(FILE * F, const struct order *ord, const struct locale *lang, - boolean escape) + bool escape) { char ebuf[1024]; char obuf[1024]; @@ -690,9 +690,9 @@ static void cr_output_unit(FILE * F, const region * r, const faction * f, const char *pzTmp; skill *sv; const attrib *a_fshidden = NULL; - boolean itemcloak = false; + bool itemcloak = false; static const curse_type *itemcloak_ct = 0; - static boolean init = false; + static bool init = false; item result[MAX_INVENTORY]; if (fval(u->race, RCF_INVISIBLE)) @@ -1096,7 +1096,7 @@ cr_borders(seen_region ** seen, const region * r, const faction * f, } b = get_borders(r, r2); while (b) { - boolean cs = b->type->fvisible(b, f, r); + bool cs = b->type->fvisible(b, f, r); if (!cs) { cs = b->type->rvisible(b, r); @@ -1352,7 +1352,7 @@ static void cr_output_region(FILE * F, report_context * ctx, seen_region * sr) /* describe both passed and inhabited regions */ show_active_spells(r); if (fval(r, RF_TRAVELUNIT)) { - boolean seeunits = false, seeships = false; + bool seeunits = false, seeships = false; const attrib *ru; /* show units pulled through region */ for (ru = a_find(r->attribs, &at_travelunit); diff --git a/src/gamecode/economy.c b/src/gamecode/economy.c index cd47f880a..6668c3a21 100644 --- a/src/gamecode/economy.c +++ b/src/gamecode/economy.c @@ -89,7 +89,7 @@ typedef struct request { int qty; int no; union { - boolean goblin; /* stealing */ + bool goblin; /* stealing */ const struct luxury_type *ltype; /* trading */ } type; } request; @@ -392,7 +392,7 @@ static void feedback_give_not_allowed(unit * u, order * ord) "")); } -static boolean check_give(unit * u, unit * u2, const item_type * itype, +static bool check_give(unit * u, unit * u2, const item_type * itype, int mask) { if (u2) { @@ -537,7 +537,7 @@ static void recruit(unit * u, struct order *ord, request ** recruitorders) get_gamedate(turn, &date); if (date.season == 0 && r->terrain != newterrain(T_DESERT)) { #ifdef INSECT_POTION - boolean usepotion = false; + bool usepotion = false; unit *u2; for (u2 = r->units; u2; u2 = u2->next) @@ -769,7 +769,7 @@ static void give_cmd(unit * u, order * ord) } else if (p == P_HERBS) { - boolean given = false; + bool given = false; if (!(u->race->ec_flags & GIVEITEM) && u2 != NULL) { ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "race_nogive", "race", u->race)); @@ -996,12 +996,12 @@ void add_spende(faction * f1, faction * f2, int amount, region * r) r->donations = sp; } -static boolean maintain(building * b, boolean first) +static bool maintain(building * b, bool first) /* first==false -> take money from wherever you can */ { int c; region *r = b->region; - boolean paid = true, work = first; + bool paid = true, work = first; unit *u; if (fval(b, BLD_MAINTAINED) || b->type == NULL || b->type->maintenance == NULL || is_cursed(b->attribs, C_NOCOST, 0)) { @@ -1111,12 +1111,12 @@ static boolean maintain(building * b, boolean first) return true; } -void maintain_buildings(region * r, boolean crash) +void maintain_buildings(region * r, bool crash) { building **bp = &r->buildings; while (*bp) { building *b = *bp; - boolean maintained = maintain(b, !crash); + bool maintained = maintain(b, !crash); /* the second time, send a message */ if (crash) { @@ -1141,7 +1141,7 @@ void maintain_buildings(region * r, boolean crash) static int recruit_archetype(unit * u, order * ord) { - boolean merge = (u->number > 0); + bool merge = (u->number > 0); int want; const char *s; @@ -1178,7 +1178,7 @@ static int recruit_archetype(unit * u, order * ord) */ int k; for (k = 0; arch->rules[k].property; ++k) { - boolean match = false; + bool match = false; if (arch->rules[k].value[0] == '*') match = true; else if (strcmp(arch->rules[k].property, "race") == 0) { @@ -1296,7 +1296,7 @@ void economics(region * r) for (u = r->units; u; u = u->next) { order *ord; - boolean destroyed = false; + bool destroyed = false; if (u->number > 0) { for (ord = u->orders; ord; ord = ord->next) { keyword_t kwd = get_keyword(ord); @@ -1421,7 +1421,7 @@ typedef struct allocation_list { static allocation_list *allocations; -static boolean can_guard(const unit * guard, const unit * u) +static bool can_guard(const unit * guard, const unit * u) { if (fval(guard, UFL_ISNEW)) return false; @@ -1612,7 +1612,7 @@ leveled_allocation(const resource_type * rtype, region * r, allocation * alist) const item_type *itype = resource2item(rtype); rawmaterial *rm = rm_get(r, rtype); int need; - boolean first = true; + bool first = true; if (rm != NULL) { do { @@ -2373,9 +2373,9 @@ static void expandselling(region * r, request * sellorders, int limit) } } -static boolean sell(unit * u, request ** sellorders, struct order *ord) +static bool sell(unit * u, request ** sellorders, struct order *ord) { - boolean unlimited = true; + bool unlimited = true; const item_type *itype; const luxury_type *ltype = NULL; int n; @@ -2904,7 +2904,7 @@ static int max_skill(region * r, faction * f, skill_t sk) static void steal_cmd(unit * u, struct order *ord, request ** stealorders) { int n, i, id; - boolean goblin = false; + bool goblin = false; request *o; unit *u2 = NULL; region *r = u->region; @@ -3342,7 +3342,7 @@ void produce(struct region *r) unit *u; int todo; static int rule_autowork = -1; - boolean limited = true; + bool limited = true; request *nextworker = workers; assert(r); @@ -3378,7 +3378,7 @@ void produce(struct region *r) for (u = r->units; u; u = u->next) { order *ord; - boolean trader = false; + bool trader = false; if (u->race == new_race[RC_SPELL] || fval(u, UFL_LONGACTION)) continue; diff --git a/src/gamecode/economy.h b/src/gamecode/economy.h index b5ccac86d..8b44df380 100644 --- a/src/gamecode/economy.h +++ b/src/gamecode/economy.h @@ -48,7 +48,7 @@ extern "C" { enum { IC_WORK, IC_ENTERTAIN, IC_TAX, IC_TRADE, IC_TRADETAX, IC_STEAL, IC_MAGIC }; - void maintain_buildings(struct region *r, boolean crash); + void maintain_buildings(struct region *r, bool crash); extern void add_spende(struct faction *f1, struct faction *f2, int betrag, struct region *r); extern int make_cmd(struct unit *u, struct order *ord); diff --git a/src/gamecode/give.c b/src/gamecode/give.c index b9254c7c2..9c259f2cf 100644 --- a/src/gamecode/give.c +++ b/src/gamecode/give.c @@ -87,7 +87,7 @@ add_give(unit * u, unit * u2, int given, int received, } } -static boolean limited_give(const item_type * type) +static bool limited_give(const item_type * type) { /* trade only money 2:1, if at all */ return (type == i_silver); @@ -288,7 +288,7 @@ void give_men(int n, unit * u, unit * u2, struct order *ord) if (u2) { if (u2->number != 0 && recruit_archetypes()) { /* must have same set of skills */ - boolean okay = false; + bool okay = false; if (u->skill_size == u2->skill_size) { int i; for (i = 0; i != u->skill_size; ++i) { diff --git a/src/gamecode/laws.c b/src/gamecode/laws.c index d2485fadc..3b332fec7 100755 --- a/src/gamecode/laws.c +++ b/src/gamecode/laws.c @@ -141,7 +141,7 @@ static void checkorders(void) ADDMSG(&f->msgs, msg_message("turnreminder", "")); } -static boolean help_money(const unit * u) +static bool help_money(const unit * u) { if (u->race->ec_flags & GIVEITEM) return true; @@ -1128,7 +1128,7 @@ int leave_cmd(unit * u, struct order *ord) return 0; } -static boolean EnhancedQuit(void) +static bool EnhancedQuit(void) { static int value = -1; if (value < 0) { @@ -1180,7 +1180,7 @@ int quit_cmd(unit * u, struct order *ord) return 0; } -static boolean mayenter(region * r, unit * u, building * b) +static bool mayenter(region * r, unit * u, building * b) { unit *u2; if (fval(b, BLD_UNGUARDED)) @@ -1201,7 +1201,7 @@ static int mayboard(const unit * u, ship * sh) return (!u2 || ucontact(u2, u) || alliedunit(u2, u->faction, HELP_GUARD)); } -static boolean CheckOverload(void) +static bool CheckOverload(void) { static int value = -1; if (value < 0) { @@ -1655,7 +1655,7 @@ static void init_prefixnames(void) int i; for (i = 0; localenames[i]; ++i) { const struct locale *lang = find_locale(localenames[i]); - boolean exist = false; + bool exist = false; struct local_names *in = pnames; while (in != NULL) { @@ -1839,7 +1839,7 @@ int display_cmd(unit * u, struct order *ord) return 0; } -boolean renamed_building(const building * b) +bool renamed_building(const building * b) { const struct locale *lang = locales; size_t len = strlen(b->name); @@ -1877,7 +1877,7 @@ int rename_building(unit * u, order * ord, building * b, const char *name) { unit *owner = b ? building_owner(b) : 0; - boolean foreign = !(owner && owner->faction == u->faction); + bool foreign = !(owner && owner->faction == u->faction); if (!b) { cmistake(u, ord, u->building ? 6 : 145, MSG_EVENT); @@ -1922,7 +1922,7 @@ int name_cmd(struct unit *u, struct order *ord) region *r = u->region; char **s = NULL; param_t p; - boolean foreign = false; + bool foreign = false; const char *str; init_tokens(ord); @@ -2196,7 +2196,7 @@ static int mail_cmd(unit * u, struct order *ord) case P_FACTION: { - boolean see = false; + bool see = false; n = getfactionid(); @@ -2223,7 +2223,7 @@ static int mail_cmd(unit * u, struct order *ord) case P_UNIT: { - boolean see = false; + bool see = false; n = getid(); for (u2 = r->units; u2; u2 = u2->next) { @@ -2374,7 +2374,7 @@ int password_cmd(unit * u, struct order *ord) char pwbuf[32]; int i; const char *s; - boolean pwok = true; + bool pwok = true; init_tokens(ord); skip_token(); @@ -2440,7 +2440,7 @@ int send_cmd(unit * u, struct order *ord) return 0; } -static boolean display_item(faction * f, unit * u, const item_type * itype) +static bool display_item(faction * f, unit * u, const item_type * itype) { const char *name; const char *key; @@ -2473,7 +2473,7 @@ static boolean display_item(faction * f, unit * u, const item_type * itype) return true; } -static boolean display_potion(faction * f, unit * u, const potion_type * ptype) +static bool display_potion(faction * f, unit * u, const potion_type * ptype) { attrib *a; @@ -2497,7 +2497,7 @@ static boolean display_potion(faction * f, unit * u, const potion_type * ptype) return true; } -static boolean display_race(faction * f, unit * u, const race * rc) +static bool display_race(faction * f, unit * u, const race * rc) { const char *name, *key; const char *info; @@ -3076,7 +3076,7 @@ void restack_units(void) region *r; for (r = regions; r; r = r->next) { unit **up = &r->units; - boolean sorted = false; + bool sorted = false; while (*up) { unit *u = *up; if (!fval(u, UFL_MARK)) { @@ -3271,7 +3271,7 @@ int renumber_cmd(unit * u, order * ord) static building *age_building(building * b) { - static boolean init = false; + static bool init = false; static const building_type *bt_blessed; static const curse_type *ct_astralblock; if (!init) { @@ -3657,8 +3657,8 @@ void check_long_orders(unit * u) void update_long_order(unit * u) { order *ord; - boolean trade = false; - boolean hunger = LongHunger(u); + bool trade = false; + bool hunger = LongHunger(u); freset(u, UFL_MOVED); freset(u, UFL_LONGACTION); @@ -3873,7 +3873,7 @@ static void defaultorders(void) for (r = regions; r; r = r->next) { unit *u; for (u = r->units; u; u = u->next) { - boolean neworders = false; + bool neworders = false; order **ordp = &u->orders; while (*ordp != NULL) { order *ord = *ordp; @@ -4316,7 +4316,7 @@ int siege_cmd(unit * u, order * ord) building *b; int d, pooled; int bewaffnete, katapultiere = 0; - static boolean init = false; + static bool init = false; static const curse_type *magicwalls_ct; static item_type *it_catapultammo = NULL; static item_type *it_catapult = NULL; @@ -4432,7 +4432,7 @@ static int warn_password(void) { faction *f = factions; while (f) { - boolean pwok = true; + bool pwok = true; const char *c = f->passw; while (*c && pwok) { if (!isalnum((unsigned char)*c)) diff --git a/src/gamecode/laws.h b/src/gamecode/laws.h index 0d4cbd614..3cc5882e5 100755 --- a/src/gamecode/laws.h +++ b/src/gamecode/laws.h @@ -34,7 +34,7 @@ extern "C" { const char *s, struct unit *receiver); int init_data(const char *filename, const char *catalog); - boolean renamed_building(const struct building * b); + bool renamed_building(const struct building * b); int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name); void get_food(struct region * r); extern int can_contact(const struct region *r, const struct unit *u, const struct unit *u2); diff --git a/src/gamecode/monster.c b/src/gamecode/monster.c index 1c4911cd1..4fe9d9ec2 100644 --- a/src/gamecode/monster.c +++ b/src/gamecode/monster.c @@ -70,7 +70,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define MAXILLUSION_TEXTS 3 -boolean monster_is_waiting(const unit * u) +bool monster_is_waiting(const unit * u) { if (fval(u, UFL_ISNEW | UFL_MOVED)) return true; diff --git a/src/gamecode/monster.h b/src/gamecode/monster.h index 0ae45a6bf..27a8f23f7 100644 --- a/src/gamecode/monster.h +++ b/src/gamecode/monster.h @@ -23,7 +23,7 @@ extern "C" { #endif void monster_kills_peasants(struct unit *u); - boolean monster_is_waiting(const struct unit *u); + bool monster_is_waiting(const struct unit *u); #ifdef __cplusplus } diff --git a/src/gamecode/randenc.c b/src/gamecode/randenc.c index 43d3370b2..196fdd5a0 100644 --- a/src/gamecode/randenc.c +++ b/src/gamecode/randenc.c @@ -153,7 +153,7 @@ static void dissolve_units(void) static int improve_all(faction * f, skill_t sk, int by_weeks) { unit *u; - boolean ret = by_weeks; + bool ret = by_weeks; for (u = f->units; u; u = u->nextF) { if (has_skill(u, sk)) { @@ -596,7 +596,7 @@ static int nb_armor(const unit * u, int index) } static int -damage_unit(unit * u, const char *dam, boolean physical, boolean magic) +damage_unit(unit * u, const char *dam, bool physical, bool magic) { int *hp = malloc(u->number * sizeof(int)); int h; @@ -980,7 +980,7 @@ void create_icebergs(void) for (r = regions; r; r = r->next) { if (r->terrain == newterrain(T_ICEBERG_SLEEP) && chance(0.05)) { - boolean has_ocean_neighbour = false; + bool has_ocean_neighbour = false; direction_t dir; region *rc; unit *u; @@ -1062,7 +1062,7 @@ static void orc_growth(void) for (r = regions; r; r = r->next) { unit *u; for (u = r->units; u; u = u->next) { - static boolean init = false; + static bool init = false; static const curse_type *ct_orcish = 0; curse *c = 0; if (!init) { diff --git a/src/gamecode/report.c b/src/gamecode/report.c index 2127d2940..c01ea5089 100644 --- a/src/gamecode/report.c +++ b/src/gamecode/report.c @@ -134,7 +134,7 @@ void rnl(FILE * F) fputc('\n', F); } -static void centre(FILE * F, const char *s, boolean breaking) +static void centre(FILE * F, const char *s, bool breaking) { /* Bei Namen die genau 80 Zeichen lang sind, kann es hier Probleme * geben. Seltsamerweise wird i dann auf MAXINT oder aehnlich @@ -698,7 +698,7 @@ nr_unit(FILE * F, const faction * f, const unit * u, int indent, int mode) attrib *a_otherfaction; char marker; int dh; - boolean isbattle = (boolean) (mode == see_battle); + bool isbattle = (bool) (mode == see_battle); char buf[8192]; if (fval(u->race, RCF_INVISIBLE)) @@ -735,7 +735,7 @@ nr_unit(FILE * F, const faction * f, const unit * u, int indent, int mode) static void rp_messages(FILE * F, message_list * msgs, faction * viewer, int indent, - boolean categorized) + bool categorized) { nrsection *section; if (!msgs) @@ -866,9 +866,9 @@ static void prices(FILE * F, const region * r, const faction * f) } -boolean see_border(const connection * b, const faction * f, const region * r) +bool see_border(const connection * b, const faction * f, const region * r) { - boolean cs = b->type->fvisible(b, f, r); + bool cs = b->type->fvisible(b, f, r); if (!cs) { cs = b->type->rvisible(b, r); if (!cs) { @@ -890,7 +890,7 @@ static void describe(FILE * F, const seen_region * sr, faction * f) { const region *r = sr->r; int n; - boolean dh; + bool dh; direction_t d; int trees; int saplings; @@ -899,12 +899,12 @@ static void describe(FILE * F, const seen_region * sr, faction * f) struct edge { struct edge *next; char *name; - boolean transparent; - boolean block; - boolean exist[MAXDIRECTIONS]; + bool transparent; + bool block; + bool exist[MAXDIRECTIONS]; direction_t lastd; } *edges = NULL, *e; - boolean see[MAXDIRECTIONS]; + bool see[MAXDIRECTIONS]; char buf[8192]; char *bufp = buf; size_t size = sizeof(buf); @@ -919,7 +919,7 @@ static void describe(FILE * F, const seen_region * sr, faction * f) continue; for (b = get_borders(r, r2); b;) { struct edge *e = edges; - boolean transparent = b->type->transparent(b, f); + bool transparent = b->type->transparent(b, f); const char *name = b->type->name(b, r, f, GF_DETAILED | GF_ARTICLE); if (!transparent) @@ -1235,7 +1235,7 @@ static void describe(FILE * F, const seen_region * sr, faction * f) if (edges) rnl(F); for (e = edges; e; e = e->next) { - boolean first = true; + bool first = true; bufp = buf; size = sizeof(buf) - 1; for (d = 0; d != MAXDIRECTIONS; ++d) { @@ -1455,7 +1455,7 @@ static int buildingmaintenance(const building * b, const resource_type * rtype) { const building_type *bt = b->type; int c, cost = 0; - static boolean init = false; + static bool init = false; static const curse_type *nocost_ct; if (!init) { init = true; @@ -1775,7 +1775,7 @@ static void guards(FILE * F, const region * r, const faction * see) unit *u; int i; - boolean tarned = false; + bool tarned = false; /* Bewachung */ for (u = r->units; u; u = u->next) { @@ -2579,7 +2579,7 @@ static void add_find(faction * f, unit * u, faction * f2) static void update_find(void) { region *r; - static boolean initial = true; + static bool initial = true; if (initial) for (r = regions; r; r = r->next) { @@ -2601,10 +2601,10 @@ static void update_find(void) initial = false; } -boolean kann_finden(faction * f1, faction * f2) +bool kann_finden(faction * f1, faction * f2) { update_find(); - return (boolean) (can_find(f1, f2) != NULL); + return (bool) (can_find(f1, f2) != NULL); } /******* end summary ******/ diff --git a/src/gamecode/study.c b/src/gamecode/study.c index 2919e8b1f..653ef5bb9 100644 --- a/src/gamecode/study.c +++ b/src/gamecode/study.c @@ -87,7 +87,7 @@ magic_t getmagicskill(const struct locale * lang) /* ------------------------------------------------------------- */ /* Vertraute und Kröten sind keine Migranten */ -boolean is_migrant(unit * u) +bool is_migrant(unit * u) { if (u->race == u->faction->race) return false; @@ -103,7 +103,7 @@ boolean is_migrant(unit * u) } /* ------------------------------------------------------------- */ -boolean magic_lowskill(unit * u) +bool magic_lowskill(unit * u) { return (u->race == new_race[RC_TOAD]) ? true : false; } @@ -174,7 +174,7 @@ static int study_days(unit * student, skill_t sk) static int teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk, - boolean report, int *academy) + bool report, int *academy) { teaching_info *teach = NULL; attrib *a; @@ -393,7 +393,7 @@ int teach_cmd(unit * u, struct order *ord) while (!parser_end()) { unit *u2 = getunit(r, u->faction); - boolean feedback; + bool feedback; ++count; /* Falls die Unit nicht gefunden wird, Fehler melden */ @@ -763,7 +763,7 @@ int learn_cmd(unit * u, order * ord) while (teach->teachers[index] && index != MAXTEACHERS) { unit *teacher = teach->teachers[index++]; if (teacher->faction != u->faction) { - boolean feedback = alliedunit(u, teacher->faction, HELP_GUARD); + bool feedback = alliedunit(u, teacher->faction, HELP_GUARD); if (feedback) { ADDMSG(&teacher->faction->msgs, msg_message("teach_teacher", "teacher student skill level", teacher, u, sk, diff --git a/src/gamecode/study.h b/src/gamecode/study.h index 3527e3cec..182e364ee 100644 --- a/src/gamecode/study.h +++ b/src/gamecode/study.h @@ -27,7 +27,7 @@ extern "C" { extern int learn_cmd(struct unit *u, struct order *ord); extern magic_t getmagicskill(const struct locale *lang); - extern boolean is_migrant(struct unit *u); + extern bool is_migrant(struct unit *u); extern int study_cost(struct unit *u, skill_t talent); #define MAXTEACHERS 4 diff --git a/src/gamecode/summary.c b/src/gamecode/summary.c index 03690dee7..1d3c73e2f 100644 --- a/src/gamecode/summary.c +++ b/src/gamecode/summary.c @@ -132,7 +132,7 @@ static void writeturn(void) fclose(f); } -void report_summary(summary * s, summary * o, boolean full) +void report_summary(summary * s, summary * o, bool full) { FILE *F = NULL; int i, newplayers = 0; diff --git a/src/gamecode/summary.h b/src/gamecode/summary.h index 5da62e688..bb2ae04b7 100644 --- a/src/gamecode/summary.h +++ b/src/gamecode/summary.h @@ -17,7 +17,7 @@ extern "C" { struct summary; extern void report_summary(struct summary *n, struct summary *o, - boolean full); + bool full); extern struct summary *make_summary(void); #ifdef __cplusplus diff --git a/src/gamecode/xmlreport.c b/src/gamecode/xmlreport.c index 5b93dc887..9ccf72a31 100644 --- a/src/gamecode/xmlreport.c +++ b/src/gamecode/xmlreport.c @@ -213,10 +213,10 @@ static xmlNodePtr xml_unit(report_context * ctx, unit * u, int mode) xml_context *xct = (xml_context *) ctx->userdata; xmlNodePtr node = xmlNewNode(xct->ns_atl, BAD_CAST "unit"); static const curse_type *itemcloak_ct = 0; - static boolean init = false; + static bool init = false; xmlNodePtr child; const char *str, *rcname, *rcillusion; - boolean disclosure = (ctx->f == u->faction || omniscient(ctx->f)); + bool disclosure = (ctx->f == u->faction || omniscient(ctx->f)); /* TODO: hitpoints, aura, combatspells, curses */ @@ -391,7 +391,7 @@ static xmlNodePtr xml_unit(report_context * ctx, unit * u, int mode) if (disclosure) { show = u->items; } else { - boolean see_items = (mode >= see_unit); + bool see_items = (mode >= see_unit); if (see_items) { if (itemcloak_ct && curse_active(get_curse(u->attribs, itemcloak_ct))) { see_items = false; diff --git a/src/gmtool.c b/src/gmtool.c index 57d715501..83d637d04 100644 --- a/src/gmtool.c +++ b/src/gmtool.c @@ -356,7 +356,7 @@ static void paint_status(window * wnd, const state * st) wclrtoeol(win); } -static boolean handle_info_region(window * wnd, state * st, int c) +static bool handle_info_region(window * wnd, state * st, int c) { return false; } @@ -1281,7 +1281,7 @@ curses_readline(struct lua_State *L, char *buffer, size_t size, return buffer[0] != 0; } -void seed_players(const char *filename, boolean new_island) +void seed_players(const char *filename, bool new_island) { newfaction *players = read_newfactions(filename); if (players != NULL) { diff --git a/src/gmtool.h b/src/gmtool.h index fa2df80e7..0359973b5 100644 --- a/src/gmtool.h +++ b/src/gmtool.h @@ -33,7 +33,7 @@ extern "C" { void state_close(struct state *); void make_block(int x, int y, int radius, const struct terrain_type *terrain); - void seed_players(const char *filename, boolean new_island); + void seed_players(const char *filename, bool new_island); #ifdef __cplusplus } diff --git a/src/gmtool_structs.h b/src/gmtool_structs.h index 49acbf526..1f3e4e9a7 100644 --- a/src/gmtool_structs.h +++ b/src/gmtool_structs.h @@ -70,13 +70,13 @@ extern "C" { } state; typedef struct window { - boolean(*handlekey) (struct window * win, struct state * st, int key); + bool(*handlekey) (struct window * win, struct state * st, int key); void (*paint) (struct window * win, const struct state * st); WINDOW *handle; struct window *next; struct window *prev; - boolean initialized; + bool initialized; int update; } window; diff --git a/src/items/phoenixcompass.c b/src/items/phoenixcompass.c index e26adfa8e..9787d4e9d 100644 --- a/src/items/phoenixcompass.c +++ b/src/items/phoenixcompass.c @@ -45,7 +45,7 @@ use_phoenixcompass(struct unit *u, const struct item_type *itype, region *r; unit *closest_phoenix = NULL; int closest_phoenix_distance = INT_MAX; - boolean confusion = false; + bool confusion = false; direction_t direction; unit *u2; direction_t closest_neighbour_direction = 0; diff --git a/src/items/weapons.c b/src/items/weapons.c index 05fbc31a5..7b817510a 100644 --- a/src/items/weapons.c +++ b/src/items/weapons.c @@ -38,7 +38,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* damage types */ -static boolean +static bool attack_firesword(const troop * at, const struct weapon_type *wtype, int *casualties) { @@ -83,7 +83,7 @@ attack_firesword(const troop * at, const struct weapon_type *wtype, #define CATAPULT_ATTACKS 6 -static boolean +static bool attack_catapult(const troop * at, const struct weapon_type *wtype, int *casualties) { diff --git a/src/kernel/alliance.c b/src/kernel/alliance.c index ede4b0dfd..afd31343d 100644 --- a/src/kernel/alliance.c +++ b/src/kernel/alliance.c @@ -452,7 +452,7 @@ int victorycondition(const alliance * al, const char *name) const struct item_type *itype = it_find(*igem); quicklist *flist = al->members; int qi; - boolean found = false; + bool found = false; assert(itype != NULL); for (qi = 0; flist && !found; ql_advance(&flist, &qi, 1)) { diff --git a/src/kernel/battle.c b/src/kernel/battle.c index 6417c1b91..7a4f1cd12 100644 --- a/src/kernel/battle.c +++ b/src/kernel/battle.c @@ -186,7 +186,7 @@ static char *sidename(side * s) return sidename_buf[bufno++]; } -static const char *sideabkz(side * s, boolean truename) +static const char *sideabkz(side * s, bool truename) { static char sideabkz_buf[8]; /* STATIC_RESULT: used for return, not across calls */ const faction *f = (s->stealthfaction @@ -214,7 +214,7 @@ static void message_faction(battle * b, faction * f, struct message *m) add_message(&f->battles->msgs, m); } -int armedmen(const unit * u, boolean siege_weapons) +int armedmen(const unit * u, bool siege_weapons) { item *itm; int n = 0; @@ -273,7 +273,7 @@ static void fbattlerecord(battle * b, faction * f, const char *s) #define enemy(as, ds) (as->relations[ds->index]&E_ENEMY) #define friendly(as, ds) (as->relations[ds->index]&E_FRIEND) -static boolean set_enemy(side * as, side * ds, boolean attacking) +static bool set_enemy(side * as, side * ds, bool attacking) { int i; for (i = 0; i != MAXSIDES; ++i) { @@ -366,11 +366,11 @@ fighter *select_corpse(battle * b, fighter * af) return NULL; } -boolean helping(const side * as, const side * ds) +bool helping(const side * as, const side * ds) { if (as->faction == ds->faction) return true; - return (boolean) (!enemy(as, ds) && allysf(as, ds->faction)); + return (bool) (!enemy(as, ds) && allysf(as, ds->faction)); } int statusrow(int status) @@ -414,7 +414,7 @@ static double hpflee(int status) static int get_row(const side * s, int row, const side * vs) { - boolean counted[MAXSIDES]; + bool counted[MAXSIDES]; int enemyfront = 0; int line, result; int retreat = 0; @@ -560,7 +560,7 @@ contest(int skdiff, const troop dt, const armor_type * ar, } } -static boolean is_riding(const troop t) +static bool is_riding(const troop t) { if (t.fighter->building != NULL) return false; @@ -569,7 +569,7 @@ static boolean is_riding(const troop t) return false; } -static weapon *preferred_weapon(const troop t, boolean attacking) +static weapon *preferred_weapon(const troop t, bool attacking) { weapon *missile = t.fighter->person[t.index].missile; weapon *melee = t.fighter->person[t.index].melee; @@ -586,8 +586,8 @@ static weapon *preferred_weapon(const troop t, boolean attacking) return melee; } -static weapon *select_weapon(const troop t, boolean attacking, - boolean ismissile) +static weapon *select_weapon(const troop t, bool attacking, + bool ismissile) /* select the primary weapon for this trooper */ { if (attacking) { @@ -604,7 +604,7 @@ static weapon *select_weapon(const troop t, boolean attacking, return preferred_weapon(t, attacking); } -static boolean i_canuse(const unit * u, const item_type * itype) +static bool i_canuse(const unit * u, const item_type * itype) { if (itype->canuse) { return itype->canuse(u, itype); @@ -613,7 +613,7 @@ static boolean i_canuse(const unit * u, const item_type * itype) } static int -weapon_skill(const weapon_type * wtype, const unit * u, boolean attacking) +weapon_skill(const weapon_type * wtype, const unit * u, bool attacking) /* the 'pure' skill when using this weapon to attack or defend. * only undiscriminate modifiers (not affected by troops or enemies) * are taken into account, e.g. no horses, magic, etc. */ @@ -729,8 +729,8 @@ static int CavalryBonus(const unit * u, troop enemy, int type) } static int -weapon_effskill(troop t, troop enemy, const weapon * w, boolean attacking, - boolean missile) +weapon_effskill(troop t, troop enemy, const weapon * w, bool attacking, + bool missile) /* effektiver Waffenskill während des Kampfes */ { /* In dieser Runde alle die Modifier berechnen, die fig durch die @@ -810,7 +810,7 @@ weapon_effskill(troop t, troop enemy, const weapon * w, boolean attacking, return skill; } -static const armor_type *select_armor(troop t, boolean shield) +static const armor_type *select_armor(troop t, bool shield) { unsigned int type = shield ? ATF_SHIELD : 0; unit *u = t.fighter->unit; @@ -858,7 +858,7 @@ int select_magicarmor(troop t) } /* Sind side ds und Magier des meffect verbündet, dann return 1*/ -boolean meffect_protection(battle * b, meffect * s, side * ds) +bool meffect_protection(battle * b, meffect * s, side * ds) { if (!s->magician->alive) return false; @@ -872,7 +872,7 @@ boolean meffect_protection(battle * b, meffect * s, side * ds) } /* Sind side as und Magier des meffect verfeindet, dann return 1*/ -boolean meffect_blocked(battle * b, meffect * s, side * as) +bool meffect_blocked(battle * b, meffect * s, side * as) { if (!s->magician->alive) return false; @@ -1051,8 +1051,8 @@ static int natural_armor(unit * du) return an; } -boolean -terminate(troop dt, troop at, int type, const char *damage, boolean missile) +bool +terminate(troop dt, troop at, int type, const char *damage, bool missile) { item **pitm; fighter *df = dt.fighter; @@ -1076,7 +1076,7 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile) const weapon *weapon; int rda, sk = 0, sd; - boolean magic = false; + bool magic = false; int da = dice_rand(damage); assert(du->number > 0); @@ -1864,7 +1864,7 @@ int skilldiff(troop at, troop dt, int dist) } if (df->building) { - boolean init = false; + bool init = false; static const curse_type *strongwall_ct, *magicwalls_ct; if (!init) { strongwall_ct = ct_find("strongwall"); @@ -1934,7 +1934,7 @@ int getreload(troop at) static void debug_hit(troop at, const weapon * awp, troop dt, const weapon * dwp, - int skdiff, int dist, boolean success) + int skdiff, int dist, bool success) { fprintf(bdebug, "%.4s/%d [%6s/%d] %s %.4s/%d [%6s/%d] with %d, distance %d\n", unitid(at.fighter->unit), at.index, @@ -2112,8 +2112,8 @@ static void attack(battle * b, troop ta, const att * a, int numattack) if (getreload(ta)) { ta.fighter->person[ta.index].reload--; } else { - boolean standard_attack = true; - boolean reload = false; + bool standard_attack = true; + bool reload = false; /* spezialattacken der waffe nur, wenn erste attacke in der runde. * sonst helden mit feuerschwertern zu mächtig */ if (numattack == 0 && wp && wp->type->attack) { @@ -2127,7 +2127,7 @@ static void attack(battle * b, troop ta, const att * a, int numattack) } } if (standard_attack) { - boolean missile = false; + bool missile = false; if (wp && fval(wp->type, WTF_MISSILE)) missile = true; if (missile) { @@ -2560,7 +2560,7 @@ static void loot_items(fighter * corpse) } } -static boolean seematrix(const faction * f, const side * s) +static bool seematrix(const faction * f, const side * s) { if (f == s->faction) return true; @@ -2626,7 +2626,7 @@ static void aftermath(battle * b) side *s; int dead_players = 0; bfaction *bf; - boolean ships_damaged = (boolean) (b->turn + (b->has_tactics_turn ? 1 : 0) > 2); /* only used for ship damage! */ + bool ships_damaged = (bool) (b->turn + (b->has_tactics_turn ? 1 : 0) > 2); /* only used for ship damage! */ for (s = b->sides; s != b->sides + b->nsides; ++s) { fighter *df; @@ -2672,7 +2672,7 @@ static void aftermath(battle * b) for (s = b->sides; s != b->sides + b->nsides; ++s) { int snumber = 0; fighter *df; - boolean relevant = false; /* Kampf relevant für diese Partei? */ + bool relevant = false; /* Kampf relevant für diese Partei? */ if (!fval(s, SIDE_HASGUARDS)) { relevant = true; } @@ -2920,7 +2920,7 @@ static void print_fighters(battle * b, const side * s) } } -boolean is_attacker(const fighter * fig) +bool is_attacker(const fighter * fig) { return fval(fig, FIG_ATTACKER) != 0; } @@ -2939,7 +2939,7 @@ static void print_header(battle * b) message *m; faction *f = bf->faction; const char *lastf = NULL; - boolean first = false; + bool first = false; side *s; char *bufp = zText; size_t size = sizeof(zText) - 1; @@ -3129,7 +3129,7 @@ static void print_stats(battle * b) } } -static int weapon_weight(const weapon * w, boolean missile) +static int weapon_weight(const weapon * w, bool missile) { if (missile == i2b(fval(w->type, WTF_MISSILE))) { return w->attackskill + w->defenseskill; @@ -3137,7 +3137,7 @@ static int weapon_weight(const weapon * w, boolean missile) return 0; } -fighter *make_fighter(battle * b, unit * u, side * s1, boolean attack) +fighter *make_fighter(battle * b, unit * u, side * s1, bool attack) { #define WMAX 20 weapon weapons[WMAX]; @@ -3153,7 +3153,7 @@ fighter *make_fighter(battle * b, unit * u, side * s1, boolean attack) int berserk; int strongmen; int speeded = 0, speed = 1; - boolean pr_aid = false; + bool pr_aid = false; int rest; const group *g = NULL; const attrib *a = a_find(u->attribs, &at_otherfaction); @@ -3459,7 +3459,7 @@ fighter *make_fighter(battle * b, unit * u, side * s1, boolean attack) return fig; } -static int join_battle(battle * b, unit * u, boolean attack, fighter ** cp) +static int join_battle(battle * b, unit * u, bool attack, fighter ** cp) { side *s; fighter *c = NULL; @@ -3650,8 +3650,8 @@ static int *get_alive(side * s) static int battle_report(battle * b) { side *s, *s2; - boolean cont = false; - boolean komma; + bool cont = false; + bool komma; bfaction *bf; for (s = b->sides; s != b->sides + b->nsides; ++s) { @@ -3876,11 +3876,11 @@ static void flee(const troop dt) kill_troop(dt); } -static boolean init_battle(region * r, battle ** bp) +static bool init_battle(region * r, battle ** bp) { battle *b = NULL; unit *u; - boolean fighting = false; + bool fighting = false; /* list_foreach geht nicht, wegen flucht */ for (u = r->units; u != NULL; u = u->next) { @@ -3890,7 +3890,7 @@ static boolean init_battle(region * r, battle ** bp) order *ord; for (ord = u->orders; ord; ord = ord->next) { - static boolean init = false; + static bool init = false; static const curse_type *peace_ct, *slave_ct, *calm_ct; if (!init) { @@ -3989,7 +3989,7 @@ static boolean init_battle(region * r, battle ** bp) if (calm_ct) { attrib *a = a_find(u->attribs, &at_curse); - boolean calm = false; + bool calm = false; while (a && a->type == &at_curse) { curse *c = (curse *) a->data.v; if (c->type == calm_ct @@ -4239,7 +4239,7 @@ static void battle_flee(battle * b) void do_battle(region * r) { battle *b = NULL; - boolean fighting = false; + bool fighting = false; ship *sh; static int init_rules = 0; diff --git a/src/kernel/battle.h b/src/kernel/battle.h index bc8acc66f..c962e32bb 100644 --- a/src/kernel/battle.h +++ b/src/kernel/battle.h @@ -46,7 +46,7 @@ extern "C" { struct bfaction *next; struct side *sides; struct faction *faction; - boolean attacker; + bool attacker; } bfaction; typedef struct tactics { @@ -94,9 +94,9 @@ extern "C" { struct quicklist *meffects; int max_tactics; int turn; - boolean has_tactics_turn; + bool has_tactics_turn; int keeploot; - boolean reelarrow; + bool reelarrow; int alive; struct { const struct side *as; @@ -218,8 +218,8 @@ extern "C" { extern int count_enemies(struct battle *b, const struct fighter *af, int minrow, int maxrow, int select); - extern boolean terminate(troop dt, troop at, int type, const char *damage, - boolean missile); + extern bool terminate(troop dt, troop at, int type, const char *damage, + bool missile); extern void message_all(battle * b, struct message *m); extern int hits(troop at, troop dt, weapon * awp); extern void damage_building(struct battle *b, struct building *bldg, @@ -229,18 +229,18 @@ extern "C" { extern int count_allies(const struct side *as, int minrow, int maxrow, int select, int allytype); extern int get_unitrow(const struct fighter *af, const struct side *vs); - extern boolean helping(const struct side *as, const struct side *ds); + extern bool helping(const struct side *as, const struct side *ds); extern void rmfighter(fighter * df, int i); extern struct fighter *select_corpse(struct battle *b, struct fighter *af); extern int statusrow(int status); extern void drain_exp(struct unit *u, int d); extern void kill_troop(troop dt); extern void remove_troop(troop dt); /* not the same as the badly named rmtroop */ - extern boolean is_attacker(const fighter * fig); + extern bool is_attacker(const fighter * fig); extern struct battle *make_battle(struct region * r); extern fighter *make_fighter(struct battle *b, struct unit *u, side * s, - boolean attack); + bool attack); extern struct side *make_side(struct battle * b, const struct faction * f, const struct group * g, unsigned int flags, const struct faction * stealthfaction); diff --git a/src/kernel/building.c b/src/kernel/building.c index 0b695622d..4ba7cad10 100644 --- a/src/kernel/building.c +++ b/src/kernel/building.c @@ -180,7 +180,7 @@ const char *buildingtype(const building_type * btype, const building * b, int bsize) { const char *s = NULL; - static boolean init_generic = false; + static bool init_generic = false; static const struct building_type *bt_generic; if (!init_generic) { @@ -451,7 +451,7 @@ building *new_building(const struct building_type * btype, region * r, { building **bptr = &r->buildings; building *b = (building *) calloc(1, sizeof(building)); - static boolean init_lighthouse = false; + static bool init_lighthouse = false; static const struct building_type *bt_lighthouse = 0; const char *bname = 0; char buffer[32]; @@ -501,7 +501,7 @@ void remove_building(building ** blist, building * b) { unit *u; static const struct building_type *bt_caravan, *bt_dam, *bt_tunnel; - static boolean init = false; + static bool init = false; if (!init) { init = true; diff --git a/src/kernel/config.c b/src/kernel/config.c index e66dc0f79..08970f71b 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -95,8 +95,8 @@ struct settings global = { FILE *logfile; FILE *updatelog; const struct race *new_race[MAXRACES]; -boolean sqlpatch = false; -boolean battledebug = false; +bool sqlpatch = false; +bool battledebug = false; int turn = 0; int NewbieImmunity(void) @@ -110,7 +110,7 @@ int NewbieImmunity(void) return value; } -boolean IsImmune(const faction * f) +bool IsImmune(const faction * f) { return !fval(f, FFL_NPC) && f->age < NewbieImmunity(); } @@ -143,7 +143,7 @@ static int ally_flag(const char *s, int help_mask) return 0; } -boolean ExpensiveMigrants(void) +bool ExpensiveMigrants(void) { static int value = -1; static int gamecookie = -1; @@ -617,7 +617,7 @@ int shipspeed(const ship * sh, const unit * u) { double k = sh->type->range; static const curse_type *stormwind_ct, *nodrift_ct; - static boolean init; + static bool init; attrib *a; curse *c; @@ -829,7 +829,7 @@ int eff_stealth(const unit * u, const region * r) return e; } -boolean unit_has_cursed_item(unit * u) +bool unit_has_cursed_item(unit * u) { item *itm = u->items; while (itm) { @@ -855,7 +855,7 @@ static void init_gms(void) static int autoalliance(const plane * pl, const faction * sf, const faction * f2) { - static boolean init = false; + static bool init = false; if (!init) { init_gms(); init = true; @@ -959,7 +959,7 @@ int alliedunit(const unit * u, const faction * f2, int mode) return 0; } -boolean +bool seefaction(const faction * f, const region * r, const unit * u, int modifier) { if (((f == u->faction) || !fval(u, UFL_ANON_FACTION)) @@ -968,7 +968,7 @@ seefaction(const faction * f, const region * r, const unit * u, int modifier) return false; } -boolean +bool cansee(const faction * f, const region * r, const unit * u, int modifier) /* r kann != u->region sein, wenn es um durchreisen geht */ /* und es muss niemand aus f in der region sein, wenn sie vom Turm @@ -977,7 +977,7 @@ cansee(const faction * f, const region * r, const unit * u, int modifier) int stealth, rings; unit *u2 = r->units; static const item_type *itype_grail; - static boolean init; + static bool init; if (!init) { init = true; @@ -1037,7 +1037,7 @@ cansee(const faction * f, const region * r, const unit * u, int modifier) return false; } -boolean cansee_unit(const unit * u, const unit * target, int modifier) +bool cansee_unit(const unit * u, const unit * target, int modifier) /* target->region kann != u->region sein, wenn es um durchreisen geht */ { if (fval(target->race, RCF_INVISIBLE) || target->number == 0) @@ -1073,7 +1073,7 @@ boolean cansee_unit(const unit * u, const unit * target, int modifier) return false; } -boolean +bool cansee_durchgezogen(const faction * f, const region * r, const unit * u, int modifier) /* r kann != u->region sein, wenn es um durchreisen geht */ @@ -1144,7 +1144,7 @@ static attrib_type at_lighthouse = { */ void update_lighthouse(building * lh) { - static boolean init_lighthouse = false; + static bool init_lighthouse = false; static const struct building_type *bt_lighthouse = 0; if (!init_lighthouse) { @@ -1256,7 +1256,7 @@ void init_tokens(const struct order *ord) } void -parse(keyword_t kword, int (*dofun) (unit *, struct order *), boolean thisorder) +parse(keyword_t kword, int (*dofun) (unit *, struct order *), bool thisorder) { region *r; @@ -1502,7 +1502,7 @@ int read_unitid(const faction * f, const region * r) } /* exported symbol */ -boolean getunitpeasants; +bool getunitpeasants; unit *getunitg(const region * r, const faction * f) { int n = read_unitid(f, r); @@ -1565,7 +1565,7 @@ void freestrlist(strlist * s) /* - Meldungen und Fehler ------------------------------------------------- */ -boolean lomem = false; +bool lomem = false; /* - Namen der Strukturen -------------------------------------- */ typedef char name[OBJECTIDSIZE + 1]; @@ -1615,7 +1615,7 @@ char *cstring(const char *s) } building *largestbuilding(const region * r, cmp_building_cb cmp_gt, - boolean imaginary) + bool imaginary) { building *b, *best = NULL; @@ -1720,9 +1720,9 @@ unit *createunit(region * r, faction * f, int number, const struct race * rc) return create_unit(r, f, number, rc, 0, NULL, NULL); } -boolean idle(faction * f) +bool idle(faction * f) { - return (boolean) (f ? false : true); + return (bool) (f ? false : true); } int maxworkingpeasants(const struct region *r) @@ -1765,7 +1765,7 @@ int lighthouse_range(const building * b, const faction * f) return d; } -boolean check_leuchtturm(region * r, faction * f) +bool check_leuchtturm(region * r, faction * f) { attrib *a; @@ -2364,7 +2364,7 @@ void remove_empty_units(void) } } -boolean faction_id_is_unused(int id) +bool faction_id_is_unused(int id) { return findfaction(id) == NULL; } @@ -2461,7 +2461,7 @@ int lifestyle(const unit * u) return need; } -boolean has_horses(const struct unit * u) +bool has_horses(const struct unit * u) { item *itm = u->items; for (; itm; itm = itm->next) { @@ -2471,7 +2471,7 @@ boolean has_horses(const struct unit * u) return false; } -boolean hunger(int number, unit * u) +bool hunger(int number, unit * u) { region *r = u->region; int dead = 0, hpsub = 0; @@ -2520,7 +2520,7 @@ boolean hunger(int number, unit * u) return (dead || hpsub); } -void plagues(region * r, boolean ismagic) +void plagues(region * r, bool ismagic) { int peasants; int i; @@ -2584,7 +2584,7 @@ int cmp_wage(const struct building *b, const building * a) return -1; } -boolean is_owner_building(const struct building * b) +bool is_owner_building(const struct building * b) { region *r = b->region; if (b->type->taxes && r->land && r->land->ownership) { @@ -2754,7 +2754,7 @@ default_wage(const region * r, const faction * f, const race * rc, int in_turn) attrib *a; const building_type *artsculpture_type = bt_find("artsculpture"); static const curse_type *drought_ct, *blessedharvest_ct; - static boolean init; + static bool init; if (!init) { init = true; @@ -2895,7 +2895,7 @@ int movewhere(const unit * u, const char *token, region * r, region ** resultp) return E_MOVE_OK; } -boolean move_blocked(const unit * u, const region * r, const region * r2) +bool move_blocked(const unit * u, const region * r, const region * r2) { connection *b; curse *c; @@ -2944,7 +2944,7 @@ int lovar(double xpct_x2) return (rng_int() % n + rng_int() % n) / 1000; } -boolean has_limited_skills(const struct unit * u) +bool has_limited_skills(const struct unit * u) { if (has_skill(u, SK_MAGIC) || has_skill(u, SK_ALCHEMY) || has_skill(u, SK_TACTICS) || has_skill(u, SK_HERBALISM) || diff --git a/src/kernel/config.h b/src/kernel/config.h index 6e8a1a142..e85325bc1 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -111,7 +111,7 @@ extern "C" { extern int shipspeed(const struct ship *sh, const struct unit *u); -#define i2b(i) ((boolean)((i)?(true):(false))) +#define i2b(i) ((bool)((i)?(true):(false))) typedef struct ally { struct ally *next; @@ -136,10 +136,10 @@ extern "C" { extern int verbosity; /* parteinummern */ - extern boolean faction_id_is_unused(int); + extern bool faction_id_is_unused(int); /* leuchtturm */ - extern boolean check_leuchtturm(struct region *r, struct faction *f); + extern bool check_leuchtturm(struct region *r, struct faction *f); extern void update_lighthouse(struct building *lh); extern int lighthouse_range(const struct building *b, const struct faction *f); @@ -159,7 +159,7 @@ extern "C" { void addstrlist(strlist ** SP, const char *s); - int armedmen(const struct unit *u, boolean siege_weapons); + int armedmen(const struct unit *u, bool siege_weapons); unsigned int atoip(const char *s); unsigned int getuint(void); @@ -188,13 +188,13 @@ extern "C" { #define factionid(x) itoa36((x)->no) #define curseid(x) itoa36((x)->no) - extern boolean cansee(const struct faction *f, const struct region *r, + extern bool cansee(const struct faction *f, const struct region *r, const struct unit *u, int modifier); - boolean cansee_durchgezogen(const struct faction *f, const struct region *r, + bool cansee_durchgezogen(const struct faction *f, const struct region *r, const struct unit *u, int modifier); - extern boolean cansee_unit(const struct unit *u, const struct unit *target, + extern bool cansee_unit(const struct unit *u, const struct unit *target, int modifier); - boolean seefaction(const struct faction *f, const struct region *r, + bool seefaction(const struct faction *f, const struct region *r, const struct unit *u, int modifier); extern int effskill(const struct unit *u, skill_t sk); @@ -210,7 +210,7 @@ extern "C" { extern struct unit *createunit(struct region *r, struct faction *f, int number, const struct race *rc); extern void create_unitid(struct unit *u, int id); - extern boolean getunitpeasants; + extern bool getunitpeasants; extern struct unit *getunitg(const struct region *r, const struct faction *f); extern struct unit *getunit(const struct region *r, const struct faction *f); @@ -242,7 +242,7 @@ extern "C" { typedef int (*cmp_building_cb) (const struct building * b, const struct building * a); struct building *largestbuilding(const struct region *r, cmp_building_cb, - boolean imaginary); + bool imaginary); int cmp_wage(const struct building *b, const struct building *bother); int cmp_taxes(const struct building *b, const struct building *bother); int cmp_current_owner(const struct building *b, @@ -265,7 +265,7 @@ extern "C" { extern int count_migrants(const struct faction *f); extern int count_maxmigrants(const struct faction *f); - extern boolean has_limited_skills(const struct unit *u); + extern bool has_limited_skills(const struct unit *u); extern const struct race *findrace(const char *, const struct locale *); int eff_stealth(const struct unit *u, const struct region *r); @@ -273,7 +273,7 @@ extern "C" { int check_option(struct faction *f, int option); extern void parse(keyword_t kword, int (*dofun) (struct unit *, - struct order *), boolean thisorder); + struct order *), bool thisorder); /* Anzahl Personen in einer Einheit festlegen. NUR (!) mit dieser Routine, * sonst großes Unglück. Durch asserts an ein paar Stellen abgesichert. */ @@ -293,8 +293,8 @@ extern "C" { void fhash(struct faction *f); void funhash(struct faction *f); - boolean idle(struct faction *f); - boolean unit_has_cursed_item(struct unit *u); + bool idle(struct faction *f); + bool unit_has_cursed_item(struct unit *u); /* simple garbage collection: */ void *gc_add(void *p); @@ -344,18 +344,18 @@ extern "C" { */ unsigned int guard_flags(const struct unit *u); - extern boolean hunger(int number, struct unit *u); + extern bool hunger(int number, struct unit *u); extern int lifestyle(const struct unit *); extern int besieged(const struct unit *u); extern int maxworkingpeasants(const struct region *r); - extern boolean has_horses(const struct unit *u); + extern bool has_horses(const struct unit *u); extern int markets_module(void); extern int wage(const struct region *r, const struct faction *f, const struct race *rc, int in_turn); extern int maintenance_cost(const struct unit *u); extern struct message *movement_error(struct unit *u, const char *token, struct order *ord, int error_code); - extern boolean move_blocked(const struct unit *u, const struct region *src, + extern bool move_blocked(const struct unit *u, const struct region *src, const struct region *dest); extern void add_income(struct unit *u, int type, int want, int qty); @@ -392,7 +392,7 @@ extern "C" { const char *gamename; struct attrib *attribs; unsigned int data_turn; - boolean disabled[MAXKEYWORDS]; + bool disabled[MAXKEYWORDS]; struct param *parameters; void *vm_state; float producexpchance; @@ -409,9 +409,9 @@ extern "C" { extern int produceexp(struct unit *u, skill_t sk, int n); - extern boolean battledebug; - extern boolean sqlpatch; - extern boolean lomem; /* save memory */ + extern bool battledebug; + extern bool sqlpatch; + extern bool lomem; /* save memory */ extern const char *dbrace(const struct race *rc); @@ -421,19 +421,19 @@ extern "C" { extern float get_param_flt(const struct param *p, const char *name, float def); - extern boolean ExpensiveMigrants(void); + extern bool ExpensiveMigrants(void); extern int NMRTimeout(void); extern int LongHunger(const struct unit *u); extern int SkillCap(skill_t sk); extern int NewbieImmunity(void); - extern boolean IsImmune(const struct faction *f); + extern bool IsImmune(const struct faction *f); extern int AllianceAuto(void); /* flags that allied factions get automatically */ extern int AllianceRestricted(void); /* flags restricted to allied factions */ extern int HelpMask(void); /* flags restricted to allied factions */ extern struct order *default_order(const struct locale *lang); extern int entertainmoney(const struct region *r); - extern void plagues(struct region *r, boolean ismagic); + extern void plagues(struct region *r, bool ismagic); typedef struct helpmode { const char *name; int status; diff --git a/src/kernel/connection.c b/src/kernel/connection.c index 5d4d24d19..7bbb2e75a 100644 --- a/src/kernel/connection.c +++ b/src/kernel/connection.c @@ -224,21 +224,21 @@ void b_write(const connection * b, storage * store) } } -boolean b_transparent(const connection * b, const struct faction *f) +bool b_transparent(const connection * b, const struct faction *f) { unused(b); unused(f); return true; } -boolean b_opaque(const connection * b, const struct faction * f) +bool b_opaque(const connection * b, const struct faction * f) { unused(b); unused(f); return false; } -boolean b_blockall(const connection * b, const unit * u, const region * r) +bool b_blockall(const connection * b, const unit * u, const region * r) { unused(u); unused(r); @@ -246,7 +246,7 @@ boolean b_blockall(const connection * b, const unit * u, const region * r) return true; } -boolean b_blocknone(const connection * b, const unit * u, const region * r) +bool b_blocknone(const connection * b, const unit * u, const region * r) { unused(u); unused(r); @@ -254,12 +254,12 @@ boolean b_blocknone(const connection * b, const unit * u, const region * r) return false; } -boolean b_rvisible(const connection * b, const region * r) +bool b_rvisible(const connection * b, const region * r) { - return (boolean) (b->to == r || b->from == r); + return (bool) (b->to == r || b->from == r); } -boolean b_fvisible(const connection * b, const struct faction * f, +bool b_fvisible(const connection * b, const struct faction * f, const region * r) { unused(r); @@ -268,21 +268,21 @@ boolean b_fvisible(const connection * b, const struct faction * f, return true; } -boolean b_uvisible(const connection * b, const unit * u) +bool b_uvisible(const connection * b, const unit * u) { unused(u); unused(b); return true; } -boolean b_rinvisible(const connection * b, const region * r) +bool b_rinvisible(const connection * b, const region * r) { unused(r); unused(b); return false; } -boolean b_finvisible(const connection * b, const struct faction * f, +bool b_finvisible(const connection * b, const struct faction * f, const region * r) { unused(r); @@ -291,7 +291,7 @@ boolean b_finvisible(const connection * b, const struct faction * f, return false; } -boolean b_uinvisible(const connection * b, const unit * u) +bool b_uinvisible(const connection * b, const unit * u) { unused(u); unused(b); @@ -399,14 +399,14 @@ static const char *b_namefogwall(const connection * b, const region * r, return LOC(f->locale, mkname("border", "fogwall")); } -static boolean +static bool b_blockfogwall(const connection * b, const unit * u, const region * r) { unused(b); unused(r); if (!u) return true; - return (boolean) (effskill(u, SK_PERCEPTION) > 4); /* Das ist die alte Nebelwand */ + return (bool) (effskill(u, SK_PERCEPTION) > 4); /* Das ist die alte Nebelwand */ } /** Legacy type used in old Eressea games, no longer in use. */ @@ -458,7 +458,7 @@ border_type bt_illusionwall = { * special quest door ***/ -boolean b_blockquestportal(const connection * b, const unit * u, +bool b_blockquestportal(const connection * b, const unit * u, const region * r) { if (b->data.i > 0) @@ -558,14 +558,14 @@ static void b_writeroad(const connection * b, storage * store) store->w_int(store, b->data.sa[1]); } -static boolean b_validroad(const connection * b) +static bool b_validroad(const connection * b) { if (b->data.sa[0] == SHRT_MAX) return false; return true; } -static boolean b_rvisibleroad(const connection * b, const region * r) +static bool b_rvisibleroad(const connection * b, const region * r) { int x = b->data.i; x = (r == b->from) ? b->data.sa[0] : b->data.sa[1]; diff --git a/src/kernel/connection.h b/src/kernel/connection.h index 62e09771e..b582377c5 100644 --- a/src/kernel/connection.h +++ b/src/kernel/connection.h @@ -39,7 +39,7 @@ extern "C" { typedef struct border_type { const char *__name; /* internal use only */ variant_type datatype; - boolean(*transparent) (const connection *, const struct faction *); + bool(*transparent) (const connection *, const struct faction *); /* is it possible to see through this? */ void (*init) (connection *); /* constructor: initialize the connection. allocate extra memory if needed */ @@ -47,7 +47,7 @@ extern "C" { /* destructor: remove all extra memory for destruction */ void (*read) (connection *, struct storage *); void (*write) (const connection *, struct storage *); - boolean(*block) (const connection *, const struct unit *, + bool(*block) (const connection *, const struct unit *, const struct region * r); /* return true if it blocks movement of u from * r to the opposite struct region. @@ -59,11 +59,11 @@ extern "C" { * may depend on the struct faction, for example "a wall" may * turn out to be "an illusionary wall" */ - boolean(*rvisible) (const connection *, const struct region *); + bool(*rvisible) (const connection *, const struct region *); /* is it visible to everyone in r ? * if not, it may still be fvisible() for some f. */ - boolean(*fvisible) (const connection *, const struct faction *, + bool(*fvisible) (const connection *, const struct faction *, const struct region *); /* is it visible to units of f in r? * the function shall not check for @@ -73,16 +73,16 @@ extern "C" { * the reporting function will have to assure). * if not true, it may still be uvisible() for some u. */ - boolean(*uvisible) (const connection *, const struct unit *); + bool(*uvisible) (const connection *, const struct unit *); /* is it visible to u ? * a doorway may only be visible to a struct unit with perception > 5 */ - boolean(*valid) (const connection *); + bool(*valid) (const connection *); /* is the connection in a valid state, * or should it be erased at the end of this turn to save space? */ struct region *(*move) (const connection *, struct unit * u, - struct region * from, struct region * to, boolean routing); + struct region * from, struct region * to, bool routing); /* executed when the units traverses this connection */ int (*age) (struct connection *); /* return 0 if connection needs to be removed. >0 if still aging, <0 if not aging */ @@ -112,20 +112,20 @@ extern "C" { /* provide default implementations for some member functions: */ extern void b_read(connection * b, struct storage *store); extern void b_write(const connection * b, struct storage *store); - extern boolean b_blockall(const connection *, const struct unit *, + extern bool b_blockall(const connection *, const struct unit *, const struct region *); - extern boolean b_blocknone(const connection *, const struct unit *, + extern bool b_blocknone(const connection *, const struct unit *, const struct region *); - extern boolean b_rvisible(const connection *, const struct region *r); - extern boolean b_fvisible(const connection *, const struct faction *f, + extern bool b_rvisible(const connection *, const struct region *r); + extern bool b_fvisible(const connection *, const struct faction *f, const struct region *); - extern boolean b_uvisible(const connection *, const struct unit *u); - extern boolean b_rinvisible(const connection *, const struct region *r); - extern boolean b_finvisible(const connection *, const struct faction *f, + extern bool b_uvisible(const connection *, const struct unit *u); + extern bool b_rinvisible(const connection *, const struct region *r); + extern bool b_finvisible(const connection *, const struct faction *f, const struct region *); - extern boolean b_uinvisible(const connection *, const struct unit *u); - extern boolean b_transparent(const connection *, const struct faction *); - extern boolean b_opaque(const connection *, const struct faction *); /* !transparent */ + extern bool b_uinvisible(const connection *, const struct unit *u); + extern bool b_transparent(const connection *, const struct faction *); + extern bool b_opaque(const connection *, const struct faction *); /* !transparent */ extern border_type bt_fogwall; extern border_type bt_noway; diff --git a/src/kernel/curse.c b/src/kernel/curse.c index 4a7403e69..5dfa9c3f1 100644 --- a/src/kernel/curse.c +++ b/src/kernel/curse.c @@ -322,7 +322,7 @@ const curse_type *ct_find(const char *c) * einen pointer auf die struct zurück. */ -boolean cmp_curse(const attrib * a, const void *data) +bool cmp_curse(const attrib * a, const void *data) { const curse *c = (const curse *)data; if (a->type->flags & ATF_CURSE) { @@ -332,7 +332,7 @@ boolean cmp_curse(const attrib * a, const void *data) return false; } -boolean cmp_cursetype(const attrib * a, const void *data) +bool cmp_cursetype(const attrib * a, const void *data) { const curse_type *ct = (const curse_type *)data; if (a->type->flags & ATF_CURSE) { @@ -343,7 +343,7 @@ boolean cmp_cursetype(const attrib * a, const void *data) } curse *get_cursex(attrib * ap, const curse_type * ctype, variant data, - boolean(*compare) (const curse *, variant)) + bool(*compare) (const curse *, variant)) { attrib *a = a_select(ap, ctype, cmp_cursetype); while (a) { @@ -582,7 +582,7 @@ static void do_transfer_curse(curse * c, unit * u, unit * u2, int n) { int cursedmen = 0; int men = get_cursedmen(u, c); - boolean dogive = false; + bool dogive = false; const curse_type *ct = c->type; switch ((ct->flags | c->flags) & CURSE_SPREADMASK) { @@ -639,7 +639,7 @@ void transfer_curse(unit * u, unit * u2, int n) /* ------------------------------------------------------------- */ -boolean curse_active(const curse * c) +bool curse_active(const curse * c) { if (!c) return false; @@ -651,7 +651,7 @@ boolean curse_active(const curse * c) return true; } -boolean is_cursed_internal(attrib * ap, const curse_type * ct) +bool is_cursed_internal(attrib * ap, const curse_type * ct) { curse *c = get_curse(ap, ct); @@ -661,7 +661,7 @@ boolean is_cursed_internal(attrib * ap, const curse_type * ct) return true; } -boolean is_cursed_with(const attrib * ap, const curse * c) +bool is_cursed_with(const attrib * ap, const curse * c) { const attrib *a = ap; diff --git a/src/kernel/curse.h b/src/kernel/curse.h index ee2f7899e..a4b2f9c80 100644 --- a/src/kernel/curse.h +++ b/src/kernel/curse.h @@ -248,7 +248,7 @@ extern "C" { extern void destroy_curse(curse * c); - boolean is_cursed_internal(struct attrib *ap, const curse_type * ctype); + bool is_cursed_internal(struct attrib *ap, const curse_type * ctype); /* ignoriert CURSE_ISNEW */ extern void remove_curse(struct attrib **ap, const struct curse *c); @@ -281,7 +281,7 @@ extern "C" { * */ extern struct curse *get_cursex(struct attrib *ap, const curse_type * ctype, - variant data, boolean(*compare) (const struct curse *, variant)); + variant data, bool(*compare) (const struct curse *, variant)); /* gibt pointer auf die erste curse-struct zurück, deren Typ ctype ist, * und für die compare() true liefert, oder einen NULL-pointer. * */ @@ -303,15 +303,15 @@ extern "C" { extern void curse_done(struct attrib *a); extern int curse_age(struct attrib *a); - extern boolean cmp_curse(const struct attrib *a, const void *data); - extern boolean cmp_cursetype(const struct attrib *a, const void *data); + extern bool cmp_curse(const struct attrib *a, const void *data); + extern bool cmp_cursetype(const struct attrib *a, const void *data); extern double destr_curse(struct curse *c, int cast_level, double force); extern int resolve_curse(variant data, void *address); - extern boolean is_cursed_with(const struct attrib *ap, const struct curse *c); + extern bool is_cursed_with(const struct attrib *ap, const struct curse *c); - extern boolean curse_active(const struct curse *c); + extern bool curse_active(const struct curse *c); /* gibt true, wenn der Curse nicht NULL oder inaktiv ist */ /*** COMPATIBILITY MACROS. DO NOT USE FOR NEW CODE, REPLACE IN OLD CODE: */ diff --git a/src/kernel/faction.c b/src/kernel/faction.c index 009922bca..8bf86e30a 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -258,7 +258,7 @@ unit *addplayer(region * r, faction * f) return u; } -boolean checkpasswd(const faction * f, const char *passwd, boolean shortp) +bool checkpasswd(const faction * f, const char *passwd, bool shortp) { if (unicode_utf8_strcasecmp(f->passw, passwd) == 0) return true; @@ -490,14 +490,14 @@ void faction_setpassword(faction * f, const char *passw) f->passw = strdup(itoa36(rng_int())); } -boolean valid_race(const struct faction *f, const struct race *rc) +bool valid_race(const struct faction *f, const struct race *rc) { if (f->race == rc) return true; else { const char *str = get_param(f->race->parameters, "other_race"); if (str) - return (boolean) (rc_find(str) == rc); + return (bool) (rc_find(str) == rc); return false; } } diff --git a/src/kernel/faction.h b/src/kernel/faction.h index a81d0545c..e68cf8bcd 100644 --- a/src/kernel/faction.h +++ b/src/kernel/faction.h @@ -87,7 +87,7 @@ extern "C" { int no_units; struct ally *allies; struct group *groups; - boolean alive; /* enno: sollte ein flag werden */ + bool alive; /* enno: sollte ein flag werden */ int nregions; int money; #if SCORE_MODULE @@ -118,8 +118,8 @@ extern "C" { extern struct unit *addplayer(struct region *r, faction * f); extern struct faction *addfaction(const char *email, const char *password, const struct race *frace, const struct locale *loc, int subscription); - extern boolean checkpasswd(const faction * f, const char *passwd, - boolean shortp); + extern bool checkpasswd(const faction * f, const char *passwd, + bool shortp); extern void destroyfaction(faction * f); extern void set_alliance(struct faction *a, struct faction *b, int status); @@ -150,7 +150,7 @@ extern "C" { const char *faction_getpassword(const struct faction *self); void faction_setpassword(struct faction *self, const char *password); - boolean valid_race(const struct faction *f, const struct race *rc); + bool valid_race(const struct faction *f, const struct race *rc); struct spellbook * faction_get_spellbook(struct faction *f); #ifdef __cplusplus diff --git a/src/kernel/group.c b/src/kernel/group.c index a0b5821c5..8b6144d82 100755 --- a/src/kernel/group.c +++ b/src/kernel/group.c @@ -175,7 +175,7 @@ void set_group(struct unit *u, struct group *g) } } -boolean join_group(unit * u, const char *name) +bool join_group(unit * u, const char *name) { group *g = NULL; diff --git a/src/kernel/group.h b/src/kernel/group.h index 14dd119cd..17b44ab3d 100755 --- a/src/kernel/group.h +++ b/src/kernel/group.h @@ -38,7 +38,7 @@ extern "C" { } group; extern struct attrib_type at_group; /* attribute for units assigned to a group */ - extern boolean join_group(struct unit *u, const char *name); + extern bool join_group(struct unit *u, const char *name); extern void set_group(struct unit *u, struct group *g); extern struct group * get_group(const struct unit *u); extern void free_group(struct group *g); diff --git a/src/kernel/item.c b/src/kernel/item.c index c588fbeca..fd35f0776 100644 --- a/src/kernel/item.c +++ b/src/kernel/item.c @@ -684,7 +684,7 @@ typedef struct t_item { const char *name; /* [0]: Einzahl für eigene; [1]: Mehrzahl für eigene; * [2]: Einzahl für Fremde; [3]: Mehrzahl für Fremde */ - boolean is_resource; + bool is_resource; skill_t skill; int minskill; int gewicht; diff --git a/src/kernel/item.h b/src/kernel/item.h index 7ff3b9454..be6d18272 100644 --- a/src/kernel/item.h +++ b/src/kernel/item.h @@ -132,7 +132,7 @@ extern "C" { int capacity; struct construction *construction; /* --- functions --- */ - boolean(*canuse) (const struct unit * user, + bool(*canuse) (const struct unit * user, const struct item_type * itype); int (*use) (struct unit * user, const struct item_type * itype, int amount, struct order * ord); @@ -220,7 +220,7 @@ extern "C" { int reload; /* time to reload this weapon */ weapon_mod *modifiers; /* --- functions --- */ - boolean(*attack) (const struct troop *, const struct weapon_type *, + bool(*attack) (const struct troop *, const struct weapon_type *, int *deaths); } weapon_type; diff --git a/src/kernel/magic.c b/src/kernel/magic.c index e716528ce..3f388450b 100644 --- a/src/kernel/magic.c +++ b/src/kernel/magic.c @@ -345,7 +345,7 @@ attrib_type at_mage = { ATF_UNIQUE }; -boolean is_mage(const unit * u) +bool is_mage(const unit * u) { return i2b(get_mage(u) != NULL); } @@ -407,7 +407,7 @@ attrib_type at_seenspell = { #define MAXSPELLS 256 -static boolean already_seen(const faction * f, const spell * sp) +static bool already_seen(const faction * f, const spell * sp) { attrib *a; @@ -912,7 +912,7 @@ void pay_spell(unit * u, const spell * sp, int cast_level, int range) * aber dann immer noch nicht können, vieleicht ist seine Stufe derzeit * nicht ausreichend oder die Komponenten fehlen. */ -boolean knowsspell(const region * r, const unit * u, const spell * sp) +bool knowsspell(const region * r, const unit * u, const spell * sp) { /* Ist überhaupt ein gültiger Spruch angegeben? */ if (!sp || sp->id == 0) { @@ -929,7 +929,7 @@ boolean knowsspell(const region * r, const unit * u, const spell * sp) * und sonstige Gegenstaende sein. */ -boolean +bool cancast(unit * u, const spell * sp, int level, int range, struct order * ord) { int k; @@ -1178,7 +1178,7 @@ double magic_resistance(unit * target) * true zurück */ -boolean +bool target_resists_magic(unit * magician, void *obj, int objtyp, int t_bonus) { double probability = 0.0; @@ -1244,9 +1244,9 @@ target_resists_magic(unit * magician, void *obj, int objtyp, int t_bonus) /* ------------------------------------------------------------- */ -boolean is_magic_resistant(unit * magician, unit * target, int resist_bonus) +bool is_magic_resistant(unit * magician, unit * target, int resist_bonus) { - return (boolean) target_resists_magic(magician, target, TYP_UNIT, + return (bool) target_resists_magic(magician, target, TYP_UNIT, resist_bonus); } @@ -1261,7 +1261,7 @@ boolean is_magic_resistant(unit * magician, unit * target, int resist_bonus) * eben) bis zu etwa 1% bei doppelt so gut wie notwendig */ -boolean fumble(region * r, unit * u, const spell * sp, int cast_grade) +bool fumble(region * r, unit * u, const spell * sp, int cast_grade) { /* X ergibt Zahl zwischen 1 und 0, je kleiner, desto besser der Magier. * 0,5*40-20=0, dh wenn der Magier doppelt so gut ist, wie der Spruch @@ -1500,7 +1500,7 @@ void regenerate_aura(void) } } -static boolean +static bool verify_ship(region * r, unit * mage, const spell * sp, spllprm * spobj, order * ord) { @@ -1523,7 +1523,7 @@ verify_ship(region * r, unit * mage, const spell * sp, spllprm * spobj, return true; } -static boolean +static bool verify_building(region * r, unit * mage, const spell * sp, spllprm * spobj, order * ord) { @@ -1564,7 +1564,7 @@ message *msg_unitnotfound(const struct unit * mage, struct order * ord, "unit region command id", mage, mage->region, ord, uid); } -static boolean +static bool verify_unit(region * r, unit * mage, const spell * sp, spllprm * spobj, order * ord) { @@ -1907,7 +1907,7 @@ addparam_unit(const char *const param[], spllprm ** spobjp, const unit * u, static spellparameter *add_spellparameter(region * target_r, unit * u, const char *syntax, const char *const param[], int size, struct order *ord) { - boolean fail = false; + bool fail = false; int i = 0; int p = 0; const char *c; @@ -2116,7 +2116,7 @@ typedef struct familiar_data { unit *familiar; } famililar_data; -boolean is_familiar(const unit * u) +bool is_familiar(const unit * u) { attrib *a = a_find(u->attribs, &at_familiarmage); return i2b(a != NULL); @@ -2200,7 +2200,7 @@ void remove_familiar(unit * mage) } } -boolean create_newfamiliar(unit * mage, unit * familiar) +bool create_newfamiliar(unit * mage, unit * familiar) { /* if the skill modifier for the mage does not yet exist, add it */ attrib *a; @@ -2461,7 +2461,7 @@ unit *get_clone_mage(const unit * u) return NULL; } -static boolean is_moving_ship(const region * r, ship * sh) +static bool is_moving_ship(const region * r, ship * sh) { const unit *u = ship_owner(sh); @@ -2767,7 +2767,7 @@ void magic(void) for (co = spellranks[rank].begin; co; co = co->next) { order *ord = co->order; int invalid, resist, success, cast_level = co->level; - boolean fumbled = false; + bool fumbled = false; unit *u = co->magician.u; const spell *sp = co->sp; region *target_r = co_get_region(co); diff --git a/src/kernel/magic.h b/src/kernel/magic.h index 0f5b6b56d..f2dfaa5ba 100644 --- a/src/kernel/magic.h +++ b/src/kernel/magic.h @@ -228,9 +228,9 @@ typedef struct sc_mage { * und initialisiert den Magiertypus mit mtyp. */ sc_mage *get_mage(const struct unit *u); /* gibt u->mage zurück, bei nicht-Magiern *NULL */ - boolean is_mage(const struct unit *u); + bool is_mage(const struct unit *u); /* gibt true, wenn u->mage gesetzt. */ - boolean is_familiar(const struct unit *u); + bool is_familiar(const struct unit *u); /* gibt true, wenn eine Familiar-Relation besteht. */ /* Sprüche */ @@ -253,7 +253,7 @@ typedef struct sc_mage { /* fügt alle Zauber des Magiegebietes der Einheit, deren Stufe kleiner * als das aktuelle Magietalent ist, in die Spruchliste der Einheit * ein */ - boolean knowsspell(const struct region *r, const struct unit *u, + bool knowsspell(const struct region *r, const struct unit *u, const struct spell * sp); /* prüft, ob die Einheit diesen Spruch gerade beherrscht, dh * mindestens die erforderliche Stufe hat. Hier können auch Abfragen @@ -277,7 +277,7 @@ typedef struct sc_mage { extern double spellpower(struct region *r, struct unit *u, const struct spell * sp, int cast_level, struct order *ord); /* ermittelt die Stärke eines Spruchs */ - boolean fumble(struct region *r, struct unit *u, const struct spell * sp, + bool fumble(struct region *r, struct unit *u, const struct spell * sp, int cast_level); /* true, wenn der Zauber misslingt, bei false gelingt der Zauber */ @@ -304,7 +304,7 @@ typedef struct sc_mage { /* gibt die für diesen Spruch derzeit notwendigen Magiepunkte auf der * geringstmöglichen Stufe zurück, schon um den Faktor der bereits * zuvor gezauberten Sprüche erhöht */ - boolean cancast(struct unit *u, const struct spell * spruch, int eff_stufe, + bool cancast(struct unit *u, const struct spell * spruch, int eff_stufe, int distance, struct order *ord); /* true, wenn Einheit alle Komponenten des Zaubers (incl. MP) für die * geringstmögliche Stufe hat und den Spruch beherrscht */ @@ -317,13 +317,13 @@ typedef struct sc_mage { /* ermittelt die effektive Stufe des Zaubers. Dabei ist cast_level * die gewünschte maximale Stufe (im Normalfall Stufe des Magiers, * bei Farcasting Stufe*2^Entfernung) */ - boolean is_magic_resistant(struct unit *magician, struct unit *target, int + bool is_magic_resistant(struct unit *magician, struct unit *target, int resist_bonus); /* Mapperfunktion für target_resists_magic() vom Typ struct unit. */ extern double magic_resistance(struct unit *target); /* gibt die Chance an, mit der einem Zauber widerstanden wird. Je * größer, desto resistenter ist da Opfer */ - boolean target_resists_magic(struct unit *magician, void *obj, int objtyp, + bool target_resists_magic(struct unit *magician, void *obj, int objtyp, int resist_bonus); /* gibt false zurück, wenn der Zauber gelingt, true, wenn das Ziel * widersteht */ @@ -339,7 +339,7 @@ typedef struct sc_mage { extern struct attrib_type at_familiar; extern struct attrib_type at_familiarmage; extern void remove_familiar(struct unit *mage); - extern boolean create_newfamiliar(struct unit *mage, struct unit *familiar); + extern bool create_newfamiliar(struct unit *mage, struct unit *familiar); extern void create_newclone(struct unit *mage, struct unit *familiar); extern struct unit *has_clone(struct unit *mage); diff --git a/src/kernel/move.c b/src/kernel/move.c index 993125b43..7eed52d5f 100644 --- a/src/kernel/move.c +++ b/src/kernel/move.c @@ -187,7 +187,7 @@ static attrib_type at_driveweight = { "driveweight", NULL, NULL, NULL, NULL, NULL }; -static boolean entrance_allowed(const struct unit *u, const struct region *r) +static bool entrance_allowed(const struct unit *u, const struct region *r) { #ifdef REGIONOWNERS faction *owner = region_get_owner(r); @@ -372,7 +372,7 @@ static int canwalk(unit * u) return E_CANWALK_TOOHEAVY; } -boolean canfly(unit * u) +bool canfly(unit * u) { if (get_item(u, I_PEGASUS) >= u->number && effskill(u, SK_RIDING) >= 4) return true; @@ -386,7 +386,7 @@ boolean canfly(unit * u) return false; } -boolean canswim(unit * u) +bool canswim(unit * u) { if (get_item(u, I_DOLPHIN) >= u->number && effskill(u, SK_RIDING) >= 4) return true; @@ -448,7 +448,7 @@ static int canride(unit * u) return 0; } -static boolean cansail(const region * r, ship * sh) +static bool cansail(const region * r, ship * sh) { /* sonst ist construction:: size nicht ship_type::maxsize */ assert(!sh->type->construction @@ -584,7 +584,7 @@ ship *move_ship(ship * sh, region * from, region * to, region_list * route) { unit **iunit = &from->units; unit **ulist = &to->units; - boolean trail = (route == NULL); + bool trail = (route == NULL); if (from != to) { translist(&from->ships, &to->ships, sh); @@ -619,7 +619,7 @@ ship *move_ship(ship * sh, region * from, region * to, region_list * route) return sh; } -static boolean is_freezing(const unit * u) +static bool is_freezing(const unit * u) { if (u->race != new_race[RC_INSECT]) return false; @@ -671,7 +671,7 @@ static int is_ship_allowed(struct ship *sh, const region * r) return SA_NO_COAST; } -static boolean flying_ship(const ship * sh) +static bool flying_ship(const ship * sh) { if (sh->type->flags & SFL_FLY) return true; @@ -804,9 +804,9 @@ static void drifting_ships(region * r) } } -static boolean present(region * r, unit * u) +static bool present(region * r, unit * u) { - return (boolean) (u && u->region == r); + return (bool) (u && u->region == r); } static void caught_target(region * r, unit * u) @@ -837,7 +837,7 @@ static unit *bewegung_blockiert_von(unit * reisender, region * r) { unit *u; int perception = 0; - boolean contact = false; + bool contact = false; unit *guard = NULL; if (fval(reisender->race, RCF_ILLUSIONARY)) @@ -871,7 +871,7 @@ static unit *bewegung_blockiert_von(unit * reisender, region * r) return NULL; } -static boolean is_guardian_u(const unit * guard, unit * u, unsigned int mask) +static bool is_guardian_u(const unit * guard, unit * u, unsigned int mask) { if (guard->faction == u->faction) return false; @@ -887,7 +887,7 @@ static boolean is_guardian_u(const unit * guard, unit * u, unsigned int mask) return true; } -static boolean is_guardian_r(const unit * guard) +static bool is_guardian_r(const unit * guard) { if (guard->number == 0) return false; @@ -912,7 +912,7 @@ static boolean is_guardian_r(const unit * guard) return true; } -boolean is_guard(const struct unit * u, int mask) +bool is_guard(const struct unit * u, int mask) { return is_guardian_r(u) && (getguard(u) & mask) != 0; } @@ -1011,8 +1011,8 @@ static void cycle_route(order * ord, unit * u, int gereist) char neworder[2048]; const char *token; direction_t d = NODIRECTION; - boolean paused = false; - boolean pause; + bool paused = false; + bool pause; order *norder; size_t size = sizeof(tail) - 1; @@ -1086,7 +1086,7 @@ static void cycle_route(order * ord, unit * u, int gereist) free_order(norder); } -static boolean transport(unit * ut, unit * u) +static bool transport(unit * ut, unit * u) { order *ord; @@ -1106,7 +1106,7 @@ static boolean transport(unit * ut, unit * u) return false; } -static boolean can_move(const unit * u) +static bool can_move(const unit * u) { if (u->race->flags & RCF_CANNOTMOVE) return false; @@ -1185,7 +1185,7 @@ static void init_transportation(void) } } -static boolean roadto(const region * r, direction_t dir) +static bool roadto(const region * r, direction_t dir) { /* wenn es hier genug strassen gibt, und verbunden ist, und es dort * genug strassen gibt, dann existiert eine strasse in diese richtung */ @@ -1329,7 +1329,7 @@ static int movement_speed(unit * u) { int mp; static const curse_type *speed_ct; - static boolean init = false; + static bool init = false; double dk = u->race->speed; assert(u->number); @@ -1428,7 +1428,7 @@ static const region_list *travel_route(unit * u, region *current = u->region; const region_list *iroute = route_begin; int steps = 0; - boolean landing = false; /* aquarians have landed */ + bool landing = false; /* aquarians have landed */ while (iroute && iroute != route_end) { region *next = iroute->data; @@ -1586,7 +1586,7 @@ static const region_list *travel_route(unit * u, return iroute; } -static boolean ship_ready(const region * r, unit * u) +static bool ship_ready(const region * r, unit * u) { if (!u->ship || u!=ship_owner(u->ship)) { cmistake(u, u->thisorder, 146, MSG_MOVE); @@ -1633,8 +1633,8 @@ unit *owner_buildingtyp(const region * r, const building_type * bt) return NULL; } -boolean -buildingtype_exists(const region * r, const building_type * bt, boolean working) +bool +buildingtype_exists(const region * r, const building_type * bt, bool working) { building *b; @@ -1648,7 +1648,7 @@ buildingtype_exists(const region * r, const building_type * bt, boolean working) /* Prüft, ob Ablegen von einer Küste in eine der erlaubten Richtungen erfolgt. */ -static boolean check_takeoff(ship * sh, region * from, region * to) +static bool check_takeoff(ship * sh, region * from, region * to) { if (!fval(from->terrain, SEA_REGION) && sh->coast != NODIRECTION) { direction_t coast = sh->coast; @@ -1667,7 +1667,7 @@ static boolean check_takeoff(ship * sh, region * from, region * to) } static void -sail(unit * u, order * ord, boolean move_on_land, region_list ** routep) +sail(unit * u, order * ord, bool move_on_land, region_list ** routep) { region *starting_point = u->region; region *current_point, *last_point; @@ -1747,7 +1747,7 @@ sail(unit * u, order * ord, boolean move_on_land, region_list ** routep) && fval(current_point->terrain, SEA_REGION)) { if (!is_cursed(sh->attribs, C_SHIP_NODRIFT, 0)) { region *rnext = NULL; - boolean storm = true; + bool storm = true; int d_offset = rng_int() % MAXDIRECTIONS; direction_t d; /* Sturm nur, wenn nächste Region Hochsee ist. */ @@ -2035,7 +2035,7 @@ static const region_list *travel_i(unit * u, const region_list * route_begin, } else if (!can_move(ut)) { cmistake(u, ord, 99, MSG_MOVE); } else { - boolean found = false; + bool found = false; if (!fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) { init_tokens(ut->thisorder); @@ -2150,7 +2150,7 @@ static void travel(unit * u, region_list ** routep) } -static void move(unit * u, boolean move_on_land) +static void move(unit * u, bool move_on_land) { region_list *route = NULL; @@ -2556,7 +2556,7 @@ void movement(void) region *r = regions; while (r != NULL) { unit **up = &r->units; - boolean repeat = false; + bool repeat = false; while (*up) { unit *u = *up; @@ -2676,7 +2676,7 @@ void follow_unit(unit * u) if (a && !fval(u, UFL_MOVED | UFL_NOTMOVING)) { unit *u2 = a->data.v; - boolean follow = false; + bool follow = false; if (!u2 || u2->region != r || !cansee(u->faction, r, u2, 0)) { return; diff --git a/src/kernel/move.h b/src/kernel/move.h index e53764c29..621510d04 100644 --- a/src/kernel/move.h +++ b/src/kernel/move.h @@ -51,18 +51,18 @@ extern "C" { void movement(void); void run_to(struct unit *u, struct region *to); struct unit *is_guarded(struct region *r, struct unit *u, unsigned int mask); - boolean is_guard(const struct unit *u, int mask); + bool is_guard(const struct unit *u, int mask); int enoughsailors(const struct ship *sh, const struct region *r); - boolean canswim(struct unit *u); - boolean canfly(struct unit *u); + bool canswim(struct unit *u); + bool canfly(struct unit *u); struct unit *get_captain(const struct ship *sh); void travelthru(const struct unit *u, struct region *r); struct ship *move_ship(struct ship *sh, struct region *from, struct region *to, struct region_list *route); int walkingcapacity(const struct unit *u); void follow_unit(struct unit *u); - boolean buildingtype_exists(const struct region *r, - const struct building_type *bt, boolean working); + bool buildingtype_exists(const struct region *r, + const struct building_type *bt, bool working); struct unit *owner_buildingtyp(const struct region *r, const struct building_type *bt); diff --git a/src/kernel/pathfinder.c b/src/kernel/pathfinder.c index c9adf3251..875211deb 100644 --- a/src/kernel/pathfinder.c +++ b/src/kernel/pathfinder.c @@ -28,21 +28,21 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -boolean allowed_swim(const region * src, const region * r) +bool allowed_swim(const region * src, const region * r) { if (fval(r->terrain, SWIM_INTO)) return true; return false; } -boolean allowed_walk(const region * src, const region * r) +bool allowed_walk(const region * src, const region * r) { if (fval(r->terrain, WALK_INTO)) return true; return false; } -boolean allowed_fly(const region * src, const region * r) +bool allowed_fly(const region * src, const region * r) { if (fval(r->terrain, FLY_INTO)) return true; @@ -100,7 +100,7 @@ static void free_nodes(node * root) } struct quicklist *regions_in_range(struct region *start, int maxdist, - boolean(*allowed) (const struct region *, const struct region *)) + bool(*allowed) (const struct region *, const struct region *)) { quicklist * rlist = NULL; node *root = new_node(start, 0, NULL); @@ -140,14 +140,14 @@ struct quicklist *regions_in_range(struct region *start, int maxdist, } static region **internal_path_find(region * start, const region * target, - int maxlen, boolean(*allowed) (const region *, const region *)) + int maxlen, bool(*allowed) (const region *, const region *)) { static region *path[MAXDEPTH + 2]; /* STATIC_RETURN: used for return, not across calls */ direction_t d; node *root = new_node(start, 0, NULL); node **end = &root->next; node *n = root; - boolean found = false; + bool found = false; assert(maxlen <= MAXDEPTH); fset(start, RF_MARK); @@ -190,9 +190,9 @@ static region **internal_path_find(region * start, const region * target, return NULL; } -boolean +bool path_exists(region * start, const region * target, int maxlen, - boolean(*allowed) (const region *, const region *)) + bool(*allowed) (const region *, const region *)) { assert((!fval(start, RF_MARK) && !fval(target, RF_MARK)) || !"Some Algorithm did not clear its RF_MARKs!"); @@ -204,7 +204,7 @@ path_exists(region * start, const region * target, int maxlen, } region **path_find(region * start, const region * target, int maxlen, - boolean(*allowed) (const region *, const region *)) + bool(*allowed) (const region *, const region *)) { assert((!fval(start, RF_MARK) && !fval(target, RF_MARK)) || !"Did you call path_init()?"); diff --git a/src/kernel/pathfinder.h b/src/kernel/pathfinder.h index ac372dc34..6c9edb94e 100644 --- a/src/kernel/pathfinder.h +++ b/src/kernel/pathfinder.h @@ -29,18 +29,18 @@ extern "C" { extern struct region **path_find(struct region *start, const struct region *target, int maxlen, - boolean(*allowed) (const struct region *, const struct region *)); - extern boolean path_exists(struct region *start, const struct region *target, - int maxlen, boolean(*allowed) (const struct region *, + bool(*allowed) (const struct region *, const struct region *)); + extern bool path_exists(struct region *start, const struct region *target, + int maxlen, bool(*allowed) (const struct region *, const struct region *)); - extern boolean allowed_swim(const struct region *src, + extern bool allowed_swim(const struct region *src, const struct region *target); - extern boolean allowed_fly(const struct region *src, + extern bool allowed_fly(const struct region *src, const struct region *target); - extern boolean allowed_walk(const struct region *src, + extern bool allowed_walk(const struct region *src, const struct region *target); extern struct quicklist *regions_in_range(struct region *src, int maxdist, - boolean(*allowed) (const struct region *, const struct region *)); + bool(*allowed) (const struct region *, const struct region *)); extern void pathfinder_cleanup(void); diff --git a/src/kernel/plane.c b/src/kernel/plane.c index 111ebb675..13ea38ce9 100644 --- a/src/kernel/plane.c +++ b/src/kernel/plane.c @@ -309,7 +309,7 @@ int read_plane_reference(plane ** pp, struct storage *store) return AT_READ_OK; } -boolean is_watcher(const struct plane * p, const struct faction * f) +bool is_watcher(const struct plane * p, const struct faction * f) { struct watcher *w; if (!p) diff --git a/src/kernel/plane.h b/src/kernel/plane.h index 685a36c71..c573c096b 100644 --- a/src/kernel/plane.h +++ b/src/kernel/plane.h @@ -73,7 +73,7 @@ extern "C" { struct plane *get_homeplane(void); extern int rel_to_abs(const struct plane *pl, const struct faction *f, int rel, unsigned char index); - extern boolean is_watcher(const struct plane *p, const struct faction *f); + extern bool is_watcher(const struct plane *p, const struct faction *f); extern int resolve_plane(variant data, void *addr); extern void write_plane_reference(const plane * p, struct storage *store); extern int read_plane_reference(plane ** pp, struct storage *store); diff --git a/src/kernel/race.c b/src/kernel/race.c index 48c8b3a4a..95686c56f 100644 --- a/src/kernel/race.c +++ b/src/kernel/race.c @@ -153,7 +153,7 @@ race *rc_find(const char *name) } /** dragon movement **/ -boolean allowed_dragon(const region * src, const region * target) +bool allowed_dragon(const region * src, const region * target) { if (fval(src->terrain, ARCTIC_REGION) && fval(target->terrain, SEA_REGION)) return false; @@ -187,7 +187,7 @@ void set_show_item(faction * f, item_t i) a->data.v = (void *)olditemtype[i]; } -boolean r_insectstalled(const region * r) +bool r_insectstalled(const region * r) { return fval(r->terrain, ARCTIC_REGION); } diff --git a/src/kernel/race.h b/src/kernel/race.h index c7c7c43fc..c6f511d44 100644 --- a/src/kernel/race.h +++ b/src/kernel/race.h @@ -80,7 +80,7 @@ extern "C" { struct att attack[10]; char bonus[MAXSKILLS]; signed char *study_speed; /* study-speed-bonus in points/turn (0=30 Tage) */ - boolean __remove_me_nonplayer; + bool __remove_me_nonplayer; int flags; int battle_flags; int ec_flags; @@ -89,7 +89,7 @@ extern "C" { const char *(*generate_name) (const struct unit *); const char *(*describe) (const struct unit *, const struct locale *); void (*age) (struct unit * u); - boolean(*move_allowed) (const struct region *, const struct region *); + bool(*move_allowed) (const struct region *, const struct region *); struct item *(*itemdrop) (const struct race *, int size); void (*init_familiar) (struct unit *); @@ -176,10 +176,10 @@ extern "C" { #define humanoidrace(rc) (fval((rc), RCF_UNDEAD) || (rc)==new_race[RC_DRACOID] || playerrace(rc)) #define illusionaryrace(rc) (fval(rc, RCF_ILLUSIONARY)) - extern boolean allowed_dragon(const struct region *src, + extern bool allowed_dragon(const struct region *src, const struct region *target); - extern boolean r_insectstalled(const struct region *r); + extern bool r_insectstalled(const struct region *r); extern void add_raceprefix(const char *); extern char **race_prefixes; diff --git a/src/kernel/region.c b/src/kernel/region.c index 6996d959f..bfaaab804 100644 --- a/src/kernel/region.c +++ b/src/kernel/region.c @@ -431,7 +431,7 @@ static int hash_requests; static int hash_misses; #endif -boolean pnormalize(int *x, int *y, const plane * pl) +bool pnormalize(int *x, int *y, const plane * pl) { if (pl) { if (x) { @@ -806,7 +806,7 @@ short rroad(const region * r, direction_t d) return (r == b->from) ? b->data.sa[0] : b->data.sa[1]; } -boolean r_isforest(const region * r) +bool r_isforest(const region * r) { if (fval(r->terrain, FOREST_REGION)) { /* needs to be covered with at leas 48% trees */ @@ -1607,7 +1607,7 @@ int owner_change(const region * r) return -1; } -boolean is_mourning(const region * r, int in_turn) +bool is_mourning(const region * r, int in_turn) { int change = owner_change(r); return (change == in_turn - 1 diff --git a/src/kernel/region.h b/src/kernel/region.h index 4afbfa2f6..88764586a 100644 --- a/src/kernel/region.h +++ b/src/kernel/region.h @@ -157,7 +157,7 @@ extern "C" { typedef struct spec_direction { int x, y; int duration; - boolean active; + bool active; char *desc; char *keyword; } spec_direction; @@ -236,7 +236,7 @@ extern "C" { #define rherbs(r) ((r)->land?(r)->land->herbs:0) #define rsetherbs(r, value) if ((r)->land) ((r)->land->herbs=(short)(value)) - boolean r_isforest(const struct region *r); + bool r_isforest(const struct region *r); #define rterrain(r) (oldterrain((r)->terrain)) #define rsetterrain(r, t) ((r)->terrain = newterrain(t)) @@ -255,7 +255,7 @@ extern "C" { struct region *new_region(int x, int y, struct plane *pl, unsigned int uid); void remove_region(region ** rlist, region * r); void terraform_region(struct region *r, const struct terrain_type *terrain); - boolean pnormalize(int *x, int *y, const struct plane *pl); + bool pnormalize(int *x, int *y, const struct plane *pl); extern const int delta_x[MAXDIRECTIONS]; extern const int delta_y[MAXDIRECTIONS]; @@ -295,7 +295,7 @@ extern "C" { void region_setresource(struct region *r, const struct resource_type *rtype, int value); int owner_change(const region * r); - boolean is_mourning(const region * r, int in_turn); + bool is_mourning(const region * r, int in_turn); const struct item_type *r_luxury(struct region *r); void get_neighbours(const struct region *r, struct region **list); diff --git a/src/kernel/reports.c b/src/kernel/reports.c index e6ae19581..86995cb2d 100644 --- a/src/kernel/reports.c +++ b/src/kernel/reports.c @@ -69,9 +69,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -boolean nocr = false; -boolean nonr = false; -boolean noreports = false; +bool nocr = false; +bool nonr = false; +bool noreports = false; const char *visibility[] = { "none", @@ -141,7 +141,7 @@ const char *hp_status(const unit * u) void report_item(const unit * owner, const item * i, const faction * viewer, - const char **name, const char **basename, int *number, boolean singular) + const char **name, const char **basename, int *number, bool singular) { assert(!owner || owner->number); if (owner && owner->faction == viewer) { @@ -379,7 +379,7 @@ report_resources(const seen_region * sr, resource_report * result, int size, int horses = rhorses(r); int trees = rtrees(r, 2); int saplings = rtrees(r, 1); - boolean mallorn = fval(r, RF_MALLORN) != 0; + bool mallorn = fval(r, RF_MALLORN) != 0; if (money) { if (n >= size) @@ -457,16 +457,16 @@ bufunit(const faction * f, const unit * u, int indent, int mode, char *buf, int getarnt = fval(u, UFL_ANON_FACTION); const char *pzTmp, *str; building *b; - boolean isbattle = (boolean) (mode == see_battle); + bool isbattle = (bool) (mode == see_battle); int telepath_see = 0; attrib *a_fshidden = NULL; item *itm; item *show; faction *fv = visible_faction(f, u); char *bufp = buf; - boolean itemcloak = false; + bool itemcloak = false; static const curse_type *itemcloak_ct = 0; - static boolean init = false; + static bool init = false; int bytes; item result[MAX_INVENTORY]; @@ -774,7 +774,7 @@ bufunit(const faction * f, const unit * u, int indent, int mode, char *buf, } } if (!isbattle) { - boolean printed = 0; + bool printed = 0; order *ord;; for (ord = u->old_orders; ord; ord = ord->next) { if (is_repeated(ord)) { @@ -1095,7 +1095,7 @@ static void get_addresses(report_context * ctx) while (u != NULL) { if (u->faction != ctx->f) { faction *sf = visible_faction(ctx->f, u); - boolean ballied = sf && sf != ctx->f && sf != lastf + bool ballied = sf && sf != ctx->f && sf != lastf && !fval(u, UFL_ANON_FACTION) && cansee(ctx->f, r, u, stealthmod); if (ballied || ALLIED(ctx->f, sf)) { ql_set_insert(&flist, sf); @@ -1208,9 +1208,9 @@ static void get_seen_interval(report_context * ctx) link_seen(ctx->seen, ctx->first, ctx->last); } -boolean +bool add_seen(struct seen_region *seehash[], struct region *r, unsigned char mode, - boolean dis) + bool dis) { seen_region *find = find_seen(seehash, r); if (find == NULL) { @@ -1590,7 +1590,7 @@ static seen_region **prepare_report(faction * f) int write_reports(faction * f, time_t ltime) { int backup = 1, maxbackup = 128; - boolean gotit = false; + bool gotit = false; struct report_context ctx; const char *encoding = "UTF-8"; @@ -2321,7 +2321,7 @@ int report_action(region * r, unit * actor, message * msg, int flags) if (view) { for (u = r->units; u; u = u->next) { if (!fval(u->faction, FFL_SELECT)) { - boolean show = u->faction == actor->faction; + bool show = u->faction == actor->faction; fset(u->faction, FFL_SELECT); if (view == ACTION_CANSEE) { /* Bei Fernzaubern sieht nur die eigene Partei den Magier */ diff --git a/src/kernel/reports.h b/src/kernel/reports.h index e2669de6f..ffd4ee42c 100644 --- a/src/kernel/reports.h +++ b/src/kernel/reports.h @@ -33,12 +33,12 @@ extern "C" { extern const char *directions[]; extern const char *coasts[]; - extern boolean nonr; - extern boolean nocr; - extern boolean noreports; + extern bool nonr; + extern bool nocr; + extern bool noreports; /* kann_finden speedups */ - extern boolean kann_finden(struct faction *f1, struct faction *f2); + extern bool kann_finden(struct faction *f1, struct faction *f2); extern struct unit *can_find(struct faction *, struct faction *); /* funktionen zum schreiben eines reports */ @@ -77,13 +77,13 @@ extern "C" { struct seen_region *next; struct region *r; unsigned char mode; - boolean disbelieves; + bool disbelieves; } seen_region; extern struct seen_region *find_seen(struct seen_region *seehash[], const struct region *r); - extern boolean add_seen(struct seen_region *seehash[], struct region *r, - unsigned char mode, boolean dis); + extern bool add_seen(struct seen_region *seehash[], struct region *r, + unsigned char mode, bool dis); extern struct seen_region **seen_init(void); extern void seen_done(struct seen_region *seehash[]); extern void free_seen(void); @@ -137,7 +137,7 @@ extern "C" { const struct unit *owner, const struct faction *viewer); void report_item(const struct unit *owner, const struct item *i, const struct faction *viewer, const char **name, const char **basename, - int *number, boolean singular); + int *number, bool singular); void report_building(const struct building *b, const char **btype, const char **billusion); void report_race(const struct unit *u, const char **rcname, diff --git a/src/kernel/resources.c b/src/kernel/resources.c index 0cd731869..4a3607d7b 100644 --- a/src/kernel/resources.c +++ b/src/kernel/resources.c @@ -118,7 +118,7 @@ static void terraform_default(struct rawmaterial *res, const region * r) } #ifdef RANDOM_CHANGE -static void resource_random_change(int *pvalue, boolean used) +static void resource_random_change(int *pvalue, bool used) { int split = 5; int rnd = rng_int() % 100; diff --git a/src/kernel/save.c b/src/kernel/save.c index cf7724a96..c8c39b50f 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -132,7 +132,7 @@ FILE *cfopen(const char *filename, const char *mode) int freadstr(FILE * F, int encoding, char *start, size_t size) { char *str = start; - boolean quote = false; + bool quote = false; for (;;) { int c = fgetc(F); @@ -298,7 +298,7 @@ static unit *unitorders(FILE * F, int enc, struct faction *f) stok = parse_token(&stok); if (stok) { - boolean quit = false; + bool quit = false; param_t param = findparam(stok, u->faction->locale); switch (param) { case P_UNIT: diff --git a/src/kernel/skill.c b/src/kernel/skill.c index c25954182..2cdc3d25b 100644 --- a/src/kernel/skill.c +++ b/src/kernel/skill.c @@ -73,7 +73,7 @@ const char *skillnames[MAXSKILLS] = { "unarmed" }; -boolean skill_enabled[MAXSKILLS]; +bool skill_enabled[MAXSKILLS]; const char *skillname(skill_t sk, const struct locale *lang) { @@ -83,7 +83,7 @@ const char *skillname(skill_t sk, const struct locale *lang) return NULL; } -void enable_skill(const char *skname, boolean value) +void enable_skill(const char *skname, bool value) { skill_t sk; for (sk = 0; sk != MAXSKILLS; ++sk) { @@ -260,7 +260,7 @@ int level(int days) { int i; static int ldays[64]; - static boolean init = false; + static bool init = false; if (!init) { init = true; for (i = 0; i != 64; ++i) diff --git a/src/kernel/skill.h b/src/kernel/skill.h index dde1c0721..4db618f5a 100644 --- a/src/kernel/skill.h +++ b/src/kernel/skill.h @@ -48,7 +48,7 @@ extern "C" { extern const char *skillname(skill_t, const struct locale *); extern skill_t sk_find(const char *name); - extern void enable_skill(const char *name, boolean value); + extern void enable_skill(const char *name, bool value); extern int level_days(int level); extern int level(int days); @@ -60,7 +60,7 @@ extern "C" { extern void sk_set(skill * sv, int level); extern const char *skillnames[]; - extern boolean skill_enabled[]; + extern bool skill_enabled[]; #ifdef __cplusplus } diff --git a/src/kernel/sqlite.c b/src/kernel/sqlite.c index 6e6cc5014..b7c9951a3 100644 --- a/src/kernel/sqlite.c +++ b/src/kernel/sqlite.c @@ -73,9 +73,9 @@ typedef struct db_faction { static int db_update_email(sqlite3 * db, const faction * f, const db_faction * dbstate, - boolean force, /* [OUT] */ sqlite3_uint64 * id_email) + bool force, /* [OUT] */ sqlite3_uint64 * id_email) { - boolean update = force; + bool update = force; int res = SQLITE_OK; char email_lc[MAX_EMAIL_LENGTH]; @@ -129,7 +129,7 @@ db_update_email(sqlite3 * db, const faction * f, const db_faction * dbstate, return SQLITE_OK; } -int db_update_factions(sqlite3 * db, boolean force) +int db_update_factions(sqlite3 * db, bool force) { int game_id = 6; const char sql_select[] = @@ -172,7 +172,7 @@ int db_update_factions(sqlite3 * db, boolean force) int i; char passwd_md5[MD5_LENGTH_0]; sqlite3_uint64 id_email; - boolean update = force; + bool update = force; db_faction dbstate; const char *no_b36; @@ -241,7 +241,7 @@ int db_update_factions(sqlite3 * db, boolean force) return SQLITE_OK; } -int db_update_scores(sqlite3 * db, boolean force) +int db_update_scores(sqlite3 * db, bool force) { const char *sql_ins = "INSERT OR FAIL INTO score (value,faction_id,turn) VALUES (?,?,?)"; diff --git a/src/kernel/teleport.c b/src/kernel/teleport.c index 51428f7b8..db5cc646b 100644 --- a/src/kernel/teleport.c +++ b/src/kernel/teleport.c @@ -61,7 +61,7 @@ static region *tpregion(const region * r) return rt; } -region_list *astralregions(const region * r, boolean(*valid) (const region *)) +region_list *astralregions(const region * r, bool(*valid) (const region *)) { region_list *rlist = NULL; int x, y; @@ -116,7 +116,7 @@ region *r_astral_to_standard(const region * r) } region_list *all_in_range(const region * r, int n, - boolean(*valid) (const region *)) + bool(*valid) (const region *)) { int x, y; region_list *rlist = NULL; @@ -171,7 +171,7 @@ plane *get_normalplane(void) return NULL; } -boolean is_astral(const region * r) +bool is_astral(const region * r) { plane *pl = get_astralplane(); return (pl && rplane(r) == pl); @@ -227,7 +227,7 @@ void create_teleport_plane(void) } } -boolean inhabitable(const region * r) +bool inhabitable(const region * r) { return fval(r->terrain, LAND_REGION); } diff --git a/src/kernel/teleport.h b/src/kernel/teleport.h index 2f3a5bcc0..75be6b5d1 100644 --- a/src/kernel/teleport.h +++ b/src/kernel/teleport.h @@ -25,11 +25,11 @@ extern "C" { struct region *r_standard_to_astral(const struct region *r); struct region *r_astral_to_standard(const struct region *); extern struct region_list *astralregions(const struct region *rastral, - boolean(*valid) (const struct region *)); + bool(*valid) (const struct region *)); extern struct region_list *all_in_range(const struct region *r, int n, - boolean(*valid) (const struct region *)); - extern boolean inhabitable(const struct region *r); - extern boolean is_astral(const struct region *r); + bool(*valid) (const struct region *)); + extern bool inhabitable(const struct region *r); + extern bool is_astral(const struct region *r); extern struct plane *get_astralplane(void); extern struct plane *get_normalplane(void); diff --git a/src/kernel/unit.c b/src/kernel/unit.c index c24902076..5aee29ab7 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -612,7 +612,7 @@ void usetcontact(unit * u, const unit * u2) a_add(&u->attribs, a_new(&at_contact))->data.v = (void *)u2; } -boolean ucontact(const unit * u, const unit * u2) +bool ucontact(const unit * u, const unit * u2) /* Prüft, ob u den Kontaktiere-Befehl zu u2 gesetzt hat. */ { attrib *ru; @@ -820,7 +820,7 @@ void leave_building(unit * u) } } -boolean can_leave(unit * u) +bool can_leave(unit * u) { static int rule_leave = -1; @@ -836,7 +836,7 @@ boolean can_leave(unit * u) return true; } -boolean leave(unit * u, boolean force) +bool leave(unit * u, bool force) { if (!force) { if (!can_leave(u)) { @@ -856,7 +856,7 @@ const struct race *urace(const struct unit *u) return u->race; } -boolean can_survive(const unit * u, const region * r) +bool can_survive(const unit * u, const region * r) { if ((fval(r->terrain, WALK_INTO) && (u->race->flags & RCF_WALK)) || (fval(r->terrain, SWIM_INTO) && (u->race->flags & RCF_SWIM)) @@ -891,7 +891,7 @@ void move_unit(unit * u, region * r, unit ** ulist) if (u->ship || u->building) { /* can_leave must be checked in travel_i */ #ifndef NDEBUG - boolean result = leave(u, false); + bool result = leave(u, false); assert(result); #else leave(u, false); @@ -1117,7 +1117,7 @@ void set_number(unit * u, int count) u->number = (unsigned short)count; } -boolean learn_skill(unit * u, skill_t sk, double chance) +bool learn_skill(unit * u, skill_t sk, double chance) { skill *sv = u->skills; if (chance < 1.0 && rng_int() % 10000 >= chance * 10000) @@ -1183,7 +1183,7 @@ skill *get_skill(const unit * u, skill_t sk) return NULL; } -boolean has_skill(const unit * u, skill_t sk) +bool has_skill(const unit * u, skill_t sk) { skill *sv = u->skills; while (sv != u->skills + u->skill_size) { @@ -1224,7 +1224,7 @@ static int item_modification(const unit * u, skill_t sk, int val) static int att_modification(const unit * u, skill_t sk) { double result = 0; - static boolean init = false; + static bool init = false; static const curse_type *skillmod_ct, *gbdream_ct, *worse_ct; curse *c; @@ -1283,7 +1283,7 @@ static int att_modification(const unit * u, skill_t sk) int get_modifier(const unit * u, skill_t sk, int level, const region * r, - boolean noitem) + bool noitem) { int bskill = level; int skill = bskill; diff --git a/src/kernel/unit.h b/src/kernel/unit.h index 7c9e3d8d3..292e6a759 100644 --- a/src/kernel/unit.h +++ b/src/kernel/unit.h @@ -145,7 +145,7 @@ extern "C" { const struct potion_type *ugetpotionuse(const struct unit *u); /* benutzt u einein trank? */ void usetpotionuse(struct unit *u, const struct potion_type *p); /* u benutzt trank p (es darf halt nur einer pro runde) */ - boolean ucontact(const struct unit *u, const struct unit *u2); + bool ucontact(const struct unit *u, const struct unit *u2); void usetcontact(struct unit *u, const struct unit *c); struct unit *findnewunit(const struct region *r, const struct faction *f, @@ -155,7 +155,7 @@ extern "C" { extern struct skill *add_skill(struct unit *u, skill_t id); extern void remove_skill(struct unit *u, skill_t sk); extern struct skill *get_skill(const struct unit *u, skill_t id); - extern boolean has_skill(const unit * u, skill_t sk); + extern bool has_skill(const unit * u, skill_t sk); extern void set_level(struct unit *u, skill_t id, int level); extern int get_level(const struct unit *u, skill_t id); @@ -167,7 +167,7 @@ extern "C" { const struct region *r); extern int get_modifier(const struct unit *u, skill_t sk, int lvl, - const struct region *r, boolean noitem); + const struct region *r, bool noitem); extern int remove_unit(struct unit **ulist, struct unit *u); #define GIFT_SELF 1<<0 @@ -181,8 +181,8 @@ extern "C" { extern void write_unit_reference(const struct unit *u, struct storage *store); extern variant read_unit_reference(struct storage *store); - extern boolean leave(struct unit *u, boolean force); - extern boolean can_leave(struct unit *u); + extern bool leave(struct unit *u, bool force); + extern bool can_leave(struct unit *u); extern void u_set_building(struct unit * u, struct building * b); extern void u_set_ship(struct unit * u, struct ship * sh); @@ -191,7 +191,7 @@ extern "C" { extern void set_leftship(struct unit *u, struct ship *sh); extern struct ship *leftship(const struct unit *); - extern boolean can_survive(const struct unit *u, const struct region *r); + extern bool can_survive(const struct unit *u, const struct region *r); extern void move_unit(struct unit *u, struct region *target, struct unit **ulist); @@ -203,7 +203,7 @@ extern "C" { extern void u_setfaction(struct unit *u, struct faction *f); extern void set_number(struct unit *u, int count); - extern boolean learn_skill(struct unit *u, skill_t sk, double chance); + extern bool learn_skill(struct unit *u, skill_t sk, double chance); extern int invisible(const struct unit *target, const struct unit *viewer); extern void free_unit(struct unit *u); diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index c87f7449a..70da69915 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -51,7 +51,7 @@ without prior permission by the authors of Eressea. #include #include -static boolean gamecode_enabled = false; +static bool gamecode_enabled = false; static building_type *bt_get_or_create(const char *name) { @@ -824,7 +824,7 @@ static weapon_type *xml_readweapon(xmlXPathContextPtr xpath, item_type * itype) assert(propValue != NULL); if (strcmp((const char *)propValue, "attack") == 0) { wtype->attack = - (boolean(*)(const struct troop *, const struct weapon_type *, + (bool(*)(const struct troop *, const struct weapon_type *, int *))fun; } else { log_error("unknown function type '%s' for item '%s'\n", (const char *)propValue, itype->rtype->_name[0]); @@ -938,7 +938,7 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype) struct order *))fun; } else if (strcmp((const char *)propValue, "canuse") == 0) { itype->canuse = - (boolean(*)(const struct unit *, const struct item_type *))fun; + (bool(*)(const struct unit *, const struct item_type *))fun; } else if (strcmp((const char *)propValue, "useonother") == 0) { itype->useonother = (int (*)(struct unit *, int, const struct item_type *, int, @@ -1893,7 +1893,7 @@ static int parse_races(xmlDocPtr doc) rc->age = (void (*)(struct unit *))fun; } else if (strcmp((const char *)propValue, "move") == 0) { rc->move_allowed = - (boolean(*)(const struct region *, const struct region *))fun; + (bool(*)(const struct region *, const struct region *))fun; } else if (strcmp((const char *)propValue, "itemdrop") == 0) { rc->itemdrop = (struct item * (*)(const struct race *, int))fun; } else if (strcmp((const char *)propValue, "initfamiliar") == 0) { @@ -2206,7 +2206,7 @@ static int parse_messages(xmlDocPtr doc) static void xml_readstrings(xmlXPathContextPtr xpath, xmlNodePtr * nodeTab, int nodeNr, - boolean names) + bool names) { int i; @@ -2274,7 +2274,7 @@ static int parse_strings(xmlDocPtr doc) static void xml_readprefixes(xmlXPathContextPtr xpath, xmlNodePtr * nodeTab, int nodeNr, - boolean names) + bool names) { int i; @@ -2344,7 +2344,7 @@ static int parse_main(xmlDocPtr doc) for (i = 0; i != nodes->nodeNr; ++i) { xmlNodePtr node = nodes->nodeTab[i]; xmlChar *propName = xmlGetProp(node, BAD_CAST "name"); - boolean disable = xml_bvalue(node, "disable", false); + bool disable = xml_bvalue(node, "disable", false); if (disable) { int k; @@ -2369,7 +2369,7 @@ static int parse_main(xmlDocPtr doc) for (i = 0; i != nodes->nodeNr; ++i) { xmlNodePtr node = nodes->nodeTab[i]; xmlChar *propName = xmlGetProp(node, BAD_CAST "name"); - boolean enable = xml_bvalue(node, "enable", true); + bool enable = xml_bvalue(node, "enable", true); enable_skill((const char *)propName, enable); xmlFree(propName); } diff --git a/src/modules/autoseed.c b/src/modules/autoseed.c index 9a0b5d233..4a004a0ab 100644 --- a/src/modules/autoseed.c +++ b/src/modules/autoseed.c @@ -104,7 +104,7 @@ static int count_demand(const region * r) static int recurse_regions(region * r, region_list ** rlist, - boolean(*fun) (const region * r)) + bool(*fun) (const region * r)) { if (!fun(r)) return 0; @@ -125,7 +125,7 @@ recurse_regions(region * r, region_list ** rlist, } } -static boolean f_nolux(const region * r) +static bool f_nolux(const region * r) { if (r->land && count_demand(r) != get_maxluxuries()) return true; @@ -337,7 +337,7 @@ static const terrain_type *preferred_terrain(const struct race *rc) #define MINFACTIONS 1 #define VOLCANO_CHANCE 100 -static boolean virgin_region(const region * r) +static bool virgin_region(const region * r) { direction_t d; if (r == NULL) diff --git a/src/modules/autoseed.h b/src/modules/autoseed.h index 254608803..923534020 100644 --- a/src/modules/autoseed.h +++ b/src/modules/autoseed.h @@ -26,7 +26,7 @@ extern "C" { const struct race *race; int bonus; int subscription; - boolean oldregions; + bool oldregions; struct alliance *allies; } newfaction; diff --git a/src/modules/gmcmd.c b/src/modules/gmcmd.c index 5f6caeb0c..78c26e235 100644 --- a/src/modules/gmcmd.c +++ b/src/modules/gmcmd.c @@ -157,7 +157,7 @@ static void gm_create(const void *tnext, struct unit *u, struct order *ord) } } -static boolean has_permission(const attrib * permissions, unsigned int key) +static bool has_permission(const attrib * permissions, unsigned int key) { return (find_key((attrib *) permissions->data.v, key) || find_key((attrib *) permissions->data.v, atoi36("master"))); @@ -600,7 +600,7 @@ faction *gm_addquest(const char *email, const char *name, int radius, plane *pl; watcher *w = calloc(sizeof(watcher), 1); region *center; - boolean invalid = false; + bool invalid = false; int minx, miny, maxx, maxy, cx, cy; int x; faction *f; @@ -716,7 +716,7 @@ plane *gm_addplane(int radius, unsigned int flags, const char *name) { region *center; plane *pl; - boolean invalid = false; + bool invalid = false; int minx, miny, maxx, maxy, cx, cy; int x; diff --git a/src/modules/wormhole.c b/src/modules/wormhole.c index d018c358f..4a4730df3 100644 --- a/src/modules/wormhole.c +++ b/src/modules/wormhole.c @@ -37,7 +37,7 @@ #include #include -static boolean good_region(const region * r) +static bool good_region(const region * r) { return (!fval(r, RF_CHAOTIC) && r->age > 30 && rplane(r) == NULL && r->units != NULL && r->land != NULL); diff --git a/src/platform.h b/src/platform.h index 679737ec2..7e1fd72b4 100644 --- a/src/platform.h +++ b/src/platform.h @@ -247,7 +247,6 @@ extern char *strdup(const char *s); #endif /* ghs || __GNUC__ || ..... */ #include "util/bool.h" -typedef bool boolean; #ifndef INLINE_FUNCTION # define INLINE_FUNCTION diff --git a/src/util/attrib.c b/src/util/attrib.c index f76b48427..ef7674534 100644 --- a/src/util/attrib.c +++ b/src/util/attrib.c @@ -85,7 +85,7 @@ static attrib_type *at_find(unsigned int hk) } attrib *a_select(attrib * a, const void *data, - boolean(*compare) (const attrib *, const void *)) + bool(*compare) (const attrib *, const void *)) { while (a && !compare(a, data)) a = a->next; diff --git a/src/util/attrib.h b/src/util/attrib.h index 47c0e29fd..6096a4cbe 100644 --- a/src/util/attrib.h +++ b/src/util/attrib.h @@ -64,7 +64,7 @@ extern "C" { extern void at_deprecate(const char * name, int (*reader)(attrib *, void *, struct storage *)); extern attrib *a_select(attrib * a, const void *data, - boolean(*compare) (const attrib *, const void *)); + bool(*compare) (const attrib *, const void *)); extern attrib *a_find(attrib * a, const attrib_type * at); extern const attrib *a_findc(const attrib * a, const attrib_type * at); extern attrib *a_add(attrib ** pa, attrib * at); diff --git a/src/util/filereader.c b/src/util/filereader.c index 1b6f79488..12ef3add4 100644 --- a/src/util/filereader.c +++ b/src/util/filereader.c @@ -42,9 +42,9 @@ INLINE_FUNCTION int eatwhite(const char *ptr, size_t * total_size) static const char *getbuf_latin1(FILE * F) { - boolean cont = false; + bool cont = false; char quote = 0; - boolean comment = false; + bool comment = false; char *cp = fbuf; char *tail = lbuf + MAXLINE - 2; @@ -57,8 +57,8 @@ static const char *getbuf_latin1(FILE * F) while (*bp && isxspace(*(unsigned char *)bp)) ++bp; /* eatwhite */ - comment = (boolean) (comment && cont); - quote = (boolean) (quote && cont); + comment = (bool) (comment && cont); + quote = (bool) (quote && cont); if (tail[1] == 0) { /* we read he maximum number of bytes! */ @@ -178,9 +178,9 @@ static const char *getbuf_latin1(FILE * F) static const char *getbuf_utf8(FILE * F) { - boolean cont = false; + bool cont = false; char quote = 0; - boolean comment = false; + bool comment = false; char *cp = fbuf; char *tail = lbuf + MAXLINE - 2; @@ -195,8 +195,8 @@ static const char *getbuf_utf8(FILE * F) eatwhite(bp, &white); /* decoding errors will get caught later on, don't have to check */ bp += white; - comment = (boolean) (comment && cont); - quote = (boolean) (quote && cont); + comment = (bool) (comment && cont); + quote = (bool) (quote && cont); if (tail[1] == 0) { /* we read the maximum number of bytes! */ diff --git a/src/util/listbox.c b/src/util/listbox.c index 0b7403860..ab3dd9eb9 100644 --- a/src/util/listbox.c +++ b/src/util/listbox.c @@ -75,7 +75,7 @@ list_selection *do_selection(list_selection * sel, const char *title, void (*perform) (list_selection *, void *), void *data) { WINDOW *wn; - boolean update = true; + bool update = true; list_selection *s; list_selection *top = sel; list_selection *current = top; diff --git a/src/util/parser.c b/src/util/parser.c index 46d6ba8a8..3634ba541 100644 --- a/src/util/parser.c +++ b/src/util/parser.c @@ -76,7 +76,7 @@ void parser_popstate(void) state = new_state; } -boolean parser_end(void) +bool parser_end(void) { eatwhitespace_c(&state->current_token); return *state->current_token == 0; @@ -126,7 +126,7 @@ const char *parse_token(const char **str) static char lbuf[MAXTOKENSIZE]; /* STATIC_RESULT: used for return, not across calls */ char *cursor = lbuf; char quotechar = 0; - boolean escape = false; + bool escape = false; const char *ctoken = *str; assert(ctoken); @@ -135,7 +135,7 @@ const char *parse_token(const char **str) while (*ctoken && cursor - lbuf < MAXTOKENSIZE - 1) { ucs4_t ucs; size_t len; - boolean copy = false; + bool copy = false; unsigned char utf8_character = *(unsigned char *)ctoken; if (~utf8_character & 0x80) { diff --git a/src/util/parser.h b/src/util/parser.h index dc1ab3717..521987174 100644 --- a/src/util/parser.h +++ b/src/util/parser.h @@ -19,7 +19,7 @@ extern "C" { extern const char *parse_token(const char **str); extern void parser_pushstate(void); extern void parser_popstate(void); - extern boolean parser_end(void); + extern bool parser_end(void); extern const char *getstrtoken(void); #ifdef __cplusplus diff --git a/src/util/rand.c b/src/util/rand.c index ac02786b7..b26bf0c12 100644 --- a/src/util/rand.c +++ b/src/util/rand.c @@ -61,7 +61,7 @@ int ntimespprob(int n, double p, double mod) return count; } -boolean chance(double x) +bool chance(double x) { if (x >= 1.0) return true; diff --git a/src/util/rand.h b/src/util/rand.h index 2c9d6e96b..9223923b9 100644 --- a/src/util/rand.h +++ b/src/util/rand.h @@ -29,7 +29,7 @@ extern "C" { /* in rand.c: */ extern double normalvariate(double mu, double sigma); extern int ntimespprob(int n, double p, double mod); - extern boolean chance(double x); + extern bool chance(double x); #ifdef __cplusplus } diff --git a/src/util/translation.c b/src/util/translation.c index 411b8aee0..e3493f434 100644 --- a/src/util/translation.c +++ b/src/util/translation.c @@ -186,7 +186,7 @@ static const char *parse_symbol(opstack ** stack, const char *in, * result goes on the stack */ { - boolean braces = false; + bool braces = false; char symbol[32]; char *cp = symbol; /* current position */ @@ -239,8 +239,8 @@ static const char *parse_string(opstack ** stack, const char *in, const char *ic = in; char *oc = buffer; /* mode flags */ - boolean f_escape = false; - boolean bDone = false; + bool f_escape = false; + bool bDone = false; variant var; while (*ic && !bDone) { @@ -310,7 +310,7 @@ static const char *parse_int(opstack ** stack, const char *in) { int k = 0; int vz = 1; - boolean ok = false; + bool ok = false; variant var; do { switch (*in) { diff --git a/src/util/xml.c b/src/util/xml.c index 297d8c89b..31a1bb542 100644 --- a/src/util/xml.c +++ b/src/util/xml.c @@ -43,9 +43,9 @@ int xml_ivalue(xmlNodePtr node, const char *name, int dflt) return i; } -boolean xml_bvalue(xmlNodePtr node, const char *name, boolean dflt) +bool xml_bvalue(xmlNodePtr node, const char *name, bool dflt) { - boolean result = dflt; + bool result = dflt; xmlChar *propValue = xmlGetProp(node, BAD_CAST name); if (propValue != NULL) { if (strcmp((const char *)propValue, "no") == 0) @@ -57,10 +57,10 @@ boolean xml_bvalue(xmlNodePtr node, const char *name, boolean dflt) else if (strcmp((const char *)propValue, "true") == 0) result = true; else if (strcmp((const char *)propValue, "1") == 0) { - log_warning("boolean value is '1': %s::%s\n", node->name, name); + log_warning("bool value is '1': %s::%s\n", node->name, name); result = true; } else if (strcmp((const char *)propValue, "0") == 0) { - log_warning("boolean value is '0': %s::%s\n", node->name, name); + log_warning("bool value is '0': %s::%s\n", node->name, name); result = false; } xmlFree(propValue); diff --git a/src/util/xml.h b/src/util/xml.h index f14cbedeb..42b9178bb 100644 --- a/src/util/xml.h +++ b/src/util/xml.h @@ -25,7 +25,7 @@ extern "C" { extern int read_xml(const char *filename, const char *catalog); extern double xml_fvalue(xmlNodePtr node, const char *name, double dflt); extern int xml_ivalue(xmlNodePtr node, const char *name, int dflt); - extern boolean xml_bvalue(xmlNodePtr node, const char *name, boolean dflt); + extern bool xml_bvalue(xmlNodePtr node, const char *name, bool dflt); const xmlChar *xml_i(double number);