//------------------------------------------------------------------------------
void CvDllNetMessageHandler::ResponseLeagueEditName(LeagueTypes eLeague, PlayerTypes ePlayer, const char* szCustomName)
{
	CvAssertMsg(eLeague != NO_LEAGUE, "eLeague invalid");

	CvLeague* pLeague = GC.getGame().GetGameLeagues()->GetLeague(eLeague);
	pLeague->DoChangeCustomName(ePlayer, szCustomName);
}
Example #2
0
//------------------------------------------------------------------------------
//table GetRepealProposalsOnHold();
int CvLuaLeague::lGetRepealProposalsOnHold(lua_State* L) 
{
	CvLeague* pLeague = GetInstance(L);

	lua_createtable(L, 0, 0);
	int iIndex = 1;

	RepealProposalList v = pLeague->GetRepealProposalsOnHold();
	for(RepealProposalList::iterator it = v.begin(); it != v.end(); ++it)
	{
		lua_createtable(L, 0, 0);
		const int t = lua_gettop(L);

		lProposalTableHelper(L, t, (*it));

		lua_pushinteger(L, (*it).GetTargetResolutionID());
		lua_setfield(L, t, "TargetResolutionID");

		lua_pushinteger(L, (*it).GetRepealDecision()->GetDecision());
		lua_setfield(L, t, "RepealDecision");

		lua_rawseti(L, -2, iIndex++);
	}
	return 1;
}
Example #3
0
//------------------------------------------------------------------------------
//PlayerTypes GetHostMember();
int CvLuaLeague::lGetHostMember(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	
	const PlayerTypes eHost = pLeague->GetHostMember();
	lua_pushinteger(L, (int)eHost);
	return 1;
}
Example #4
0
//------------------------------------------------------------------------------
//int GetScienceyGreatPersonRateModifier();
int CvLuaLeague::lGetScienceyGreatPersonRateModifier(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);

	int iValue = pLeague->GetScienceyGreatPersonRateModifier();
	lua_pushinteger(L, iValue);
	return 1;
}
Example #5
0
//------------------------------------------------------------------------------
//int GetSpaceShipPurchaseMod();
int CvLuaLeague::lGetSpaceShipPurchaseMod(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);

	int iValue = pLeague->GetSpaceShipPurchaseMod();
	lua_pushinteger(L, iValue);
	return 1;
}
Example #6
0
//------------------------------------------------------------------------------
//int GetTurnsUntilVictorySession();
int CvLuaLeague::lGetTurnsUntilVictorySession(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);

	const int iValue = pLeague->GetTurnsUntilVictorySession();
	lua_pushinteger(L, iValue);
	return 1;
}
Example #7
0
//------------------------------------------------------------------------------
//bool IsInSpecialSession();
int CvLuaLeague::lIsInSpecialSession(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);

	const bool bValue = pLeague->IsInSpecialSession();
	lua_pushboolean(L, bValue);
	return 1;
}
Example #8
0
//------------------------------------------------------------------------------
//int GetID();
int CvLuaLeague::lGetID(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);

	const int iValue = (int) pLeague->GetID();
	lua_pushinteger(L, iValue);
	return 1;
}
Example #9
0
//------------------------------------------------------------------------------
//bool IsUnitedNations();
int CvLuaLeague::lIsUnitedNations(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);

	const bool bValue = pLeague->IsUnitedNations();
	lua_pushboolean(L, bValue);
	return 1;
}
Example #10
0
//------------------------------------------------------------------------------
//bool CanPropose(PlayerTypes ePlayer);
int CvLuaLeague::lCanPropose(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const PlayerTypes ePlayer = (PlayerTypes) lua_tointeger(L, 2);

	const bool bValue = pLeague->CanPropose(ePlayer);
	lua_pushboolean(L, bValue);
	return 1;
}
Example #11
0
//------------------------------------------------------------------------------
//int CalculateStartingVotesForMember(PlayerTypes ePlayer);
int CvLuaLeague::lCalculateStartingVotesForMember(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const PlayerTypes ePlayer = (PlayerTypes) lua_tointeger(L, 2);

	const int iValue = pLeague->CalculateStartingVotesForMember(ePlayer);
	lua_pushinteger(L, iValue);
	return 1;
}
Example #12
0
//------------------------------------------------------------------------------
//string GetName();
int CvLuaLeague::lGetName(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);

	Localization::String strName = pLeague->GetName();
	const CvString sResult = strName.toUTF8();
	lua_pushstring(L, sResult);
	return 1;
}
Example #13
0
//------------------------------------------------------------------------------
//int GetRemainingProposalsForMember(PlayerTypes ePlayer);
int CvLuaLeague::lGetRemainingProposalsForMember(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const PlayerTypes ePlayer = (PlayerTypes) lua_tointeger(L, 2);

	const int iValue = pLeague->GetRemainingProposalsForMember(ePlayer);
	lua_pushinteger(L, iValue);
	return 1;
}
Example #14
0
//------------------------------------------------------------------------------
//string GetGreatPersonRateModifierDetails(UnitClassTypes eGreatPersonClass);
int CvLuaLeague::lGetGreatPersonRateModifierDetails(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const UnitClassTypes eGreatPersonClass = (UnitClassTypes) lua_tointeger(L, 2);

	CvString sValue = pLeague->GetGreatPersonRateModifierDetails(eGreatPersonClass);
	lua_pushstring(L, sValue.c_str());
	return 1;
}
//------------------------------------------------------------------------------
void CvDllNetMessageHandler::ResponseLeagueVoteAbstain(LeagueTypes eLeague, PlayerTypes eVoter, int iNumVotes)
{
	CvAssertMsg(eLeague != NO_LEAGUE, "eLeague invalid");
	CvAssertMsg(eVoter != NO_PLAYER, "eVoter invalid");

	CvLeague* pLeague = GC.getGame().GetGameLeagues()->GetLeague(eLeague);
	CvAssertMsg(pLeague->CanVote(eVoter), "eVoter not allowed to vote. Please send Anton your save file and version.");
	pLeague->DoVoteAbstain(eVoter, iNumVotes);
}
Example #16
0
//------------------------------------------------------------------------------
//bool IsPlayerEmbargoed(PlayerTypes iPlayer);
int CvLuaLeague::lIsPlayerEmbargoed(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	PlayerTypes ePlayer = (PlayerTypes) lua_tointeger(L, 2);

	const bool bValue = pLeague->IsPlayerEmbargoed(ePlayer);
	lua_pushboolean(L, bValue);
	return 1;
}
Example #17
0
//------------------------------------------------------------------------------
//int GetProjectCost(LeagueProjectTypes eLeagueProject);
int CvLuaLeague::lGetProjectCost(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const LeagueProjectTypes eLeagueProject = (LeagueProjectTypes) lua_tointeger(L, 2);

	const int iValue = pLeague->GetProjectCost(eLeagueProject);
	lua_pushinteger(L, iValue);
	return 1;
}
Example #18
0
//------------------------------------------------------------------------------
//bool IsProjectComplete(LeagueProjectTypes eLeagueProject);
int CvLuaLeague::lIsProjectComplete(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const LeagueProjectTypes eLeagueProject = (LeagueProjectTypes) lua_tointeger(L, 2);

	const bool bValue = pLeague->IsProjectComplete(eLeagueProject);
	lua_pushboolean(L, bValue);
	return 1;
}
Example #19
0
//------------------------------------------------------------------------------
//int GetProjectBuildingCostPerPlayer(BuildingTypes eRewardBuilding);
int CvLuaLeague::lGetProjectBuildingCostPerPlayer(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const BuildingTypes eRewardBuilding = (BuildingTypes) lua_tointeger(L, 2);

	const int iValue = pLeague->GetProjectBuildingCostPerPlayer(eRewardBuilding);
	lua_pushinteger(L, iValue);
	return 1;
}
Example #20
0
//------------------------------------------------------------------------------
//void DoVoteAbstain(PlayerTypes iPlayer, int iNumVotes);
int CvLuaLeague::lDoVoteAbstain(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const PlayerTypes ePlayer = (PlayerTypes) lua_tointeger(L, 2);
	const int iNumVotes = lua_tointeger(L, 3);

	pLeague->DoVoteAbstain(ePlayer, iNumVotes);
	return 0;
}
Example #21
0
//------------------------------------------------------------------------------
//void DoProposeRepeal(int iProposal, PlayerTypes iPlayer);
int CvLuaLeague::lDoProposeRepeal(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const int iProposal = lua_tointeger(L, 2);
	const PlayerTypes ePlayer = (PlayerTypes) lua_tointeger(L, 3);

	pLeague->DoProposeRepeal(iProposal, ePlayer);
	return 0;
}
//------------------------------------------------------------------------------
void CvDllNetMessageHandler::ResponseLeagueProposeRepeal(LeagueTypes eLeague, int iResolutionID, PlayerTypes eProposer)
{
	CvAssertMsg(eLeague != NO_LEAGUE, "eLeague invalid");
	CvAssertMsg(eProposer != NO_PLAYER, "eProposer invalid");

	CvLeague* pLeague = GC.getGame().GetGameLeagues()->GetLeague(eLeague);
	CvAssertMsg(pLeague->CanProposeRepeal(iResolutionID, eProposer), "eProposer not allowed to repeal Resolution. Please send Anton your save file and version.");
	pLeague->DoProposeRepeal(iResolutionID, eProposer);
}
Example #23
0
//------------------------------------------------------------------------------
//string GetLeagueSplashNextEraDetails(LeagueSpecialSessionTypes eGoverningSpecialSession, bool bJustFounded);
int CvLuaLeague::lGetLeagueSplashNextEraDetails(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const LeagueSpecialSessionTypes eGoverningSpecialSession = (LeagueSpecialSessionTypes) lua_tointeger(L, 2);
	const bool bJustFounded = lua_toboolean(L, 3);

	CvString sValue = pLeague->GetLeagueSplashNextEraDetails(eGoverningSpecialSession, bJustFounded);
	lua_pushstring(L, sValue.c_str());
	return 1;
}
Example #24
0
//------------------------------------------------------------------------------
//string GetProjectDetails(LeagueProjectTypes eProject, PlayerTypes eObserver);
int CvLuaLeague::lGetProjectDetails(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const LeagueProjectTypes eProject = (LeagueProjectTypes) lua_tointeger(L, 2);
	const PlayerTypes eObserver = (PlayerTypes) luaL_optint(L, 3, NO_PLAYER);

	CvString sValue = pLeague->GetProjectDetails(eProject, eObserver);
	lua_pushstring(L, sValue.c_str());
	return 1;
}
Example #25
0
//------------------------------------------------------------------------------
//string GetMemberDetails(PlayerTypes eMember, PlayerTypes eObserver);
int CvLuaLeague::lGetMemberDetails(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const PlayerTypes eMember = (PlayerTypes) lua_tointeger(L, 2);
	const PlayerTypes eObserver = (PlayerTypes) lua_tointeger(L, 3);

	CvString sValue = pLeague->GetMemberDetails(eMember, eObserver);
	lua_pushstring(L, sValue.c_str());
	return 1;
}
Example #26
0
//------------------------------------------------------------------------------
//bool CanProposeRepeal(int iResolutionID, PlayerTypes eProposer);
int CvLuaLeague::lCanProposeRepeal(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const int iResolutionID = lua_tointeger(L, 2);
	const PlayerTypes eProposer = (PlayerTypes) lua_tointeger(L, 3);

	const bool bValue = pLeague->CanProposeRepeal(iResolutionID, eProposer);
	lua_pushboolean(L, bValue);
	return 1;
}
Example #27
0
//------------------------------------------------------------------------------
//bool IsProposed(int iResolutionID, bool bRepeal);
int CvLuaLeague::lIsProposed(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const int iResolutionID = lua_tointeger(L, 2);
	const bool bRepeal = lua_toboolean(L, 3);

	const bool bValue = pLeague->IsProposed(iResolutionID, bRepeal);
	lua_pushboolean(L, bValue);
	return 1;
}
Example #28
0
//------------------------------------------------------------------------------
//int GetMemberContributionTier(PlayerTypes ePlayer, LeagueProjectTypes eLeagueProject);
int CvLuaLeague::lGetMemberContributionTier(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const PlayerTypes ePlayer = (PlayerTypes) lua_tointeger(L, 2);
	const LeagueProjectTypes eLeagueProject = (LeagueProjectTypes) lua_tointeger(L, 3);

	const int iValue = pLeague->GetMemberContributionTier(ePlayer, eLeagueProject);
	lua_pushinteger(L, iValue);
	return 1;
}
Example #29
0
//------------------------------------------------------------------------------
//void DoProposeEnact(ResolutionTypes eResolution, PlayerTypes iPlayer, int iChoice=-1);
int CvLuaLeague::lDoProposeEnact(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const ResolutionTypes eResolution = (ResolutionTypes) lua_tointeger(L, 2);
	const PlayerTypes ePlayer = (PlayerTypes) lua_tointeger(L, 3);
	const int iChoice = luaL_optint(L, 4, LeagueHelpers::CHOICE_NONE);

	pLeague->DoProposeEnact(eResolution, ePlayer, iChoice);
	return 0;
}
Example #30
0
//------------------------------------------------------------------------------
//string GetTextForChoice(ResolutionDecisionTypes eDecision, int iChoice);
int CvLuaLeague::lGetTextForChoice(lua_State* L)
{
	CvLeague* pLeague = GetInstance(L);
	const ResolutionDecisionTypes eDecision = (ResolutionDecisionTypes) lua_tointeger(L, 2);
	const int iChoice = lua_tointeger(L, 3);

	const CvString sResult = pLeague->GetTextForChoice(eDecision, iChoice);
	lua_pushstring(L, sResult);
	return 1;
}