bot: revert simd-string changes

This commit is contained in:
jeefo 2023-06-26 10:28:01 +03:00
commit 7bc1704d6a
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
7 changed files with 10 additions and 13 deletions

@ -1 +1 @@
Subproject commit 3e1b576f85c56a1909cb49008b1b23135b390edb
Subproject commit 99c8383ae2fccd6b0263bef92a154e571a0de12d

View file

@ -27,7 +27,7 @@ public:
public:
constexpr bool operator == (const DangerStorage &rhs) const {
return cr::memcmp (rhs.data, data, sizeof (data));
return rhs.data[2] == data[2] && rhs.data[1] == data[1] && rhs.data[0] == data[0];
}
constexpr bool operator != (const DangerStorage &rhs) const {

View file

@ -288,7 +288,7 @@ public:
}
bool isWave (char *format) {
if (little && cr::memcmp (format, "WAVE", 4) == 0) {
if (little && memcmp (format, "WAVE", 4) == 0) {
return true;
}
return *reinterpret_cast <uint32_t *> (format) == 0x57415645;
@ -1174,7 +1174,7 @@ void LightMeasure::updateLight (int style, char *value) {
strings.copy (m_lightstyle[style].map, value, copyLimit);
m_lightstyle[style].map[copyLimit] = kNullChar;
m_lightstyle[style].length = static_cast <int> (cr::strlen (m_lightstyle[style].map));
m_lightstyle[style].length = static_cast <int> (strlen (m_lightstyle[style].map));
}
template <typename S, typename M> bool LightMeasure::recursiveLightPoint (const M *node, const Vector &start, const Vector &end) {

View file

@ -1501,7 +1501,7 @@ bool BotGraph::convertOldFormat () {
return false;
}
if (cr::strncmp (header.header, kPodbotMagic, cr::bufsize (kPodbotMagic)) == 0) {
if (strncmp (header.header, kPodbotMagic, cr::bufsize (kPodbotMagic)) == 0) {
if (header.fileVersion != StorageVersion::Podbot) {
return false;
}

View file

@ -148,7 +148,7 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) {
// the server for incoming clients.
// check if this client is the listen server client
if (cr::strcmp (addr, "loopback") == 0) {
if (strcmp (addr, "loopback") == 0) {
game.setLocalEntity (ent); // save the edict of the listen server client...
// if not dedicated set the default editor for graph
@ -466,7 +466,7 @@ CR_LINKAGE_C int GetEngineFunctions (enginefuncs_t *table, int *) {
if (game.is (GameFlags::Legacy)) {
table->pfnFindEntityByString = [] (edict_t *edictStartSearchAfter, const char *field, const char *value) {
// round starts in counter-strike 1.5
if (cr::strcmp (value, "info_map_parameters") == 0) {
if (strcmp (value, "info_map_parameters") == 0) {
bots.initRound ();
}
@ -885,9 +885,6 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *table, globalvars_t *glob) {
// such if necessary. Nothing really bot-related is done in this function. The actual bot
// initialization stuff will be done later, when we'll be certain to have a multilayer game.
// initialize simd-string functions
simdstring.init ();
// get the engine functions from the game...
memcpy (&engfuncs, table, sizeof (enginefuncs_t));
globals = glob;
@ -965,7 +962,7 @@ SharedLibrary::Func EntityLinkage::lookup (SharedLibrary::Handle module, const c
return m_dlsym (handle, function);
};
if (ents.needsBypass () && !cr::strcmp (function, "CreateInterface")) {
if (ents.needsBypass () && !strcmp (function, "CreateInterface")) {
ents.setPaused (true);
auto ret = resolve (module);

View file

@ -166,7 +166,7 @@ template <typename U> bool BotStorage::load (SmallArray <U> &data, ExtenHeader *
if (extenSize <= actuallyRead) {
// write modified by, only if the name is different
if (!strings.isEmpty (extenHeader.author) && cr::strncmp (extenHeader.author, exten->modified, cr::bufsize (extenHeader.author)) != 0) {
if (!strings.isEmpty (extenHeader.author) && strncmp (extenHeader.author, exten->modified, cr::bufsize (extenHeader.author)) != 0) {
strings.copy (extenHeader.modified, exten->modified, cr::bufsize (exten->modified));
}
}

View file

@ -584,7 +584,7 @@ int32_t BotSupport::sendTo (int socket, const void *message, size_t length, int
constexpr int32_t packetLength = 5;
// player replies response
if (length > packetLength && cr::memcmp (packet, "\xff\xff\xff\xff", packetLength - 1) == 0) {
if (length > packetLength && memcmp (packet, "\xff\xff\xff\xff", packetLength - 1) == 0) {
if (packet[4] == 'D') {
QueryBuffer buffer { packet, length, packetLength };
auto count = buffer.read <uint8_t> ();