You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -479,7 +501,7 @@ ADE_INDEXER(l_Mission_Waypoints, "number Index", "Array of waypoints in the curr
479
501
object *ptr = GET_FIRST(&obj_used_list);
480
502
while (ptr != END_OF_LIST(&obj_used_list))
481
503
{
482
-
if (ptr->type == OBJ_WAYPOINT)
504
+
if (ptr->type == OBJ_WAYPOINT && !ptr->flags[Object::Object_Flags::Should_be_dead])
483
505
count++;
484
506
485
507
if(count == idx) {
@@ -494,11 +516,15 @@ ADE_INDEXER(l_Mission_Waypoints, "number Index", "Array of waypoints in the curr
494
516
495
517
ADE_FUNC(__len, l_Mission_Waypoints, NULL, "Gets number of waypoints in mission. Note that this is only accurate for one frame.", "number", "Number of waypoints in the mission")
496
518
{
497
-
uint count=0;
498
-
for(uint i = 0; i < MAX_OBJECTS; i++)
519
+
int count=0;
520
+
521
+
object *ptr = GET_FIRST(&obj_used_list);
522
+
while (ptr != END_OF_LIST(&obj_used_list))
499
523
{
500
-
if (Objects[i].type == OBJ_WAYPOINT)
524
+
if (ptr->type == OBJ_WAYPOINT && !ptr->flags[Object::Object_Flags::Should_be_dead])
501
525
count++;
526
+
527
+
ptr = GET_NEXT(ptr);
502
528
}
503
529
504
530
returnade_set_args(L, "i", count);
@@ -546,26 +572,15 @@ ADE_INDEXER(l_Mission_Weapons, "number Index", "Gets handle to a weapon object i
ADE_FUNC(__len, l_Mission_Weapons, NULL, "Number of weapon objects in mission. Note that this is only accurate for one frame.", "number", "Number of weapon objects in mission")
ADE_FUNC(__len, l_Mission_Beams, NULL, "Number of beam objects in mission. Note that this is only accurate for one frame.", "number", "Number of beam objects in mission")
ADE_FUNC(__len, l_Mission_Fireballs, NULL, "Number of fireball objects in mission. Note that this is only accurate for one frame.", "number", "Number of fireball objects in mission")
ADE_FUNC(addMessage, l_Mission, "string name, string text, [persona persona]", "Adds a message", "message", "The new message or invalid handle on error")
@@ -2223,6 +2215,16 @@ ADE_FUNC(getShipList,
2223
2215
//Similarly, an empty list is defined by the head's next element being itself, hence an empty list will immediately return nil just fine
2224
2216
so = GET_NEXT(so);
2225
2217
2218
+
// skip should-be-dead ships
2219
+
if (so != nullptr) {
2220
+
while (so != END_OF_LIST(&Ship_obj_list)) {
2221
+
if (!Objects[so->objnum].flags[Object::Object_Flags::Should_be_dead]) {
2222
+
break;
2223
+
}
2224
+
so = GET_NEXT(so);
2225
+
}
2226
+
}
2227
+
2226
2228
if (so == END_OF_LIST(&Ship_obj_list) || so == nullptr) {
ADE_FUNC(isExpiring, l_Object, nullptr, "Checks whether the object has the should-be-dead flag set, which will cause it to be deleted within one frame", "boolean", "true or false according to the flag, or nil if a syntax/type error occurs")
0 commit comments