Migrate some members of the Player class to smart pointers
1. Moves the mutex and mixer channel members to unique pointers 2. Moves the trackFile to a weak pointer 3. Move member initialization to the class definition This class still retains a raw *cd member, however fixing this ripples up to the array of [26] CD images, and across more code that generically deals with mount points; so this work remains to do.
This commit is contained in:
parent
2d76132a8b
commit
91cd907c4e
4 changed files with 70 additions and 76 deletions
|
@ -27,11 +27,27 @@
|
|||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define strcasecmp(a, b) _stricmp(a, b)
|
||||
#define strncasecmp(a, b, n) _strnicmp(a, b, n)
|
||||
#endif
|
||||
|
||||
// A smart-pointer deleter for SDL-Mutex objects.
|
||||
// Use-case example:
|
||||
// std::unique_ptr<SDL_mutex, SdlMutexDeleter> myMutex;
|
||||
// myMutex.reset(SDL_CreateMutex());
|
||||
//
|
||||
struct SdlMutexDeleter {
|
||||
void operator()(SDL_mutex* mutex) {
|
||||
if (mutex)
|
||||
SDL_DestroyMutex(mutex);
|
||||
}
|
||||
};
|
||||
|
||||
// Returns the filename with the prior path stripped.
|
||||
// Works with both \ and / directory delimeters.
|
||||
std::string get_basename(const std::string& filename);
|
||||
|
||||
// Include a message in assert, similar to static_assert:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue