mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[raknet] Remove RPCMap::AddIdentifierAtIndex(...)
This commit is contained in:
parent
12ac4bf95b
commit
5c8db97f0d
@ -104,50 +104,4 @@ void RPCMap::AddIdentifierWithFunction(char *uniqueIdentifier, void *functionPoi
|
|||||||
rpcSet.Insert(node); // No empty spots available so just add to the end of the list
|
rpcSet.Insert(node); // No empty spots available so just add to the end of the list
|
||||||
|
|
||||||
}
|
}
|
||||||
void RPCMap::AddIdentifierAtIndex(char *uniqueIdentifier, RPCIndex insertionIndex)
|
|
||||||
{
|
|
||||||
#ifdef _DEBUG
|
|
||||||
assert(uniqueIdentifier && uniqueIdentifier[0]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned existingNodeIndex;
|
|
||||||
RPCNode *node, *oldNode;
|
|
||||||
|
|
||||||
existingNodeIndex=GetIndexFromFunctionName(uniqueIdentifier);
|
|
||||||
|
|
||||||
if (existingNodeIndex==insertionIndex)
|
|
||||||
return; // Already there
|
|
||||||
|
|
||||||
if ((RPCIndex)existingNodeIndex!=UNDEFINED_RPC_INDEX)
|
|
||||||
{
|
|
||||||
// Delete the existing one
|
|
||||||
oldNode=rpcSet[existingNodeIndex];
|
|
||||||
rpcSet[existingNodeIndex]=0;
|
|
||||||
delete [] oldNode->uniqueIdentifier;
|
|
||||||
delete oldNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
node = new RPCNode;
|
|
||||||
node->uniqueIdentifier = new char [strlen(uniqueIdentifier)+1];
|
|
||||||
strcpy(node->uniqueIdentifier, uniqueIdentifier);
|
|
||||||
node->functionPointer=0;
|
|
||||||
|
|
||||||
// Insert at a user specified spot
|
|
||||||
if (insertionIndex < rpcSet.Size())
|
|
||||||
{
|
|
||||||
// Overwrite what is there already
|
|
||||||
oldNode=rpcSet[insertionIndex];
|
|
||||||
if (oldNode)
|
|
||||||
{
|
|
||||||
delete [] oldNode->uniqueIdentifier;
|
|
||||||
delete oldNode;
|
|
||||||
}
|
|
||||||
rpcSet[insertionIndex]=node;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Insert after the end of the list and use 0 as a filler for the empty spots
|
|
||||||
rpcSet.Replace(node, 0, insertionIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -38,8 +38,6 @@ public:
|
|||||||
RPCNode *GetNodeFromFunctionName(char *uniqueIdentifier);
|
RPCNode *GetNodeFromFunctionName(char *uniqueIdentifier);
|
||||||
RPCIndex GetIndexFromFunctionName(char *uniqueIdentifier);
|
RPCIndex GetIndexFromFunctionName(char *uniqueIdentifier);
|
||||||
void AddIdentifierWithFunction(char *uniqueIdentifier, void *functionPointer, bool isPointerToMember);
|
void AddIdentifierWithFunction(char *uniqueIdentifier, void *functionPointer, bool isPointerToMember);
|
||||||
void AddIdentifierAtIndex(char *uniqueIdentifier, RPCIndex insertionIndex);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DataStructures::List<RPCNode *> rpcSet;
|
DataStructures::List<RPCNode *> rpcSet;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user