Page 1 of 1

error: ‘bz_changeTeam’ was not declared in this scope

Posted: Sun Oct 08, 2017 12:42 pm
by The Noah
I'm making a plug-in, and when an event is triggered i want to change the player's team. But when i try to compile it (i'm compiling correctly) it gives me the fallowing error:

Code: Select all

error: ‘bz_changeTeam’ was not declared in this scope
i don't know how to fix this. I've search Google and this forum, but found nothing.

Thanks,
The Noah

Re: error: ‘bz_changeTeam’ was not declared in this scope

Posted: Sun Oct 08, 2017 12:59 pm
by Zehra
The bz_changeTeam was a function meant for BZFlag 3.0, which was never released and never back-ported.

From Wiki:

Code: Select all

bz_changeTeam

void bz_changeTeam (int player, bz_eTeamType team)


Changes the team of a player. (v3.0)
Parameters:
player  -  The player who is affected by the team change.
team  -  The team to set the player to.
There is no way to officially change teams, but there is a way to change teams through a third party API written by Allejo called bzToolkit and it supports changing teams without rejoins.

From bzToolkit readme:
A third-party BZFlag plug-in API that consists of functions that do not exist in the official API. There are a lot of functions access BZFS headers directly, a practice that is discouraged, and there are some convenience functions as well.

-Zehra

Re: error: ‘bz_changeTeam’ was not declared in this scope

Posted: Mon Oct 09, 2017 2:28 am
by JeffM
That third party api only works on Linux and will be disabled in a future release

Re: error: ‘bz_changeTeam’ was not declared in this scope

Posted: Mon Oct 09, 2017 10:41 am
by blast
That "third-party API" isn't an API, it's internal bzfs functions and structures that can and will change without notice, breaking plugins that rely on it. BZFlag 2.4.x does not have a mechanism to change a player's team during the game, only cheap hacks.

Re: error: ‘bz_changeTeam’ was not declared in this scope

Posted: Mon Oct 09, 2017 2:09 pm
by The Noah
Well, personally I think y'all should leave it. It makes things better, and adds more functions. Or you could just integrate it into the BZF API.

I don't mean to sound rude, but please leave it or add it into to BZF API, it will make me happy and I'm sure other people happy too.

Thanks,
The Noah

Re: error: ‘bz_changeTeam’ was not declared in this scope

Posted: Mon Oct 09, 2017 4:17 pm
by JeffM
They need to be added to the API, that is the only viable solution.

The reason to remove the lib is that it's calling internal BZFS functions. Because they are internal, they may be changed as bzflag is developed, and that would break this fake API lib. It is incredibly fragile and not a good way to present a public API. Also it does not work on windows.

A public API is the right way to present a public API.

Re: error: ‘bz_changeTeam’ was not declared in this scope

Posted: Mon Oct 09, 2017 5:33 pm
by The Noah
Yes, integrating it is PERFECT! So if you can, in the next release add it in. And to make existing plug-ins that use the 'API', at first have the functions called the same thing. e.g. 'bz_changeTeam' would still be 'bztk_changeTeam'.

The Noah

Re: error: ‘bz_changeTeam’ was not declared in this scope

Posted: Mon Oct 09, 2017 8:48 pm
by JeffM
If they get integrated they will be made consistant with the existing API style. Comparability with existing plug-ins that use the library will be broken. This is required by the very fact that they are NOT calling a real API, it is unavoidable. Plugins that use it now will need to at the very least be rebuilt, at worst require code modifications.

Binary compatibility with a fake API is not our concern, and is one of the main problems with it's very existence. That's what you get for trying to fake out the API :)