git repos / blockattack-game

commit 6dcd75df

sago007 · 2017-03-19 10:48
6dcd75dfe1b2ca6c84019a61cc40bc8291b81303 patch · browse files
parent 98273512f5c1e45ecea02d1b357291425c3e6c4c

Fixed a problem with the comments not being correctly ignored

Changed files

M source/code/sago/SagoMisc.hpp before
M source/code/sago/SagoSpriteHolder.cpp before
diff --git a/source/code/sago/SagoMisc.hpp b/source/code/sago/SagoMisc.hpp index 1904237..55bc097 100644 --- a/source/code/sago/SagoMisc.hpp +++ b/source/code/sago/SagoMisc.hpp
@@ -46,6 +46,14 @@ namespace sago {
*/
std::string GetFileContent(const char* filename);
+ /**
+ * Reads an entire file into memory.
+ * PHYSFS must be setup before hand
+ * @param filename The file to read
+ * @return The content of the file. If empty either the file was empty, did not exist or could not be opened
+ */
+ inline std::string GetFileContent(const std::string& filename) { return GetFileContent(filename.c_str()); };
+
bool FileExists(const char* filename);
void WriteFileContent(const char* filename, const std::string& content);
diff --git a/source/code/sago/SagoSpriteHolder.cpp b/source/code/sago/SagoSpriteHolder.cpp index d880f52..138b3e0 100644 --- a/source/code/sago/SagoSpriteHolder.cpp +++ b/source/code/sago/SagoSpriteHolder.cpp
@@ -91,7 +91,7 @@ void SagoSpriteHolder::ReadSpriteFile(const std::string& filename) {
for (auto& m : document.GetObject()) {
const std::string& spriteName = m.name.GetString();
if (!m.value.IsObject()) {
- if (spriteName[0] == '_') {
+ if (spriteName[0] != '_') {
std::cerr << "Invalid sprite: " << spriteName << "\n";
}
continue;