1
0
forked from 0ad/0ad

Fixed warnings. Made invalid-player-ID complaint less annoying.

This was SVN commit r1930.
This commit is contained in:
Ykkrosh 2005-02-21 19:49:20 +00:00
parent 7bcc12373b
commit 85a95e3e41
3 changed files with 9 additions and 4 deletions

View File

@ -87,7 +87,7 @@ CPlayer *CGame::GetPlayer(uint idx)
{
if (idx > m_NumPlayers)
{
debug_warn("Invalid player ID");
// debug_warn("Invalid player ID");
LOG(ERROR, "", "Invalid player ID %d (outside 0..%d)", idx, m_NumPlayers);
return m_Players[0];
}

View File

@ -58,6 +58,8 @@ jsval CPlayerSlot::JSI_GetAssignment()
case SLOT_SESSION:
return g_ScriptingHost.UCStringToValue(L"session");
/* case SLOT_AI:*/
default:
return JSVAL_NULL;
}
}
@ -286,7 +288,7 @@ void CGameAttributes::OnNumSlotsUpdate(CSynchedJSObjectBase *owner)
pInstance->m_PlayerUpdateCBData);
pInstance->m_Players.push_back(pNewPlayer);
CPlayerSlot *pNewSlot=new CPlayerSlot(i, pNewPlayer);
CPlayerSlot *pNewSlot=new CPlayerSlot((uint)i, pNewPlayer);
pNewSlot->SetCallback(pInstance->m_PlayerSlotAssignmentCB,
pInstance->m_PlayerSlotAssignmentCBData);
pInstance->m_PlayerSlots.push_back(pNewSlot);
@ -296,7 +298,7 @@ void CGameAttributes::OnNumSlotsUpdate(CSynchedJSObjectBase *owner)
CPlayer *CGameAttributes::GetPlayer(int id)
{
if (id >= 0 && id < m_Players.size())
if (id >= 0 && id < (int)m_Players.size())
return m_Players[id];
else
{
@ -307,7 +309,7 @@ CPlayer *CGameAttributes::GetPlayer(int id)
CPlayerSlot *CGameAttributes::GetSlot(int index)
{
if (index >= 0 && index < m_PlayerSlots.size())
if (index >= 0 && index < (int)m_PlayerSlots.size())
return m_PlayerSlots[index];
else
{

View File

@ -86,4 +86,7 @@ jsval CPlayer::JSI_SetColour( JSContext* cx, uintN argc, jsval* argv )
m_Colour=*( ToNative<SPlayerColour>(argv[0]) );
ISynchedJSProperty *prop=GetSynchedProperty(L"colour");
Update(L"colour", prop);
// Return something that isn't null, so users can check whether this function succeeded
return argv[0];
}