dplayx: Merge the IDirectPlay4_AddGroupToGroup helper.
This commit is contained in:
parent
2e2226dd76
commit
684a666d23
|
@ -98,8 +98,6 @@ static HRESULT DP_IF_SetGroupName
|
||||||
static HRESULT DP_IF_SetPlayerName
|
static HRESULT DP_IF_SetPlayerName
|
||||||
( IDirectPlay2Impl* This, DPID idPlayer, LPDPNAME lpPlayerName,
|
( IDirectPlay2Impl* This, DPID idPlayer, LPDPNAME lpPlayerName,
|
||||||
DWORD dwFlags, BOOL bAnsi );
|
DWORD dwFlags, BOOL bAnsi );
|
||||||
static HRESULT DP_IF_AddGroupToGroup
|
|
||||||
( IDirectPlay3Impl* This, DPID idParentGroup, DPID idGroup );
|
|
||||||
static HRESULT DP_IF_CreateGroup
|
static HRESULT DP_IF_CreateGroup
|
||||||
( IDirectPlay2AImpl* This, LPVOID lpMsgHdr, LPDPID lpidGroup,
|
( IDirectPlay2AImpl* This, LPVOID lpMsgHdr, LPDPID lpidGroup,
|
||||||
LPDPNAME lpGroupName, LPVOID lpData, DWORD dwDataSize,
|
LPDPNAME lpGroupName, LPVOID lpData, DWORD dwDataSize,
|
||||||
|
@ -2975,62 +2973,47 @@ static void DP_CopySessionDesc( LPDPSESSIONDESC2 lpSessionDest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI IDirectPlay4AImpl_AddGroupToGroup( IDirectPlay4A *iface, DPID parent,
|
||||||
static HRESULT DP_IF_AddGroupToGroup
|
DPID group )
|
||||||
( IDirectPlay3Impl* This, DPID idParentGroup, DPID idGroup )
|
|
||||||
{
|
{
|
||||||
lpGroupData lpGData;
|
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
||||||
lpGroupList lpNewGList;
|
return IDirectPlayX_AddGroupToGroup( &This->IDirectPlay4_iface, parent, group );
|
||||||
|
|
||||||
TRACE( "(%p)->(0x%08x,0x%08x)\n", This, idParentGroup, idGroup );
|
|
||||||
|
|
||||||
if( This->dp2->connectionInitialized == NO_PROVIDER )
|
|
||||||
{
|
|
||||||
return DPERR_UNINITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( DP_FindAnyGroup( (IDirectPlay2AImpl*)This, idParentGroup ) == NULL )
|
|
||||||
{
|
|
||||||
return DPERR_INVALIDGROUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( lpGData = DP_FindAnyGroup( (IDirectPlay2AImpl*)This, idGroup ) ) == NULL )
|
|
||||||
{
|
|
||||||
return DPERR_INVALIDGROUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a player list (ie "shortcut" ) */
|
|
||||||
lpNewGList = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpNewGList ) );
|
|
||||||
if( lpNewGList == NULL )
|
|
||||||
{
|
|
||||||
return DPERR_CANTADDPLAYER;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add the shortcut */
|
|
||||||
lpGData->uRef++;
|
|
||||||
lpNewGList->lpGData = lpGData;
|
|
||||||
|
|
||||||
/* Add the player to the list of players for this group */
|
|
||||||
DPQ_INSERT( lpGData->groups, lpNewGList, groups );
|
|
||||||
|
|
||||||
/* Send a ADDGROUPTOGROUP message */
|
|
||||||
FIXME( "Not sending message\n" );
|
|
||||||
|
|
||||||
return DP_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectPlay4AImpl_AddGroupToGroup( IDirectPlay4A *iface, DPID idParentGroup,
|
static HRESULT WINAPI IDirectPlay4Impl_AddGroupToGroup( IDirectPlay4 *iface, DPID parent,
|
||||||
DPID idGroup )
|
DPID group )
|
||||||
{
|
{
|
||||||
IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
|
IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
|
||||||
return DP_IF_AddGroupToGroup( This, idParentGroup, idGroup );
|
lpGroupData gdata;
|
||||||
}
|
lpGroupList glist;
|
||||||
|
|
||||||
static HRESULT WINAPI DirectPlay3WImpl_AddGroupToGroup
|
TRACE( "(%p)->(0x%08x,0x%08x)\n", This, parent, group );
|
||||||
( LPDIRECTPLAY3 iface, DPID idParentGroup, DPID idGroup )
|
|
||||||
{
|
if ( This->dp2->connectionInitialized == NO_PROVIDER )
|
||||||
IDirectPlay3Impl *This = (IDirectPlay3Impl *)iface;
|
return DPERR_UNINITIALIZED;
|
||||||
return DP_IF_AddGroupToGroup( This, idParentGroup, idGroup );
|
|
||||||
|
if ( !DP_FindAnyGroup(This, parent ) )
|
||||||
|
return DPERR_INVALIDGROUP;
|
||||||
|
|
||||||
|
if ( ( gdata = DP_FindAnyGroup(This, group ) ) == NULL )
|
||||||
|
return DPERR_INVALIDGROUP;
|
||||||
|
|
||||||
|
/* Create a player list (ie "shortcut" ) */
|
||||||
|
glist = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *glist ) );
|
||||||
|
if ( !glist )
|
||||||
|
return DPERR_CANTADDPLAYER;
|
||||||
|
|
||||||
|
/* Add the shortcut */
|
||||||
|
gdata->uRef++;
|
||||||
|
glist->lpGData = gdata;
|
||||||
|
|
||||||
|
/* Add the player to the list of players for this group */
|
||||||
|
DPQ_INSERT( gdata->groups, glist, groups );
|
||||||
|
|
||||||
|
/* Send a ADDGROUPTOGROUP message */
|
||||||
|
FIXME( "Not sending message\n" );
|
||||||
|
|
||||||
|
return DP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT DP_IF_CreateGroupInGroup
|
static HRESULT DP_IF_CreateGroupInGroup
|
||||||
|
@ -4436,8 +4419,7 @@ static const IDirectPlay4Vtbl dp4_vt =
|
||||||
IDirectPlay4Impl_SetPlayerData,
|
IDirectPlay4Impl_SetPlayerData,
|
||||||
XCAST(SetPlayerName)DirectPlay2WImpl_SetPlayerName,
|
XCAST(SetPlayerName)DirectPlay2WImpl_SetPlayerName,
|
||||||
XCAST(SetSessionDesc)DirectPlay2WImpl_SetSessionDesc,
|
XCAST(SetSessionDesc)DirectPlay2WImpl_SetSessionDesc,
|
||||||
|
IDirectPlay4Impl_AddGroupToGroup,
|
||||||
XCAST(AddGroupToGroup)DirectPlay3WImpl_AddGroupToGroup,
|
|
||||||
XCAST(CreateGroupInGroup)DirectPlay3WImpl_CreateGroupInGroup,
|
XCAST(CreateGroupInGroup)DirectPlay3WImpl_CreateGroupInGroup,
|
||||||
XCAST(DeleteGroupFromGroup)DirectPlay3WImpl_DeleteGroupFromGroup,
|
XCAST(DeleteGroupFromGroup)DirectPlay3WImpl_DeleteGroupFromGroup,
|
||||||
IDirectPlay4Impl_EnumConnections,
|
IDirectPlay4Impl_EnumConnections,
|
||||||
|
|
Loading…
Reference in New Issue