Page 1 of 1

Bug in wc3:ft

Posted: Mon Jun 30, 2008 8:51 am
by DarkAngel
Heyho,

Sorry that I post here but if I go under Bug reports then comes there I have no access to that section...

Whatever. I think I've found a "bug" in wc3ft. If you look in the war3ft.inl then you will find there the function wc3_bevorespawn.
This function will called for every player bevore the spawn. Allright. But you load in wc3_bevorespawn the function SHARED_CopySavedWeapons for every player although you only need to load this function once per round. And the ID parameter is useless there I think.

Thanks for attentation.
DarkAngel aka DA

Re: Bug in wc3:ft

Posted: Mon Jun 30, 2008 8:55 am
by Geesu
You don't need to load it once per round... You need to load it EVERY time a weapon changes...

Also - what issue are you having on the bug report section? you can't login?

Re: Bug in wc3:ft

Posted: Mon Jun 30, 2008 9:31 am
by DarkAngel
Geesu wrote:You don't need to load it once per round... You need to load it EVERY time a weapon changes...

Also - what issue are you having on the bug report section? you can't login?
I talk about SHARED_CopySavedWeapons NOT SHARED_SaveWeapons.
Look in the shared.inl you will see the problem...

I'm already logged in.

Code: Select all

You are not authorised to read this forum.

Re: Bug in wc3:ft

Posted: Mon Jun 30, 2008 10:56 am
by Geesu
What link are you clicking when it says that?

Also - I don't entirely understand what the issue is - where are you saying it should copy instead? And why? I believe it's currently working fine.

Re: Bug in wc3:ft

Posted: Mon Jun 30, 2008 12:07 pm
by DarkAngel
events.inl - In the EVENT_NewRound()

Code: Select all

// User's have not spawned yet, so lets do some pre-spawn things
	new players[32], numplayers, i;
	get_players( players, numplayers );
	for ( i = 0; i < numplayers; i++ )
	{
		WC3_BeforeSpawn( players[i] );
	}
You loop through all players and start for every player the WC3_BeforeSpawn function. That's okay. Now look in the WC3_BeforeSpawn function.

Code: Select all

// Save a copy of what weapons the user had the previous round (for weapon reincarnation)
	SHARED_CopySavedWeapons( id );
Here we are in a critical situation. You start for every player this function:

Code: Select all

// Copy the weapons over right before reset hud is called, that way we don't lose our last round weapons when the round restarts
public SHARED_CopySavedWeapons( id )
{
	for ( new i = 0; i < 33; i++ )
	{
		for ( new j = 0; j < 32; j++ )
		{
			g_PlayerLastWeapons[i][j] = g_PlayerWeapons[i][j];
		}
	}
}
This function copy one array to another array. But you do this for every player. I think your first idea of this function was this:

Code: Select all

// Copy the weapons over right before reset hud is called, that way we don't lose our last round weapons when the round restarts
public SHARED_CopySavedWeapons( id )
{
	for ( new j = 0; j < 32; j++ )
	{
		g_PlayerLastWeapons[id][j] = g_PlayerWeapons[id][j];
	}
}
Now you understand? It's actually not a bug but it takes many CPU usage...
What link are you clicking when it says that?
The link on the forumindex. But I see you have fixed it. Thanks :)

Re: Bug in wc3:ft

Posted: Mon Jun 30, 2008 12:35 pm
by Geesu
haha I get it now :P that's a funny bug - can you add to bug reports pls? :-)

Opps

Re: Bug in wc3:ft

Posted: Mon Jun 30, 2008 12:49 pm
by DarkAngel
Done. :)