diff --git a/source/bsp.cc b/source/bsp.cc index 86e009276..484c4f4dc 100644 --- a/source/bsp.cc +++ b/source/bsp.cc @@ -63,10 +63,10 @@ bool CheckMapInRange(const map_range_t *range, const char *name) if (strlen(name) != strlen(range->low)) return false; - if (strcmp(name, range->low) < 0) + if (StringCompare(name, range->low) < 0) return false; - if (strcmp(name, range->high) > 0) + if (StringCompare(name, range->high) > 0) return false; return true; @@ -252,7 +252,7 @@ void ParseMapRange(char *tok, buildinfo_t *build_info) if (low[0] != high[0]) build_info->FatalError("bad map range (%s and %s start with different letters)\n", low, high); - if (strcmp(low, high) > 0) + if (StringCompare(low, high) > 0) build_info->FatalError("bad map range (wrong order, %s > %s)\n", low, high); // Ok diff --git a/source/bsp_level.cc b/source/bsp_level.cc index bf0124cf7..a915f9727 100644 --- a/source/bsp_level.cc +++ b/source/bsp_level.cc @@ -18,6 +18,9 @@ // //------------------------------------------------------------------------ +#include +#include + #include #include "bsp_local.h" @@ -192,10 +195,10 @@ static void BlockAddLine(const linedef_t *L) int x2 = (int)L->end->x; int y2 = (int)L->end->y; - int bx1 = (std::min(x1, x2) - block_x) / 128; - int by1 = (std::min(y1, y2) - block_y) / 128; - int bx2 = (std::max(x1, x2) - block_x) / 128; - int by2 = (std::max(y1, y2) - block_y) / 128; + int bx1 = (OBSIDIAN_MIN(x1, x2) - block_x) / 128; + int by1 = (OBSIDIAN_MIN(y1, y2) - block_y) / 128; + int bx2 = (OBSIDIAN_MAX(x1, x2) - block_x) / 128; + int by2 = (OBSIDIAN_MAX(y1, y2) - block_y) / 128; int bx, by; int line_index = L->index; @@ -511,10 +514,10 @@ static void FindBlockmapLimits(bbox_t *bbox) double x2 = L->end->x; double y2 = L->end->y; - int lx = (int)floor(std::min(x1, x2)); - int ly = (int)floor(std::min(y1, y2)); - int hx = (int)ceil(std::max(x1, x2)); - int hy = (int)ceil(std::max(y1, y2)); + int lx = (int)floor(OBSIDIAN_MIN(x1, x2)); + int ly = (int)floor(OBSIDIAN_MIN(y1, y2)); + int hx = (int)ceil(OBSIDIAN_MAX(x1, x2)); + int hy = (int)ceil(OBSIDIAN_MAX(y1, y2)); if (lx < bbox->minx) bbox->minx = lx; @@ -1563,7 +1566,7 @@ void ParseUDMF() { char buffer[4096]; - int want = std::min(remain, (int)sizeof(buffer)); + int want = OBSIDIAN_MIN(remain, (int)sizeof(buffer)); if (!lump->Read(buffer, want)) cur_info->FatalError("Error reading TEXTMAP lump.\n"); diff --git a/source/bsp_local.h b/source/bsp_local.h index b7614a775..9fed0abeb 100644 --- a/source/bsp_local.h +++ b/source/bsp_local.h @@ -24,6 +24,7 @@ #include #include "bsp.h" +#include "sys_macro.h" namespace ajbsp { @@ -215,7 +216,7 @@ class linedef_t public: double MinX() const { - return std::min(start->x, end->x); + return OBSIDIAN_MIN(start->x, end->x); } }; diff --git a/source/bsp_node.cc b/source/bsp_node.cc index fd43108d7..e55d055f6 100644 --- a/source/bsp_node.cc +++ b/source/bsp_node.cc @@ -391,9 +391,9 @@ bool EvalPartitionWorker(quadtree_c *tree, seg_t *part, double best_cost, eval_i // the cost. if (a <= DIST_EPSILON || b <= DIST_EPSILON) - qnty = IFFY_LEN / std::max(a, b); + qnty = IFFY_LEN / OBSIDIAN_MAX(a, b); else - qnty = IFFY_LEN / std::min(a, b); + qnty = IFFY_LEN / OBSIDIAN_MIN(a, b); info->cost += 70.0 * split_cost * (qnty * qnty - 1.0); continue; @@ -415,9 +415,9 @@ bool EvalPartitionWorker(quadtree_c *tree, seg_t *part, double best_cost, eval_i // the closer the miss, the higher the cost (see note above) if (a >= -DIST_EPSILON || b >= -DIST_EPSILON) - qnty = IFFY_LEN / -std::min(a, b); + qnty = IFFY_LEN / -OBSIDIAN_MIN(a, b); else - qnty = IFFY_LEN / -std::max(a, b); + qnty = IFFY_LEN / -OBSIDIAN_MAX(a, b); info->cost += 70.0 * split_cost * (qnty * qnty - 1.0); continue; @@ -448,7 +448,7 @@ bool EvalPartitionWorker(quadtree_c *tree, seg_t *part, double best_cost, eval_i info->iffy++; // the closer to the end, the higher the cost - qnty = IFFY_LEN / std::min(fa, fb); + qnty = IFFY_LEN / OBSIDIAN_MIN(fa, fb); info->cost += 140.0 * split_cost * (qnty * qnty - 1.0); } } @@ -804,10 +804,10 @@ void FindLimits2(seg_t *list, bbox_t *bbox) double x2 = list->end->x; double y2 = list->end->y; - int lx = (int)floor(std::min(x1, x2) - 0.2); - int ly = (int)floor(std::min(y1, y2) - 0.2); - int hx = (int)ceil(std::max(x1, x2) + 0.2); - int hy = (int)ceil(std::max(y1, y2) + 0.2); + int lx = (int)floor(OBSIDIAN_MIN(x1, x2) - 0.2); + int ly = (int)floor(OBSIDIAN_MIN(y1, y2) - 0.2); + int hx = (int)ceil(OBSIDIAN_MAX(x1, x2) + 0.2); + int hy = (int)ceil(OBSIDIAN_MAX(y1, y2) + 0.2); if (lx < bbox->minx) bbox->minx = lx; @@ -1008,11 +1008,11 @@ void quadtree_c::AddSeg(seg_t *seg) if (subs[0] != NULL) { - double x_min = std::min(seg->start->x, seg->end->x); - double y_min = std::min(seg->start->y, seg->end->y); + double x_min = OBSIDIAN_MIN(seg->start->x, seg->end->x); + double y_min = OBSIDIAN_MIN(seg->start->y, seg->end->y); - double x_max = std::max(seg->start->x, seg->end->x); - double y_max = std::max(seg->start->y, seg->end->y); + double x_max = OBSIDIAN_MAX(seg->start->x, seg->end->x); + double y_max = OBSIDIAN_MAX(seg->start->y, seg->end->y); if ((x2 - x1) >= (y2 - y1)) { @@ -1462,7 +1462,7 @@ int ComputeBspHeight(const node_t *node) int right = ComputeBspHeight(node->r.node); int left = ComputeBspHeight(node->l.node); - return std::max(left, right) + 1; + return OBSIDIAN_MAX(left, right) + 1; } #if DEBUG_BUILDER diff --git a/source/bsp_wad.cc b/source/bsp_wad.cc index bb575ce22..88229285f 100644 --- a/source/bsp_wad.cc +++ b/source/bsp_wad.cc @@ -461,7 +461,7 @@ int Wad_file::LevelFindByNumber(int number) return index; // otherwise try E#M# - sprintf(buffer, "E%dM%d", std::max(1, number / 10), number % 10); + sprintf(buffer, "E%dM%d", OBSIDIAN_MAX(1, number / 10), number % 10); index = LevelFind(buffer); if (index >= 0) diff --git a/source/bsp_wad.h b/source/bsp_wad.h index 095741760..1af443f0f 100644 --- a/source/bsp_wad.h +++ b/source/bsp_wad.h @@ -21,6 +21,7 @@ #include +#include "lib_util.h" #include "raw_def.h" namespace ajbsp @@ -319,7 +320,7 @@ class Wad_file const Lump_c *L1 = wad->directory[A]; const Lump_c *L2 = wad->directory[B]; - return (strcmp(L1->Name(), L2->Name()) < 0); + return (StringCompare(L1->Name(), L2->Name()) < 0); } }; }; diff --git a/source/csg_doom.cc b/source/csg_doom.cc index 46d2444e1..4487691be 100644 --- a/source/csg_doom.cc +++ b/source/csg_doom.cc @@ -109,8 +109,8 @@ class extrafloor_c (u_light == other->u_light) && (u_special == other->u_special) && (u_tag == other->u_tag) && - (strcmp(top.c_str(), other->top.c_str()) == 0) && (strcmp(bottom.c_str(), other->bottom.c_str()) == 0) && - (strcmp(wall.c_str(), other->wall.c_str()) == 0); + (StringCompare(top.c_str(), other->top.c_str()) == 0) && (StringCompare(bottom.c_str(), other->bottom.c_str()) == 0) && + (StringCompare(wall.c_str(), other->wall.c_str()) == 0); } }; @@ -389,8 +389,8 @@ class sidedef_c inline bool SameTex(const sidedef_c *T) const { - return (strcmp(mid.c_str(), T->mid.c_str()) == 0) && (strcmp(lower.c_str(), T->lower.c_str()) == 0) && - (strcmp(upper.c_str(), T->upper.c_str()) == 0); + return (StringCompare(mid.c_str(), T->mid.c_str()) == 0) && (StringCompare(lower.c_str(), T->lower.c_str()) == 0) && + (StringCompare(upper.c_str(), T->upper.c_str()) == 0); } }; @@ -769,7 +769,7 @@ class linedef_c { if (!back && !P->back) { - return (strcmp(front->mid.c_str(), P->front->mid.c_str()) == 0); + return (StringCompare(front->mid.c_str(), P->front->mid.c_str()) == 0); } if (back && P->back) @@ -787,8 +787,8 @@ class linedef_c // now L is single sided and P is double sided. // allow either upper or lower to match - return (strcmp(L->front->mid.c_str(), P->front->lower.c_str()) == 0) || - (strcmp(L->front->mid.c_str(), P->front->upper.c_str()) == 0); + return (StringCompare(L->front->mid.c_str(), P->front->lower.c_str()) == 0) || + (StringCompare(L->front->mid.c_str(), P->front->upper.c_str()) == 0); } void Write(); @@ -2833,7 +2833,7 @@ static sector_c *FindDepotPeer() for (auto *E : R->entities) { - if (strcmp(E->id.c_str(), "oblige_depot") == 0) + if (StringCompare(E->id.c_str(), "oblige_depot") == 0) { return S; } @@ -2860,7 +2860,7 @@ void ProcessSecrets() for (auto *E : R->entities) { - if (strcmp(E->id.c_str(), "oblige_secret") == 0) + if (StringCompare(E->id.c_str(), "oblige_secret") == 0) { S->special = 9; } @@ -3008,7 +3008,7 @@ static void AddThing_FraggleScript(int x, int y, int z, csg_entity_c *E, int typ static void WriteThing(sector_c *S, csg_entity_c *E) { // ignore light entities and boxes - if (strcmp(E->id.c_str(), "light") == 0 || strncmp(E->id.c_str(), "oblige_", 7) == 0) + if (StringCompare(E->id.c_str(), "light") == 0 || strncmp(E->id.c_str(), "oblige_", 7) == 0) { return; } diff --git a/source/dm_extra.cc b/source/dm_extra.cc index c6609c005..2cd355b37 100644 --- a/source/dm_extra.cc +++ b/source/dm_extra.cc @@ -1048,7 +1048,7 @@ static bool IsLevelLump(const char *name) { for (int i = 0; i < NUM_LEVEL_LUMPS; i++) { - if (strcmp(name, level_lumps[i]) == 0) + if (StringCompare(name, level_lumps[i]) == 0) { return true; } @@ -1835,19 +1835,19 @@ int title_set_palette(lua_State *L) static void TitleParsePen(const char *what) { - if (strcmp(what, "circle") == 0) + if (StringCompare(what, "circle") == 0) { title_drawctx.pen_type = PEN_Circle; } - else if (strcmp(what, "box") == 0) + else if (StringCompare(what, "box") == 0) { title_drawctx.pen_type = PEN_Box; } - else if (strcmp(what, "slash") == 0) + else if (StringCompare(what, "slash") == 0) { title_drawctx.pen_type = PEN_Slash; } - else if (strcmp(what, "slash2") == 0) + else if (StringCompare(what, "slash2") == 0) { title_drawctx.pen_type = PEN_Slash2; } @@ -1857,31 +1857,31 @@ static void TitleParseRenderMode(const char *what) { // Note: REND_Textured is handled differently - if (strcmp(what, "solid") == 0) + if (StringCompare(what, "solid") == 0) { title_drawctx.render_mode = REND_Solid; } - else if (strcmp(what, "additive") == 0) + else if (StringCompare(what, "additive") == 0) { title_drawctx.render_mode = REND_Additive; } - else if (strcmp(what, "subtract") == 0) + else if (StringCompare(what, "subtract") == 0) { title_drawctx.render_mode = REND_Subtract; } - else if (strcmp(what, "multiply") == 0) + else if (StringCompare(what, "multiply") == 0) { title_drawctx.render_mode = REND_Multiply; } - else if (strcmp(what, "gradient") == 0) + else if (StringCompare(what, "gradient") == 0) { title_drawctx.render_mode = REND_Gradient; } - else if (strcmp(what, "gradient3") == 0) + else if (StringCompare(what, "gradient3") == 0) { title_drawctx.render_mode = REND_Gradient3; } - else if (strcmp(what, "random") == 0) + else if (StringCompare(what, "random") == 0) { title_drawctx.render_mode = REND_Random; } @@ -1905,51 +1905,51 @@ int title_property(lua_State *L) const char *propname = luaL_checkstring(L, 1); - if (strcmp(propname, "reset") == 0) + if (StringCompare(propname, "reset") == 0) { title_drawctx.Reset(); } - else if (strcmp(propname, "color") == 0 || strcmp(propname, "color1") == 0) + else if (StringCompare(propname, "color") == 0 || StringCompare(propname, "color1") == 0) { title_drawctx.color[0] = Grab_Color(L, 2); } - else if (strcmp(propname, "color2") == 0) + else if (StringCompare(propname, "color2") == 0) { title_drawctx.color[1] = Grab_Color(L, 2); } - else if (strcmp(propname, "color3") == 0) + else if (StringCompare(propname, "color3") == 0) { title_drawctx.color[2] = Grab_Color(L, 2); } - else if (strcmp(propname, "color4") == 0) + else if (StringCompare(propname, "color4") == 0) { title_drawctx.color[3] = Grab_Color(L, 2); } - else if (strcmp(propname, "box_w") == 0) + else if (StringCompare(propname, "box_w") == 0) { title_drawctx.box_w = luaL_checkinteger(L, 2); } - else if (strcmp(propname, "box_h") == 0) + else if (StringCompare(propname, "box_h") == 0) { title_drawctx.box_h = luaL_checkinteger(L, 2); } - else if (strcmp(propname, "grad_y1") == 0) + else if (StringCompare(propname, "grad_y1") == 0) { title_drawctx.grad_y1 = luaL_checkinteger(L, 2); } - else if (strcmp(propname, "grad_y2") == 0) + else if (StringCompare(propname, "grad_y2") == 0) { title_drawctx.grad_y2 = luaL_checkinteger(L, 2); } - else if (strcmp(propname, "pen_type") == 0) + else if (StringCompare(propname, "pen_type") == 0) { TitleParsePen(luaL_checkstring(L, 2)); } - else if (strcmp(propname, "render_mode") == 0) + else if (StringCompare(propname, "render_mode") == 0) { TitleParseRenderMode(luaL_checkstring(L, 2)); } - else if (strcmp(propname, "texture") == 0) + else if (StringCompare(propname, "texture") == 0) { TitleParseTexture(L, luaL_checkstring(L, 2)); } diff --git a/source/m_cookie.cc b/source/m_cookie.cc index 7fe01a87c..e2858362d 100644 --- a/source/m_cookie.cc +++ b/source/m_cookie.cc @@ -340,14 +340,14 @@ void Cookie_ParseArguments(void) continue; } - if (strcmp(arg.c_str(), "@@") == 0) + if (StringCompare(arg.c_str(), "@@") == 0) { active_module.clear(); continue; } // support an isolated "=", like in: FOO = 3 - if (i + 2 < argv::list.size() && strcmp(argv::list[i + 1].c_str(), "=") == 0 && argv::list[i + 2][0] != '-') + if (i + 2 < argv::list.size() && StringCompare(argv::list[i + 1].c_str(), "=") == 0 && argv::list[i + 2][0] != '-') { Cookie_SetValue(arg, argv::list[i + 2]); i += 2; diff --git a/source/m_lua.cc b/source/m_lua.cc index 70eb360a5..46f997bae 100644 --- a/source/m_lua.cc +++ b/source/m_lua.cc @@ -2195,7 +2195,7 @@ bool ob_build_cool_shit() // remove result from lua stack lua_pop(LUA_ST, 1); - if (res && strcmp(res, "ok") == 0) + if (res && StringCompare(res, "ok") == 0) { return true; } diff --git a/source/poly_wad.cc b/source/poly_wad.cc index 2a496d03e..b9df6d7e6 100644 --- a/source/poly_wad.cc +++ b/source/poly_wad.cc @@ -16,6 +16,7 @@ // //------------------------------------------------------------------------ +#include "lib_util.h" #include "poly_local.h" #define DEBUG_WAD 0 @@ -44,7 +45,7 @@ int CheckLevelLump(const char *name) { for (int i = 0; level_lumps[i]; i++) { - if (strcmp(name, level_lumps[i]) == 0) + if (StringCompare(name, level_lumps[i]) == 0) { return 1 + i; } @@ -263,7 +264,7 @@ int wad_c::FindLump(const char *name, int level) { lump_c *L = lumps[i]; - if (strcmp(L->name, name) == 0 && L->children == 0) + if (StringCompare(L->name, name) == 0 && L->children == 0) { return i; } @@ -283,7 +284,7 @@ int wad_c::FindLevel(const char *name) continue; } - if (name[0] == '*' || (strcmp(L->name, name) == 0)) + if (name[0] == '*' || (StringCompare(L->name, name) == 0)) { return i; } diff --git a/source/slump.cc b/source/slump.cc index 667af746e..9aa21e778 100644 --- a/source/slump.cc +++ b/source/slump.cc @@ -36,6 +36,7 @@ #include "lib_util.h" #include "m_lua.h" +#include "sys_macro.h" #include "sys_xoshiro.h" extern const char *ob_gettext(const char *s); @@ -902,7 +903,7 @@ flat *find_flat(config *c, const char *name) flat *t = NULL; for (t = c->flat_anchor; t; t = t->next) - if (!strcmp(name, t->name)) + if (!StringCompare(name, t->name)) return t; return new_flat(c, name); } @@ -1057,7 +1058,7 @@ texture *find_texture(config *c, const char *name) texture *t = NULL; for (t = c->texture_anchor; t; t = t->next) - if (!strcmp(name, t->name)) + if (!StringCompare(name, t->name)) return t; return new_texture(c, name); } @@ -1408,7 +1409,7 @@ config *get_config(std::string filename) { int low = StringToInt(ob_get_param("float_minrooms_slump_lb")); int high = StringToInt(ob_get_param("float_minrooms_slump_ub")); - answer->minrooms = xoshiro_Between(std::min(low, high), std::max(low, high)); + answer->minrooms = xoshiro_Between(OBSIDIAN_MIN(low, high), OBSIDIAN_MAX(low, high)); } else { @@ -11075,49 +11076,49 @@ propertybits absorb_propertybit(char **r) p = *r; - if ((!slump_stricmp(p, "wall")) || (!strcmp(p, "w"))) + if ((!StringCaseCompare(p, "wall")) || (!StringCompare(p, "w"))) return WALL; - if ((!slump_stricmp(p, "isswitch")) || (!strcmp(p, "i"))) + if ((!StringCaseCompare(p, "isswitch")) || (!StringCompare(p, "i"))) return SWITCH; - if ((!slump_stricmp(p, "lift")) || (!strcmp(p, "F"))) + if ((!StringCaseCompare(p, "lift")) || (!StringCompare(p, "F"))) return LIFT_TEXTURE; - if ((!slump_stricmp(p, "support")) || (!strcmp(p, "I"))) + if ((!StringCaseCompare(p, "support")) || (!StringCompare(p, "I"))) return SUPPORT; - if ((!slump_stricmp(p, "jamb")) || (!strcmp(p, "j"))) + if ((!StringCaseCompare(p, "jamb")) || (!StringCompare(p, "j"))) return JAMB; - if ((!slump_stricmp(p, "step")) || (!strcmp(p, "e"))) + if ((!StringCaseCompare(p, "step")) || (!StringCompare(p, "e"))) return STEP; - if ((!slump_stricmp(p, "grating")) || (!strcmp(p, "g"))) + if ((!StringCaseCompare(p, "grating")) || (!StringCompare(p, "g"))) return GRATING; - if ((!slump_stricmp(p, "plaque")) || (!strcmp(p, "p"))) + if ((!StringCaseCompare(p, "plaque")) || (!StringCompare(p, "p"))) return PLAQUE; - if ((!slump_stricmp(p, "vtiles")) || (!strcmp(p, "v"))) + if ((!StringCaseCompare(p, "vtiles")) || (!StringCompare(p, "v"))) return VTILES; - if ((!slump_stricmp(p, "half_plaque")) || (!strcmp(p, "H"))) + if ((!StringCaseCompare(p, "half_plaque")) || (!StringCompare(p, "H"))) return HALF_PLAQUE; - if ((!slump_stricmp(p, "light")) || (!strcmp(p, "l"))) + if ((!StringCaseCompare(p, "light")) || (!StringCompare(p, "l"))) return LIGHT; - if ((!slump_stricmp(p, "exitswitch")) || (!strcmp(p, "E"))) + if ((!StringCaseCompare(p, "exitswitch")) || (!StringCompare(p, "E"))) return EXITSWITCH; - if ((!slump_stricmp(p, "door")) || (!strcmp(p, "d"))) + if ((!StringCaseCompare(p, "door")) || (!StringCompare(p, "d"))) return DOOR; - if ((!slump_stricmp(p, "locked")) || (!strcmp(p, "L"))) + if ((!StringCaseCompare(p, "locked")) || (!StringCompare(p, "L"))) return GATE; - if ((!slump_stricmp(p, "outside")) || (!strcmp(p, "o"))) + if ((!StringCaseCompare(p, "outside")) || (!StringCompare(p, "o"))) return OUTDOOR; - if ((!slump_stricmp(p, "red")) || (!strcmp(p, "r"))) + if ((!StringCaseCompare(p, "red")) || (!StringCompare(p, "r"))) return RED; - if ((!slump_stricmp(p, "blue")) || (!strcmp(p, "b"))) + if ((!StringCaseCompare(p, "blue")) || (!StringCompare(p, "b"))) return BLUE; - if ((!slump_stricmp(p, "yellow")) || (!strcmp(p, "y"))) + if ((!StringCaseCompare(p, "yellow")) || (!StringCompare(p, "y"))) return YELLOW; - if ((!slump_stricmp(p, "floor")) || (!strcmp(p, "D"))) + if ((!StringCaseCompare(p, "floor")) || (!StringCompare(p, "D"))) return FLOOR; - if ((!slump_stricmp(p, "ceiling")) || (!strcmp(p, "U"))) + if ((!StringCaseCompare(p, "ceiling")) || (!StringCompare(p, "U"))) return CEILING; - if ((!slump_stricmp(p, "nukage")) || (!strcmp(p, "n"))) + if ((!StringCaseCompare(p, "nukage")) || (!StringCompare(p, "n"))) return NUKAGE; - if ((!slump_stricmp(p, "gate")) || (!strcmp(p, "G"))) + if ((!StringCaseCompare(p, "gate")) || (!StringCompare(p, "G"))) return GATE; return 0; @@ -11133,17 +11134,17 @@ gamebits absorb_gamebit(char **r) p = *r; - if ((!slump_stricmp(p, "nodoom0")) || (!strcmp(p, "0"))) + if ((!StringCaseCompare(p, "nodoom0")) || (!StringCompare(p, "0"))) return DOOM0_BIT; - if ((!slump_stricmp(p, "nodoom1")) || (!strcmp(p, "1"))) + if ((!StringCaseCompare(p, "nodoom1")) || (!StringCompare(p, "1"))) return DOOM1_BIT; - if ((!slump_stricmp(p, "nodoom2")) || (!strcmp(p, "2"))) + if ((!StringCaseCompare(p, "nodoom2")) || (!StringCompare(p, "2"))) return DOOM2_BIT; - if ((!slump_stricmp(p, "gross")) || (!strcmp(p, "Q"))) + if ((!StringCaseCompare(p, "gross")) || (!StringCompare(p, "Q"))) return DOOMC_BIT; - if ((!slump_stricmp(p, "custom")) || (!strcmp(p, "u"))) + if ((!StringCaseCompare(p, "custom")) || (!StringCompare(p, "u"))) return DOOMI_BIT; - if ((!slump_stricmp(p, "heretic")) || (!strcmp(p, "R"))) + if ((!StringCaseCompare(p, "heretic")) || (!StringCompare(p, "R"))) return HERETIC_BIT; // "R" for Raven, since "H" is already used return 0; @@ -11161,7 +11162,7 @@ char *absorb_theme(char *p, config *c) name = p; q = p + 1 + strlen(p); - if ((!slump_stricmp(q, "secret")) || (!strcmp(q, "?"))) + if ((!StringCaseCompare(q, "secret")) || (!StringCompare(q, "?"))) { p = q; b = SLUMP_TRUE; @@ -11180,7 +11181,7 @@ themebits themebit_for_name(char *name, config *c) for (t = c->theme_anchor; t; t = t->next) { - if (!slump_stricmp(t->name, name)) + if (!StringCaseCompare(t->name, name)) return answer; answer <<= 1; } @@ -11193,7 +11194,7 @@ themebits themebit_for_name(char *name, config *c) char *absorb_string(char **r, const char *ln, const char *sn) { /* Needs more error-checking. Input Is Evil. */ - if (slump_stricmp(*r, ln) && strcmp(*r, sn)) + if (StringCaseCompare(*r, ln) && StringCompare(*r, sn)) return NULL; (*r) += 1 + strlen(*r); /* That's the name */ return *r; @@ -11304,12 +11305,12 @@ char *absorb_texture(char *p, config *c) t->height = n; continue; } - if ((!slump_stricmp(q, "error")) || (!slump_stricmp(q, "!"))) + if ((!StringCaseCompare(q, "error")) || (!StringCaseCompare(q, "!"))) { c->error_texture = t; continue; } - if ((!slump_stricmp(q, "gateexitsign")) || (!slump_stricmp(q, "X"))) + if ((!StringCaseCompare(q, "gateexitsign")) || (!StringCaseCompare(q, "X"))) { c->gate_exitsign_texture = t; continue; @@ -11358,12 +11359,12 @@ char *absorb_flat(char *p, config *c) f->compatible |= tb; continue; } - if ((!slump_stricmp(q, "sky")) || (!slump_stricmp(q, "K"))) + if ((!StringCaseCompare(q, "sky")) || (!StringCaseCompare(q, "K"))) { c->sky_flat = f; continue; } - if ((!slump_stricmp(q, "water")) || (!slump_stricmp(q, "W"))) + if ((!StringCaseCompare(q, "water")) || (!StringCaseCompare(q, "W"))) { c->water_flat = f; continue; @@ -11420,7 +11421,7 @@ boolean absorb_cell(construct *x, char **r, const char *ln, const char *sn, bool short s, t; p = *r; - if (slump_stricmp(p, ln) && strcmp(p, sn)) + if (StringCaseCompare(p, ln) && StringCompare(p, sn)) return SLUMP_FALSE; p += 1 + strlen(p); /* That's the name */ name = p; @@ -11516,7 +11517,7 @@ boolean nonswitch_config(config *c) /* Skip to the "[THEMES]" section */ for (p = c->configdata->data(); *p; p += 1 + strlen(p)) - if (!slump_stricmp("[themes]", p)) + if (!StringCaseCompare("[themes]", p)) break; if (!*p) { @@ -11528,17 +11529,17 @@ boolean nonswitch_config(config *c) { if (p[0] == '[') break; /* End of section */ - if ((!strcmp(p, "T")) || (!slump_stricmp(p, "theme"))) + if ((!StringCompare(p, "T")) || (!StringCaseCompare(p, "theme"))) p = absorb_theme(p, c); - else if ((!strcmp(p, "t")) || (!slump_stricmp(p, "texture"))) + else if ((!StringCompare(p, "t")) || (!StringCaseCompare(p, "texture"))) p = absorb_texture(p, c); - else if ((!strcmp(p, "f")) || (!slump_stricmp(p, "flat"))) + else if ((!StringCompare(p, "f")) || (!StringCaseCompare(p, "flat"))) p = absorb_flat(p, c); - else if ((!strcmp(p, "x")) || (!slump_stricmp(p, "construct"))) + else if ((!StringCompare(p, "x")) || (!StringCaseCompare(p, "construct"))) p = absorb_construct(p, c); - else if ((!strcmp(p, ".")) || (!slump_stricmp(p, "thing"))) + else if ((!StringCompare(p, ".")) || (!StringCaseCompare(p, "thing"))) p = absorb_thing(p, c); - else if ((!strcmp(p, "#")) || (!slump_stricmp(p, "hardwired1"))) + else if ((!StringCompare(p, "#")) || (!StringCaseCompare(p, "hardwired1"))) hardwired_nonswitch_nontheme_config(c); else { diff --git a/source/slump.h b/source/slump.h index 72228af2e..4d7a3ac7e 100644 --- a/source/slump.h +++ b/source/slump.h @@ -63,11 +63,6 @@ typedef unsigned char boolean; typedef unsigned char byte; -#ifndef USE_STRICMP -#define slump_stricmp(x, y) strcasecmp(x, y) -#define slump_strnicmp(x, y, n) strncasecmp(x, y, n) -#endif - #ifdef OK_TO_USE_REAL_MONSTER_WIDTH #define MONSTER_WIDTH(m) (m->width) #else diff --git a/source/sys_macro.h b/source/sys_macro.h index 72d38a5a7..31ec5886f 100644 --- a/source/sys_macro.h +++ b/source/sys_macro.h @@ -22,6 +22,8 @@ #ifndef SYS_MACRO_H_ #define SYS_MACRO_H_ +#include + // basic constants constexpr uint16_t MSG_BUF_LEN = 2000; constexpr double DIST_EPSILON = (1.0 / 1024.0);