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

Function bm_TestName

bitmap/bitmain.cpp:632–651  ·  view source on GitHub ↗

Returns -1 if this name is not already in use, else index of bitmap that is using name

Source from the content-addressed store, hash-verified

630}
631// Returns -1 if this name is not already in use, else index of bitmap that is using name
632int bm_TestName(const char *src) {
633 uint32_t i, limit;
634
635 char namedest[256];
636 char path[256], ext[256], filename[256];
637
638 ddio_SplitPath(src, path, filename, ext);
639 limit = BITMAP_NAME_LEN - 7;
640 // Make sure we don't go over our name length limit
641 strncpy(namedest, filename, limit);
642 namedest[limit] = 0;
643
644 int cur_len = strlen(namedest);
645
646 // Now, make sure there are no other bitmaps with this name
647 strcat(namedest, ".ogf");
648 if ((i = bm_FindBitmapName(namedest)) == -1)
649 return -1;
650 return i;
651}
652// gets the filename from a path, plus appends our .ogf extension
653void bm_ChangeEndName(const char *src, char *dest) {
654 uint32_t i, limit;

Callers 2

bm_AllocLoadFileBitmapFunction · 0.85

Calls 2

bm_FindBitmapNameFunction · 0.85
ddio_SplitPathFunction · 0.50

Tested by

no test coverage detected