mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-09 17:52:08 -10:00
Trunk Sync r6269. I hope this works. This is supposed to be a Trunk overlay merge into Antipodes, which should mean that Antipodes is now a copy of Trunk in all respects.
This commit is contained in:
1 parent
cfc49b7680
commit
3bebbbbcd0
232 files changed
+57599
-7950
No files matched your search
@@ -9,13 +9,14 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "object/parseobjectdock.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "math/bitarray.h"
|
||||
|
||||
|
||||
|
||||
|
||||
// helper prototypes
|
||||
|
||||
void dock_evaluate_tree(p_object *objp, p_dock_function_info *infop, void (*function)(p_object *, p_dock_function_info *), bool *visited_bitstring);
|
||||
void dock_evaluate_tree(p_object *objp, p_dock_function_info *infop, void (*function)(p_object *, p_dock_function_info *), ubyte *visited_bitstring);
|
||||
void dock_dock_docked_children_tree(p_object *objp, p_object *parent_objp);
|
||||
|
||||
|
||||
@@ -114,10 +115,10 @@ void dock_evaluate_all_docked_objects(p_object *objp, p_dock_function_info *info
|
||||
else
|
||||
{
|
||||
// create a bit array to mark the objects we check
|
||||
bool *visited_bitstring = (bool *) malloc( Parse_objects.size() * sizeof(bool) );
|
||||
ubyte *visited_bitstring = (ubyte *) malloc(calculate_num_bytes(Parse_objects.size()));
|
||||
|
||||
// clear it
|
||||
memset(visited_bitstring, 0, Parse_objects.size() * sizeof(bool) );
|
||||
memset(visited_bitstring, 0, calculate_num_bytes(Parse_objects.size()));
|
||||
|
||||
// start evaluating the tree
|
||||
dock_evaluate_tree(objp, infop, function, visited_bitstring);
|
||||
@@ -128,14 +129,14 @@ void dock_evaluate_all_docked_objects(p_object *objp, p_dock_function_info *info
|
||||
}
|
||||
}
|
||||
|
||||
void dock_evaluate_tree(p_object *objp, p_dock_function_info *infop, void (*function)(p_object *, p_dock_function_info *), bool *visited_bitstring)
|
||||
void dock_evaluate_tree(p_object *objp, p_dock_function_info *infop, void (*function)(p_object *, p_dock_function_info *), ubyte *visited_bitstring)
|
||||
{
|
||||
// make sure we haven't visited this object already
|
||||
if ( visited_bitstring[ POBJ_INDEX(objp)] )
|
||||
if (get_bit(visited_bitstring, POBJ_INDEX(objp)))
|
||||
return;
|
||||
|
||||
// mark as visited
|
||||
visited_bitstring[ POBJ_INDEX(objp) ] = true;
|
||||
set_bit(visited_bitstring, POBJ_INDEX(objp));
|
||||
|
||||
// call the function for this object, and return if instructed
|
||||
function(objp, infop);
|
||||
|
||||
Reference in new issue
Block a user