Skip to content

Commit

Permalink
chore: Sync-up of CI fixes from the Urist PR
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalek committed Dec 7, 2024
1 parent 9cac521 commit 154402d
Show file tree
Hide file tree
Showing 51 changed files with 352 additions and 354 deletions.
Binary file modified GOAI/GOAI.dmb
Binary file not shown.
5 changes: 1 addition & 4 deletions GOAI/GOAI.dme
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
#include "integrations\trading\trade_offer.dm"
#include "integrations\trading\callbacks\abstract_failure.dm"
#include "integrations\trading\callbacks\abstract_success.dm"
#include "integrations\trading\tests\trade_consideration_tests.dm"
#include "integrations\trading\trade_selector_procs\data_driven.dm"
#include "integrations\trading\trade_selector_procs\hardcoded.dm"
#include "integrations\trading\trade_selector_procs\kwarged.dm"
Expand Down Expand Up @@ -167,7 +166,6 @@
#include "integrations\utility_agent\actions\faction\raid.dm"
#include "integrations\utility_agent\actions\faction\subcontract.dm"
#include "integrations\utility_agent\actions\faction\trade.dm"
#include "integrations\utility_agent\actions\faction\trade_debug.dm"
#include "integrations\utility_agent\actions\mob\coverleap.dm"
#include "integrations\utility_agent\actions\mob\flee.dm"
#include "integrations\utility_agent\actions\mob\grenade.dm"
Expand All @@ -189,7 +187,7 @@
#include "integrations\utility_agent\senses\pathservice.dm"
#include "integrations\utility_agent\senses\vision.dm"
#include "integrations\utility_agent\systems\movement_system.dm"
#include "maps\combatmap_utility_plan_test.dmm"
#include "maps\combatmap_tabular_mmo.dmm"
#include "utility\actions.dm"
#include "utility\actionset.dm"
#include "utility\actiontemplate.dm"
Expand Down Expand Up @@ -232,6 +230,5 @@
#include "view_variables\view_variables_global.dm"
#include "view_variables\vv_set_handlers.dm"
#include "Z_testjunk\devmobs.dm"
#include "Z_testjunk\trade.dm"
// END_INCLUDE

Binary file modified GOAI/GOAI.rsc
Binary file not shown.
28 changes: 21 additions & 7 deletions GOAI/_b_debug_modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@
//# define DEBUG_UTILITY_INPUT_FETCHERS 0
//# define PLANNING_CONSIDERATIONS_DEBUG_LOGGING 0
# define MARKETWATCH_DEBUG_LOGGING 0
# define TRADE_DEBUG_LOGGING 0

#endif

#define ENABLE_GOAI_DEVEL_LOGGING 1
#define ENABLE_GOAI_ERROR_LOGGING 1
#define ENABLE_GOAI_DEBUG_BEAM_GIZMOS 1
// Undefine to remove warnings for noncritical WIP code stuff
# define SHOW_GOAI_WIP_WARNINGS 1

// Undefine to disable drawing debug lines pointing at assorted Stuff
# define ENABLE_GOAI_DEBUG_BEAM_GIZMOS 1

# define ENABLE_GOAI_DEVEL_LOGGING 1
# define ENABLE_GOAI_ERROR_LOGGING 1

#ifndef to_world
#define to_world(message) world << (message)
Expand All @@ -57,11 +63,11 @@
# endif

#ifdef ENABLE_GOAI_DEVEL_LOGGING
#define GOAI_LOG_DEVEL(Msg) to_world_log(Msg)
#define GOAI_LOG_DEVEL_WORLD(Msg) to_world(Msg)
#define GOAI_LOG_DEBUG(Msg) to_world_log(Msg)
#define GOAI_LOG_DEBUG_WORLD(Msg) to_world(Msg)
#else
#define GOAI_LOG_DEVEL(Msg)
#define GOAI_LOG_DEVEL_WORLD(Msg)
#define GOAI_LOG_DEBUG(Msg)
#define GOAI_LOG_DEBUG_WORLD(Msg)
#endif

#ifdef ENABLE_GOAI_ERROR_LOGGING
Expand Down Expand Up @@ -202,3 +208,11 @@
# else
# define MARKETWATCH_DEBUG_LOG(X)
# endif

# ifdef TRADE_DEBUG_LOGGING
# define TRADE_DEBUG_LOG(X) to_world_log(X)
# define TRADE_DEBUG_LOG_IF(Pred, X) if(##Pred) { to_world_log(X) };
# else
# define TRADE_DEBUG_LOG(X)
# define TRADE_DEBUG_LOG_IF(Pred, X)
# endif
74 changes: 0 additions & 74 deletions GOAI/_datastructures/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,6 @@
*/



/proc/upsert(var/list/oldassoc, var/list/newassoc)
if(!newassoc)
return oldassoc
else if(!oldassoc)
return newassoc

var/list/merged = list()

for(var/Key in oldassoc)
// upsert to current oldassoc
var/oldVal = oldassoc[Key]
var/newVal = newassoc[Key]

if(oldVal && newVal)
// merge effects
merged[Key] = oldVal + newVal

else if(newVal)
// insert key
merged[Key] = newVal
// if only oldVal, we got it covered already

for(var/effkey in newassoc)
if(effkey in oldassoc)
continue //already handled by the upsert
merged[effkey] = newassoc[effkey]

return merged


# ifdef GOAI_LIBRARY_FEATURES

// Shamelessly ripped from SS13 code:
Expand Down Expand Up @@ -76,49 +45,6 @@
return null


/proc/all_in(var/list/haystack, var/list/needles)
if(!(needles && haystack))
return 0
for(var/item in needles)
if(!(item in haystack))
return 0
return 1


/proc/any_in(var/list/haystack, var/list/needles)
if(haystack)
if(!needles)
return 0
for(var/n in needles)
if(n in haystack)
return 1
return null


/proc/right_disjoint(var/list/haystack, var/list/needles)
if(!haystack)
return needles ? needles.Copy() : list()

var/list/disjoint = list()

for(var/i in needles)
if(!(i in haystack))
disjoint += i
return disjoint


/proc/right_disjoint_assoc(var/list/assoc_haystack, var/list/assoc_needles)
if(!assoc_haystack)
return assoc_needles ? assoc_needles.Copy() : list()

var/list/disjoint = list()

for(var/i in assoc_needles)
if(!(i in assoc_haystack))
disjoint[i] = assoc_needles[i]
return disjoint


/proc/reverse_list_clone(var/list/srclist)
if(isnull(srclist) || !islist(srclist))
return null
Expand Down
35 changes: 20 additions & 15 deletions GOAI/_datastructures/pqueue.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// Actual usable datastructure impls in subclasses, expected to be full overrides on methods.
*/

#ifdef GOAI_LIBRARY_FEATURES
/PriorityQueue
var/list/L //the actual queue
var/cmp //the weight function used to order the queue
Expand All @@ -29,18 +30,18 @@
/PriorityQueue/proc/Dequeue()
return

//Returns the first element in the queue without removing or otherwise mutating the queue
/PriorityQueue/proc/Peek()
return

//Removes an arbitrary item from the queue
/PriorityQueue/proc/Remove(var/idx)
return 0

//return the length of the queue
/PriorityQueue/proc/Length()
return 0
#endif

//Returns the first element in the queue without removing or otherwise mutating the queue
/PriorityQueue/proc/Peek()
return

/*
// Ordered List/Array Bisection-based PQ
Expand All @@ -51,6 +52,16 @@
//an ordered list, using the cmp proc to weight the list elements
/PriorityQueue/OrderedList

//removes and returns the first element in the queue
/PriorityQueue/OrderedList/Peek()
if(!L.len)
return

return L[1]

#ifdef GOAI_LIBRARY_FEATURES
// All things here already defined in the base class if SS13 decl is included

/PriorityQueue/OrderedList/New(compare)
L = list()
cmp = compare
Expand All @@ -71,13 +82,6 @@

Remove(.)

//removes and returns the first element in the queue
/PriorityQueue/OrderedList/Peek()
if(!L.len)
return

return L[1]

//removes an element
/PriorityQueue/OrderedList/Remove(var/idx)
. = L.Remove(idx)
Expand Down Expand Up @@ -111,6 +115,7 @@
while(i > 1 && call(cmp)(L[i],L[i-1]) <= 0) //last inserted element being first in case of ties (optimization)
L.Swap(i,i-1)
i--
#endif


/*
Expand All @@ -134,7 +139,7 @@
#define BH_RCHILD_IDX(ParentIdx) (1+(2*ParentIdx))

// Sort downwards from root - used for heappop and heapify operations
#define BH_PERCOLATE_DOWN(StartIdx, CmpProc, Heap) if(TRUE) {\
#define BH_PERCOLATE_DOWN(StartIdx, CmpProc, Heap) if(!isnull(Heap)) {\
var/__HeapPercolateDown_HeapSize = length(Heap) ;\
var/__HeapPercolateDown_Idx = StartIdx ;\
;\
Expand All @@ -160,7 +165,7 @@
};

// Sort upwards from a subtree to root - used for heappush operations
#define BH_PERCOLATE_UP(StartIdx, CmpProc, Heap) if(TRUE) {\
#define BH_PERCOLATE_UP(StartIdx, CmpProc, Heap) if(!isnull(Heap)) {\
var/__HeapPercolate_CurrentIdx = StartIdx ;\
while(__HeapPercolate_CurrentIdx > 1) {\
var/__HeapPercolate_HeapParentIdx = BH_PARENT_IDX(__HeapPercolate_CurrentIdx) ;\
Expand All @@ -176,7 +181,7 @@

// Turns a (non-assoc) list into a heap
// Leaf nodes are already sorted, so we start from the half-size idx
#define BH_HEAPIFY(List, CmpProc) if(TRUE) {\
#define BH_HEAPIFY(List, CmpProc) if(!isnull(List)) {\
var/__Heapify_HeapSize = length(List) ;\
for(var/idx = FLOOR(__Heapify_HeapSize / 2), idx > 0, idx--) {;\
BH_PERCOLATE_DOWN(idx, CmpProc, List) ;\
Expand All @@ -186,7 +191,7 @@

// Adds a new element to the heap in the appropriate location,
// shuffling the rest as needed
#define BH_HEAPPUSH(Elem, CmpProc, Heap) if(TRUE) {\
#define BH_HEAPPUSH(Elem, CmpProc, Heap) if(!isnull(Heap)) {\
Heap.len++; Heap[Heap.len] = Elem ;\
BH_PERCOLATE_UP(Heap.len, CmpProc, Heap) ;\
};
Expand Down
Loading

0 comments on commit 154402d

Please sign in to comment.