mirror of
https://github.com/alexbatalov/fallout2-ce.git
synced 2024-11-19 14:11:15 +00:00
Add target_remove
This commit is contained in:
parent
05b4c125e6
commit
29e81f3bf4
@ -255,6 +255,42 @@ int target_find_free_subnode(TargetSubNode** subnode_ptr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49BBD4
|
||||
int target_remove(int pid)
|
||||
{
|
||||
TargetNode* node;
|
||||
TargetSubNode* subnode;
|
||||
TargetSubNode* subnode_next;
|
||||
|
||||
node = targetlist.tail;
|
||||
while (node != NULL) {
|
||||
if (node->subnode.field_0 == pid) {
|
||||
break;
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
if (node == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
subnode = node->subnode.next;
|
||||
|
||||
if (node == targetlist.tail) {
|
||||
targetlist.tail = targetlist.tail->next;
|
||||
}
|
||||
|
||||
internal_free(node);
|
||||
|
||||
while (subnode != NULL) {
|
||||
subnode_next = subnode->next;
|
||||
internal_free(subnode);
|
||||
subnode = subnode_next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49BCBC
|
||||
int target_remove_all()
|
||||
{
|
||||
|
@ -56,6 +56,7 @@ int target_header_load();
|
||||
int target_save(int pid);
|
||||
int target_load(int pid, TargetSubNode** subnode_ptr);
|
||||
int target_find_free_subnode(TargetSubNode** subnode_ptr);
|
||||
int target_remove(int pid);
|
||||
int target_remove_all();
|
||||
int target_ptr(int pid, TargetSubNode** subnode_ptr);
|
||||
int target_tid_ptr(int pid, int tid, TargetSubNode** subnode_ptr);
|
||||
|
Loading…
Reference in New Issue
Block a user