#Streamer objects disappearing

1 messages · Page 1 of 1 (latest)

unkempt ginkgo
#

I don't have any static objects that are created in real time, only parking garage floors, interiors and other useful things, but nothing that can overlap with the dynamic objects created in real time.

Obviously I'm not talking about the typical bug where objects disappear when you move away and reappear when you move closer; that's a different bug. When I press F5 I still have plenty of room, especially indoors.

#

I noticed that this happens when I immediately use MoveDynamicObject

magic creek
#

i would start by adjusting all of conditionals like this:

if (IsValidDynamicObject(BarricadeData[i][cadeObject]) && BarricadeData[i][cadeObject]!= STREAMER_TAG_OBJECT:INVALID_STREAMER_ID)

to

if (BarricadeData[i][cadeObject]!= STREAMER_TAG_OBJECT:INVALID_STREAMER_ID)

if there's some part of code that's deleting the wrong objectid, the BarricadeData[i][cadeObject] objectid might become invalid - IsValidDynamicObject returns false so the variable is not reset, some object created later might reuse the objectid - BarricadeData[i][cadeObject] still points to it so any code destroying the barricades stuff might destroy some wrong object later etc which leads to whole chain of destroying invalid objects

and no, passing non-existent objectid to DestroyDynamicObject won't cause any issues and there's no need for extra check if it's valid

#

if you know which exact objects disappear and you're able to mark them somehow on init, then you can try hooking DestroyDynamicObject in a way that gives you details about exact DestroyDynamicObject call (as in file and line)

#
#include <streamer>

// Make sure that this code is before any `DestroyDynamicObject` calls
Hook_DestroyDynamicObject(STREAMER_TAG_OBJECT:objectid, const file[], line)
{
    if (IsValidDynamicObject(objectid) && Streamer_GetIntData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID) == 0xDEADBEEF)
    {
        printf("Server destroyed protected objectid %d (%s:%d)", objectid, file, line);
    }
    return DestroyDynamicObject(objectid);
}

#define DestroyDynamicObject(%0) Hook_DestroyDynamicObject(%0,__file,__line)

then for any object that should be flagged as protected

Streamer_SetIntData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID, 0xDEADBEEF);

obviously the Streamer_SetIntData method is just an example, anything that will allow you to distinguish the particular objects will do the job

#

i'm not sure if the code i posted compiles but it should work after some minor adjustments

unkempt ginkgo
#

Thank you very much, I'll try the hook first and then adjust the conditions. It happens with the furniture system, so I'll apply the flag there.

unkempt ginkgo
magic creek
#

you wont have to rewrite all DestroyDynamicObject calls because that one macro below should handle it

#

Hook_DestroyDynamicObject might need some different name as i dont know if current scheme wont crash the compiler

#

like this

#include <streamer>

// Make sure that this code is before any `DestroyDynamicObject` calls
DestroyDynamicObjectHooked(STREAMER_TAG_OBJECT:objectid, const file[], line)
{
    if (IsValidDynamicObject(objectid) && Streamer_GetIntData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID) == 0xDEADBEEF)
    {
        printf("Server destroyed protected objectid %d (%s:%d)", objectid, file, line);
    }
    return DestroyDynamicObject(objectid);
}

#define DestroyDynamicObject(%0) DestroyDynamicObjectHooked(%0,__file,__line)
unkempt ginkgo
#

But I still have to rewrite for "file" and for "line"

magic creek
#

__file and __line are constants from community compiler

unkempt ginkgo
#

I'm running my server; I'll let you know when I have any updates, but I've already noticed something strange. If it weren't for this tool you gave me, I'd still be lost. Thank you so much 🥰.