PlayerNumber binding
This commit is contained in:
@@ -11,16 +11,8 @@ static const char *PlayerNumberNames[] = {
|
||||
};
|
||||
XToString( PlayerNumber, NUM_PlayerNumber );
|
||||
XToLocalizedString( PlayerNumber );
|
||||
LuaFunction( PlayerNumberToString, PlayerNumberToString((PlayerNumber) IArg(1)) );
|
||||
|
||||
void LuaPlayerNumber(lua_State* L)
|
||||
{
|
||||
FOREACH_PlayerNumber( pn )
|
||||
LUA->SetGlobal( ssprintf("PLAYER_%d",pn+1), pn );
|
||||
LUA->SetGlobal( "NUM_PLAYERS", NUM_PLAYERS );
|
||||
}
|
||||
REGISTER_WITH_LUA_FUNCTION( LuaPlayerNumber );
|
||||
|
||||
LuaFunction( PlayerNumberToString, PlayerNumberToString(Enum::Check<PlayerNumber>(L, 1)) );
|
||||
LuaXType( PlayerNumber );
|
||||
|
||||
static const char *MultiPlayerNames[] = {
|
||||
"P1",
|
||||
|
||||
@@ -19,6 +19,7 @@ enum PlayerNumber
|
||||
const int NUM_PLAYERS = NUM_PlayerNumber;
|
||||
const RString& PlayerNumberToString( PlayerNumber pn );
|
||||
const RString& PlayerNumberToLocalizedString( PlayerNumber pn );
|
||||
LuaDeclareType( PlayerNumber );
|
||||
|
||||
#define FOREACH_PlayerNumber( pn ) FOREACH_ENUM( PlayerNumber, NUM_PLAYERS, pn )
|
||||
#define FOREACH_HumanPlayer( pn ) for( PlayerNumber pn=GetNextHumanPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextHumanPlayer(pn) )
|
||||
|
||||
Reference in New Issue
Block a user