Also reset all entries when freeing TabList component to 0, hopefully fixes a certain plugin crashing

This commit is contained in:
UnknownShadow200 2020-09-07 14:36:07 +10:00
parent 0877f01775
commit 391c385c2f
2 changed files with 5 additions and 6 deletions

View File

@ -747,17 +747,16 @@ void TabList_Set(EntityID id, const String* player, const String* list, const St
Event_RaiseInt(events, id);
}
static void TabList_Free(void) { StringsBuffer_Clear(&TabList._buffer); }
static void TabList_Reset(void) {
static void TabList_Clear(void) {
Mem_Set(TabList.NameOffsets, 0, sizeof(TabList.NameOffsets));
Mem_Set(TabList.GroupRanks, 0, sizeof(TabList.GroupRanks));
StringsBuffer_Clear(&TabList._buffer);
}
struct IGameComponent TabList_Component = {
NULL, /* Init */
TabList_Free, /* Free */
TabList_Reset /* Reset */
NULL, /* Init */
TabList_Clear, /* Free */
TabList_Clear /* Reset */
};

View File

@ -757,7 +757,7 @@ void Waitable_WaitFor(void* handle, cc_uint32 milliseconds) {
gettimeofday(&tv, NULL);
/* absolute time for some silly reason */
ts.tv_sec = tv.tv_sec + milliseconds / 1000;
ts.tv_sec = tv.tv_sec + milliseconds / 1000;
ts.tv_nsec = 1000 * (tv.tv_usec + 1000 * (milliseconds % 1000));
ts.tv_sec += ts.tv_nsec / NS_PER_SEC;
ts.tv_nsec %= NS_PER_SEC;