0

I am working on a resource manager for my game. However on loading the game there seems to be an issue regarding the list iterator. I get the following error

enter image description here

My Output

enter image description here

My code:

  ResourceManagement*_rManager = new ResourceManagement();
        _rManager->createGroup("meshes");
        _rManager->createResource("Diabro\Diabro\media\models", "FileSystem", "ninja.mesh",  "Mesh", "meshes"); //location of file, codeType of resourcetype, name of resource, type of resource, resourcegroup
        _rManager->loadResource("meshes");
        _rManager->reloadResource("ninja.mesh", "meshes");
        _rManager->unloadResource("ninja.mesh", "meshes");

My resourcemanagement class

void ResourceManagement::createResource(std::string pLocation, std::string pLocType, std::string pResourceName, std::string pResourceType, std::string pGroupName)
{

    _groupManager->getSingleton().addResourceLocation(pLocation , pLocType);
    _groupManager->getSingleton().declareResource(pResourceName, pResourceType, pGroupName);
    _groupManager->getSingleton().initialiseResourceGroup(pGroupName);
    // Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); can be used to just load all, need decision which we want
}

/// <summary>
/// Unloads the resource.
/// </summary>
/// <param name="pResourceName">Name of the p resource.</param>
/// <param name="pGroupName">Name of the p group.</param>
void ResourceManagement::unloadResource(std::string pResourceName, std::string pGroupName) // unloads a single resource
{
    Ogre::ResourcePtr ptr = _resourceMgr->getResourceByName(pResourceName);
    ptr->unload();
    _resourceMgr->remove(pResourceName);    
}

/// <summary>
/// Unloads the resource goup.
/// </summary>
/// <param name="pGroupName">Name of the p group.</param>
void ResourceManagement::unloadResourceGoup(std::string pGroupName)
{
    _groupManager->getSingleton().unloadResourceGroup(pGroupName);

}

/// <summary>
/// Loads the resource.
/// </summary>
/// <param name="pGroupName">Name of the p group.</param>
void ResourceManagement::loadResource(std::string pGroupName)
{
    _groupManager->getSingleton().loadResourceGroup(pGroupName);
}

void ResourceManagement::createGroup(std::string pGroupName)
{
    _groupManager->getSingleton().createResourceGroup(pGroupName);
}

/// <summary>
/// Reloads the resource.
/// </summary>
/// <param name="pResourceName">Name of the p resource.</param>
/// <param name="pGroupName">Name of the p group.</param>
void ResourceManagement::reloadResource(std::string pResourceName, std::string pGroupName)
{
    Ogre::ResourcePtr ptr = _resourceMgr->load(pResourceName, pGroupName);
    ptr->escalateLoading();
    ptr->reload();

}

EDIT: form what I can determine something seems to be going wrong when I try to load the resource

   /// <summary>
    /// Loads the resource.
    /// </summary>
    /// <param name="pGroupName">Name of the p group.</param>
    void ResourceManagement::loadResource(std::string pGroupName)
    {
        _groupManager->getSingleton().loadResourceGroup(pGroupName);
    }

_rManager->loadResource("meshes");
KevinTheGreat
  • 634
  • 5
  • 22
  • Please post text instead of images to allow copy+paste and searching. While you cannot select text from the error message window you *can* press CTRL+C while the error message window is in focus to copy the content and post it here. – nwp Apr 27 '17 at 13:35
  • This doesn't really show where the problem is. Can you use the debugger to find the line of your code that crashes? – Jay Apr 27 '17 at 13:37
  • Debug Assertion Failed! Program: ...\Documents\GitHub\GameTechnologyTeam5\Diabro\Debug\Diabro.exe File: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\list Line: 227 Expression: list iterator not incrementable For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts. – KevinTheGreat Apr 27 '17 at 13:38
  • @Jay My debugger becommes quiet long , couple of 100's of lines but I get this error, a lot (look at edit) – KevinTheGreat Apr 27 '17 at 13:45
  • This would be easiest to simply debug. Just click "retry" and get into that - you'll get a full stack trace and will be able to see what's going on. – Bartek Banachewicz Apr 27 '17 at 13:53
  • @Jay updated my question with place of errror, if I comment that out. (together with my load and unload resource it works fine) – KevinTheGreat Apr 27 '17 at 14:03

0 Answers0