Skip to content

Commit f150698

Browse files
Make assertions more readable.
1 parent e0d2d76 commit f150698

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

code/ai/aicode.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15107,10 +15107,9 @@ void init_aip_from_class_and_profile(ai_info *aip, ai_class *aicp, ai_profile_t
1510715107

1510815108
void ai_do_default_behavior(object *obj)
1510915109
{
15110-
Assert(obj != nullptr);
15111-
Assert(obj->instance != -1);
15112-
Assert(obj->type == OBJ_SHIP);
15113-
Assert(Ships[obj->instance].ai_index != -1);
15110+
Assertion(obj != nullptr, "Ai_do_default_behavior() was given a bad information. Specifically obj is a nullptr. This is a coder error, please report!");
15111+
Assertion((obj->type == OBJ_SHIP) && (obj->instance > -1) && (obj->instance < MAX_SHIPS), "This function that requires an object to be a ship was passed an invalid ship. Please report\n\nObject type: %d\nInstance #: %d", obj->type, obj->instance);
15112+
Assertion(Ships[obj->instance].ai_index > 0, "A ship has been found to have an invalid ai_index of %d. This should have been assigned and is coder mistake, please report!", Ships[obj->instance].ai_index);
1511415113

1511515114
ai_info *aip = &Ai_info[Ships[obj->instance].ai_index];
1511615115
ship_info* sip = &Ship_info[Ships[obj->instance].ship_info_index];

0 commit comments

Comments
 (0)