Skip to content

Commit

Permalink
Refactor|Manifest|Resources: Moved logic for Manifest::consolePrint()…
Browse files Browse the repository at this point in the history
… into Game::printFiles()
  • Loading branch information
danij-deng committed Jan 4, 2014
1 parent a278c95 commit d066e50
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 43 deletions.
23 changes: 7 additions & 16 deletions doomsday/client/include/filesys/manifest.h
@@ -1,7 +1,7 @@
/** @file manifest.h Logical Resource Manifest
/** @file manifest.h Manifest for a logical resource.
*
* @author Copyright © 2010-2013 Daniel Swanson <danij@dengine.net>
* @author Copyright © 2010-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2010-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2010-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand All @@ -18,12 +18,12 @@
* 02110-1301 USA</small>
*/

#ifndef LIBDENG_RESOURCE_MANIFEST_H
#define LIBDENG_RESOURCE_MANIFEST_H
#ifndef DENG_RESOURCE_MANIFEST_H
#define DENG_RESOURCE_MANIFEST_H

#include "api_uri.h"
#include <de/String>
#include <QStringList>
#include "api_uri.h"

namespace de {

Expand Down Expand Up @@ -93,19 +93,10 @@ class ResourceManifest
*/
ResourceManifest &addName(String newName, bool *didAdd = 0);

/**
* Print information about a file to the console.
*
* @param manifest Manifest for the file.
* @param showStatus @c true = print loaded/located status for the
* associated file.
*/
static void consolePrint(ResourceManifest &manifest, bool showStatus = true);

private:
DENG2_PRIVATE(d)
};

} // namespace de

#endif /* LIBDENG_RESOURCE_MANIFEST_H */
#endif // DENG_RESOURCE_MANIFEST_H
26 changes: 0 additions & 26 deletions doomsday/client/src/filesys/manifest.cpp
Expand Up @@ -348,29 +348,3 @@ QStringList const &ResourceManifest::names() const
{
return d->names;
}

void ResourceManifest::consolePrint(ResourceManifest &manifest, bool showStatus)
{
bool const resourceFound = (manifest.fileFlags() & FF_FOUND) != 0;

String text;

if(showStatus)
{
text += (resourceFound? " " : ":");
}

// Format the resource name list.
text += manifest.names().join(" or ");

if(showStatus)
{
text += String(" - ") + (resourceFound? "found" : "missing");
if(resourceFound)
{
text += String(" ") + NativePath(manifest.resolvedPath(false/*don't try to locate*/)).expand().pretty();
}
}

LOG_MSG("") << text;
}
23 changes: 22 additions & 1 deletion doomsday/client/src/game.cpp
Expand Up @@ -185,7 +185,28 @@ void Game::printFiles(Game const &game, int rflags, bool printStatus)
ResourceManifest &manifest = **i;
if(rflags >= 0 && (rflags & manifest.fileFlags()))
{
ResourceManifest::consolePrint(manifest, printStatus);
bool const resourceFound = (manifest.fileFlags() & FF_FOUND) != 0;

String text;
if(printStatus)
{
text += (resourceFound? " " : " ! ");
}

// Format the resource name list.
text += manifest.names().join(" or ");

if(printStatus)
{
text += String(" - ") + (resourceFound? "found" : "missing");
if(resourceFound)
{
text += String(" ") + NativePath(manifest.resolvedPath(false/*don't try to locate*/)).expand().pretty();
}
}

LOG_MSG("") << text;

numPrinted += 1;
}
}
Expand Down

0 comments on commit d066e50

Please sign in to comment.