Use std::min

This commit is contained in:
indev committed 2025-07-01 15:15:36 +03:00
1 parent d2bab80b29
commit fca7b4a837
1 file changed
+6 -4
+6 -4
View File
@@ -9,11 +9,13 @@ extern "C" {
#include "w_wad.h"
#include "z_zone.h"
#include "hu_stuff.h"
// Goddammit
#include "v_video.h"
}
// No thanks
#undef min
#undef max
consvar_t cv_emotes = {"emotes", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};;
static std::map<std::string, emote_t> emotes;
@@ -186,11 +188,11 @@ emote_t *M_FindEmote(const char *name, int len, int skip)
return nullptr;
char query[MAXEMOTENAME+1] = {0};
std::strncpy(query, name, min(len, MAXEMOTENAME));
std::strncpy(query, name, std::min(len, MAXEMOTENAME));
for (auto &pair: emotes)
{
if (pair.first.rfind(query, 0, min(len, MAXEMOTENAME)) != 0)
if (pair.first.rfind(query, 0, std::min(len, MAXEMOTENAME)) != 0)
continue;
if (skip > 0)