Skip to content

Commit

Permalink
#5977: Fix ISoundShader implementation, remove redundant class members
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jul 7, 2022
1 parent c4f19c8 commit d90cd7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
9 changes: 3 additions & 6 deletions plugins/sound/SoundShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void SoundShader::parseDefinition() const
_contents = std::make_unique<ParsedContents>();

// Get a new tokeniser and parse the block
parser::BasicDefTokeniser<std::string> tok(_declBlock.contents);
parser::BasicDefTokeniser<std::string> tok(getBlockSyntax().contents);

while (tok.hasMoreTokens())
{
Expand Down Expand Up @@ -89,19 +89,16 @@ const std::string& SoundShader::getDisplayFolder() const

std::string SoundShader::getShaderFilePath() const
{
return _fileInfo.fullPath();
return getBlockSyntax().fileInfo.fullPath();
}

std::string SoundShader::getDefinition() const
{
return _declBlock.contents;
return getBlockSyntax().contents;
}

void SoundShader::onSyntaxBlockAssigned(const decl::DeclarationBlockSyntax& block)
{
_fileInfo = block.fileInfo;
_modName = block.getModName();

// Reset any contents, we reparse as soon as any property is accessed
_contents.reset();
}
Expand Down
10 changes: 1 addition & 9 deletions plugins/sound/SoundShader.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,10 @@ class SoundShader final :
// Name of the shader
std::string _name;

// The raw unparsed definition block
decl::DeclarationBlockSyntax _declBlock;

// Information we have parsed on demand
struct ParsedContents;
mutable std::unique_ptr<ParsedContents> _contents;

vfs::FileInfo _fileInfo;

// The modname (ModResource implementation)
std::string _modName;

private:
// Parses the definition block
void parseDefinition() const;
Expand All @@ -44,7 +36,7 @@ class SoundShader final :
const std::string& getDeclName() const override { return _name; }
decl::Type getDeclType() const override { return decl::Type::SoundShader; }
SoundFileList getSoundFileList() const override;
std::string getModName() const override { return _modName; }
std::string getModName() const override { return getBlockSyntax().getModName(); }
const std::string& getDisplayFolder() const override;
std::string getShaderFilePath() const override;
std::string getDefinition() const override;
Expand Down

0 comments on commit d90cd7b

Please sign in to comment.