void PlayerServer::Update()
{
    Player::Update();

    Vector3 oldLocation = GetLocation();
    Vector3 oldVelocity = GetVelocity();

    if ( mControlType == PCT_HUMAN )
    {
        ClientProxyPtr client =
            NetworkManagerServer::sInstance->GetClientProxy( GetPlayerId() );

        if ( !client )
        {
            LOG( "NO HUMANC CONTROLING THIS, IT HAS BECOME SENTIENT RUN" );
            return;
        }

        MoveList& moveList = client->GetUnprocessedMoveList();
        for ( const Move& unprocessedMove : moveList )
        {
            const InputState& currentState = unprocessedMove.GetInputState();

            float deltaTime = unprocessedMove.GetDeltaTime();
            ProcessInput( deltaTime, currentState );
            SimulateMovement( TIME_STEP );
        }
        moveList.Clear();

        // TODO: Check if there velocity has actually changed before sending
        // update
        NetworkManagerServer::sInstance->SetStateDirty( GetNetworkId(),
                                                        PRS_POSI );
    }
}
void RoboCatServer::Update()
{
	RoboCat::Update();
	
	Vector3 oldLocation = GetLocation();
	Vector3 oldVelocity = GetVelocity();
	float oldRotation = GetRotation();

	ClientProxyPtr client = NetworkManagerServer::sInstance->GetClientProxy( GetPlayerId() );
	if( client )
	{
		MoveList& moveList = client->GetUnprocessedMoveList();
		for( const Move& unprocessedMove : moveList )
		{
			const InputState& currentState = unprocessedMove.GetInputState();
			float deltaTime = unprocessedMove.GetDeltaTime();
			ProcessInput( deltaTime, currentState );
			SimulateMovement( deltaTime );
		}

		moveList.Clear();
	}

	HandleShooting();

	if( !RoboMath::Is2DVectorEqual( oldLocation, GetLocation() ) ||
		!RoboMath::Is2DVectorEqual( oldVelocity, GetVelocity() ) ||
		oldRotation != GetRotation() )
	{
		NetworkManagerServer::sInstance->SetStateDirty( GetNetworkId(), ECRS_Pose );
	}
}
ECode CWifiP2pGroupList::Remove(
    /* [in] */ const String& deviceAddress)
{
    Int32 networkId;
    GetNetworkId(deviceAddress, &networkId);
    return Remove(networkId);
}
static BOOL SubmitExpiredTypoExceptions(StringTimeNode *expired)
{
	HttpResult *httpRes = NULL;
	JsonEl *json = NULL;
	char *jsonTxt = NULL;
	BOOL res = TRUE;

	if (!expired)
		return FALSE;

	char *networkId = GetNetworkId();
	if (!networkId)
		return FALSE;

	char *toDelete = GetNamesAsCommaSeparatedString(expired);
	if (!toDelete)
		return FALSE;
	slogfmt("Removing expired typo exceptions: %s\n", toDelete);
	CString params = ApiParamsNetworkTypoExceptionsRemove(g_pref_token, networkId, toDelete);
	const char *paramsTxt = TStrToStr(params);
	const char *apiHost = GetApiHost();
	bool apiHostIsHttps = IsApiHostHttps();
	httpRes = HttpPost(apiHost, API_URL, paramsTxt, apiHostIsHttps);
	free((void*)paramsTxt);
	if (!httpRes || !httpRes->IsValid())
		goto Error;

	DWORD dataSize;
	jsonTxt = (char *)httpRes->data.getData(&dataSize);
	if (!jsonTxt)
		goto Error;

	// we log the server's json response if there was an error, but ignore
	// the error otherwise
	json = ParseJsonToDoc(jsonTxt);
	if (!json)
		goto Exit;
	WebApiStatus status = GetApiStatus(json);
	if (WebApiStatusSuccess != status) {
		slog("SubmitExpiredTypoExceptions() bad api status. json: ");
		slognl(jsonTxt);
	}

Exit:
	JsonElFree(json);
	delete httpRes;
	return res;
Error:
	res = FALSE;
	goto Exit;
}
void RoboCatServer::TakeDamage( int inDamagingPlayerId )
{
	mHealth--;
	if( mHealth <= 0.f )
	{
		//score one for damaging player...
		ScoreBoardManager::sInstance->IncScore( inDamagingPlayerId, 1 );

		//and you want to die
		SetDoesWantToDie( true );

		//tell the client proxy to make you a new cat
		ClientProxyPtr clientProxy = NetworkManagerServer::sInstance->GetClientProxy( GetPlayerId() );
		if( clientProxy )
		{
			clientProxy->HandleCatDied();
		}
	}

	//tell the world our health dropped
	NetworkManagerServer::sInstance->SetStateDirty( GetNetworkId(), ECRS_Health );
}