MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / CheckLevelNames

Function CheckLevelNames

editor/HFile.cpp:567–611  ·  view source on GitHub ↗

Check for duplicate names in the level

Source from the content-addressed store, hash-verified

565
566// Check for duplicate names in the level
567void CheckLevelNames() {
568 int i;
569
570 // Check objects
571 object *objp;
572 for (i = 0, objp = Objects; i <= Highest_object_index; i++, objp++) {
573 if ((objp->type != OBJ_NONE) && objp->name) {
574 int handle = osipf_FindObjectName(objp->name);
575 if (handle != objp->handle)
576 EditorMessageBox("Error: Objects %d and %d are both named \"%s\"", i, OBJNUM(ObjGet(handle)), objp->name);
577 if (StripLeadingTrailingSpaces(objp->name))
578 EditorMessageBox(
579 "Note: Object %d (\"%s\") had leading and/or trailing spaces in its name that have been removed.", i,
580 objp->name);
581 }
582 }
583
584 // Check triggers
585 trigger *tp;
586 for (i = 0, tp = Triggers; i < Num_triggers; i++, tp++) {
587 if (tp->name) {
588 int n = osipf_FindTriggerName(tp->name);
589 if (n != i)
590 EditorMessageBox("Error: Triggers %d and %d are both named \"%s\"", i, n, tp->name);
591 if (StripLeadingTrailingSpaces(tp->name))
592 EditorMessageBox(
593 "Note: Trigger %d (\"%s\") had leading and/or trailing spaces in its name that have been removed.", i,
594 tp->name);
595 }
596 }
597
598 // Check rooms
599 room *rp;
600 for (i = 0, rp = Rooms; i <= Highest_room_index; i++, rp++) {
601 if (rp->used && rp->name) {
602 int n = osipf_FindRoomName(rp->name);
603 if (n != i)
604 EditorMessageBox("Error: Rooms %d and %d are both named \"%s\"", i, n, rp->name);
605 if (StripLeadingTrailingSpaces(rp->name))
606 EditorMessageBox(
607 "Note: Room %d (\"%s\") had leading and/or trailing spaces in its name that have been removed.", i,
608 rp->name);
609 }
610 }
611}
612
613// Load a new level
614bool EditorLoadLevel(char *filename) {

Callers 1

EditorLoadLevelFunction · 0.85

Calls 5

osipf_FindObjectNameFunction · 0.85
ObjGetFunction · 0.85
osipf_FindTriggerNameFunction · 0.85
osipf_FindRoomNameFunction · 0.85

Tested by

no test coverage detected