Is it safe to assume all Units/Projectiles (synced and unsynced) will be created in Sim code?
I'm optimizing the ProjectileHandler and the above assumption simplifies things a great deal...
Creation of objects
Moderator: Moderators
Re: Creation of objects
If "Sim code" includes synced Lua callouts and possibly Game.cpp (where is /give handled?) then I think that is right.
How does it simplify things?
How does it simplify things?
Re: Creation of objects
Well, if object creation is limited to a single thread, I can create projectiles without using any synchronization at all. Creating synced objects in non-Sim code wouldn't be very clever, but I was a bit concerned about unsynced projectiles and that someone might want to create them in a rendering thread.
Also, u have a clue what this code is supposed to accomplish?
The array accesses itself upon initialization. Hmm.
Also, u have a clue what this code is supposed to accomplish?
Code: Select all
void CLightningProjectile::DrawOnMinimap(CVertexArray& lines, CVertexArray& points)
{
- unsigned char color[4] = {(unsigned char)color[0]*255,(unsigned char)color[1]*255,(unsigned char)color[2]*255,255};
Re: Creation of objects
Code: Select all
class CLightningProjectile ... {
...
float3 color; // float3 overloads operator []
}
Re: Creation of objects
confusing code is confusing. suggest adding this-> in that initialization.