Skip to content

Commit

Permalink
CI fixes hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Jun 9, 2024
1 parent f2f3cba commit 0c46df9
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 120 deletions.
6 changes: 3 additions & 3 deletions source/bsp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
21 changes: 12 additions & 9 deletions source/bsp_level.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
//
//------------------------------------------------------------------------

#include <limits.h>
#include <math.h>

#include <algorithm>

#include "bsp_local.h"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
3 changes: 2 additions & 1 deletion source/bsp_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <vector>

#include "bsp.h"
#include "sys_macro.h"

namespace ajbsp
{
Expand Down Expand Up @@ -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);
}
};

Expand Down
28 changes: 14 additions & 14 deletions source/bsp_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion source/bsp_wad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion source/bsp_wad.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <vector>

#include "lib_util.h"
#include "raw_def.h"

namespace ajbsp
Expand Down Expand Up @@ -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);
}
};
};
Expand Down
20 changes: 10 additions & 10 deletions source/csg_doom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down Expand Up @@ -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);
}
};

Expand Down Expand Up @@ -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)
Expand All @@ -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();
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
48 changes: 24 additions & 24 deletions source/dm_extra.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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));
}
Expand Down
Loading

0 comments on commit 0c46df9

Please sign in to comment.