Show
Ignore:
Timestamp:
09/03/10 00:25:58 (21 months ago)
Author:
Carsten
Message:

Revision of Console code:

  • New "composite console" is the new default console, making it easy to add logging into a file and the graphical console during init, and making it unnecessary to reset the console pointer in DLLs that have been initialized before the graphical console.
  • Replaced several old/obsolete printf-statements (in the renderer DLLs) with their proper Console->Print() counterparts.
  • Put the Lua bindings to the global Console into separate files. This way the DLLs can include Console.hpp without being forced to link the Lua libraries in.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cafu/trunk/Libs/MaterialSystem/MaterialManagerImpl.cpp

    r36 r149  
    4646#include "Expression.hpp" 
    4747#include "Material.hpp" 
     48#include "ConsoleCommands/Console.hpp" 
    4849#include "TextParser/TextParser.hpp" 
    4950 
     
    202203                if (!T) 
    203204                { 
    204                     printf("Error parsing %s near %s at input byte %lu.\n", FileName.c_str(), Token.c_str(), TextParser.GetReadPosByte()); 
     205                    Console->Print("Error parsing "+FileName+" near "+Token+cf::va(" at input byte %lu.\n", TextParser.GetReadPosByte())); 
    205206                    break; 
    206207                } 
     
    226227                else 
    227228                { 
    228                     printf("File %s, material \"%s\": duplicate definition (ignored).\n", FileName.c_str(), NewMat->Name.c_str()); 
     229                    Console->Print("File " + FileName + ", material \"" + NewMat->Name + "\": duplicate definition (ignored).\n"); 
    229230                    delete NewMat; 
    230231                } 
     
    234235    catch (const TextParserT::ParseError&) 
    235236    { 
    236         printf("Error parsing %s at input byte %lu.\n", FileName.c_str(), TextParser.GetReadPosByte()); 
     237        Console->Print("Error parsing "+FileName+cf::va(" at input byte %lu.\n", TextParser.GetReadPosByte())); 
    237238    } 
    238239 
     
    339340MaterialT* MaterialManagerImplT::GetMaterial(const std::string& MaterialName) 
    340341{ 
    341     // Note that I'm *not* just writing   return Materials[MaterialName]   here, because that 
     342    // Note that we are *not* just writing   return Materials[MaterialName]   here, because that 
    342343    // would implicitly create a NULL entry for every MaterialName that does not actually exist. 
    343344    std::map<std::string, MaterialT*>::const_iterator It=Materials.find(MaterialName); 
     
    345346    if (It!=Materials.end()) return It->second; 
    346347 
    347     printf("%s (%u): GetMaterial(\"%s\") returns NULL.\n", __FILE__, __LINE__, MaterialName.c_str()); 
     348    Console->Print(cf::va("%s (%u): ", __FILE__, __LINE__)+"GetMaterial(\""+MaterialName+"\") returns NULL.\n"); 
    348349    return NULL; 
    349350}