git repos / blockattack-game

commit c3cd4f49

Poul Sander · 2020-08-08 17:25
c3cd4f49f3968c464fcbdf7b8c318408ff6e2cb0 patch · browse files
parent 97546fef5ed6da4dba349d9091f1fa02ae34d9e5

Removed using from "sago"

Changed files

M source/code/sago/SagoMisc.cpp before
M source/code/sago/SagoSpriteHolder.cpp before
diff --git a/source/code/sago/SagoMisc.cpp b/source/code/sago/SagoMisc.cpp index 6942cd1..ce21e09 100644 --- a/source/code/sago/SagoMisc.cpp +++ b/source/code/sago/SagoMisc.cpp
@@ -33,15 +33,11 @@ SOFTWARE.
#define PHYSFS_writeBytes(X,Y,Z) PHYSFS_write(X,Y,1,Z)
#endif
-using std::string;
-using std::cerr;
-using std::vector;
-
namespace sago {
std::vector<std::string> GetFileList(const char* dir) {
- vector<string> ret;
+ std::vector<std::string> ret;
char** rc = PHYSFS_enumerateFiles(dir);
for (char** i = rc; *i != NULL; i++) {
ret.push_back(*i);
@@ -57,7 +53,7 @@ bool FileExists(const char* filename) {
void ReadBytesFromFile(const char* filename, std::unique_ptr<char[]>& dest, unsigned int& bytes) {
bytes = 0;
if (!PHYSFS_exists(filename)) {
- cerr << "ReadBytesFromFile - File does not exists: " << filename << "\n";
+ std::cerr << "ReadBytesFromFile - File does not exists: " << filename << "\n";
return;
}
PHYSFS_file* myfile = PHYSFS_openRead(filename);
@@ -66,7 +62,7 @@ void ReadBytesFromFile(const char* filename, std::unique_ptr<char[]>& dest, unsi
int length_read = PHYSFS_readBytes (myfile, m_data.get(), m_size);
if (length_read != (int)m_size) {
PHYSFS_close(myfile);
- cerr << "Error: Curropt data file: " << filename << "\n";
+ std::cerr << "Error: Curropt data file: " << filename << "\n";
return;
}
PHYSFS_close(myfile);
@@ -75,16 +71,16 @@ void ReadBytesFromFile(const char* filename, std::unique_ptr<char[]>& dest, unsi
}
std::string GetFileContent(const char* filename) {
- string ret;
+ std::string ret;
if (!PHYSFS_exists(filename)) {
- cerr << "GetFileContent - File does not exists: " << filename << "\n";
+ std::cerr << "GetFileContent - File does not exists: " << filename << "\n";
return ret;
}
unsigned int m_size = 0;
std::unique_ptr<char[]> m_data;
ReadBytesFromFile(filename, m_data, m_size);
//Now create a std::string
- ret = string(m_data.get(), m_data.get()+m_size);
+ ret = std::string(m_data.get(), m_data.get()+m_size);
return ret;
}
diff --git a/source/code/sago/SagoSpriteHolder.cpp b/source/code/sago/SagoSpriteHolder.cpp index d219487..1e30d63 100644 --- a/source/code/sago/SagoSpriteHolder.cpp +++ b/source/code/sago/SagoSpriteHolder.cpp
@@ -31,10 +31,6 @@ SOFTWARE.
#include <string.h>
#include <boost/algorithm/string/predicate.hpp>
-using std::string;
-using std::cerr;
-using std::cout;
-using std::vector;
namespace sago {
@@ -80,12 +76,12 @@ static std::string getDefaultValue(const rapidjson::Value& value, const char* na
}
void SagoSpriteHolder::ReadSpriteFile(const std::string& filename) {
- string fullfile = "sprites/"+filename;
- string content = sago::GetFileContent(fullfile.c_str());
+ std::string fullfile = "sprites/"+filename;
+ std::string content = sago::GetFileContent(fullfile.c_str());
rapidjson::Document document;
document.Parse(content.c_str());
if ( !document.IsObject() ) {
- cerr << "Failed to parse: " << fullfile << "\n";
+ std::cerr << "Failed to parse: " << fullfile << "\n";
return;
}
for (auto& m : document.GetObject()) {
@@ -96,7 +92,7 @@ void SagoSpriteHolder::ReadSpriteFile(const std::string& filename) {
}
continue;
}
- string textureName = getDefaultValue(m.value, "texture", "fallback");
+ std::string textureName = getDefaultValue(m.value, "texture", "fallback");
int topx = getDefaultValue(m.value, "topx", 0);
int topy = getDefaultValue(m.value, "topy",0);
int height = getDefaultValue(m.value, "height",0);
@@ -123,13 +119,13 @@ void SagoSpriteHolder::ReadSprites() {
for (std::string& item : spritefiles ) {
if (boost::algorithm::ends_with(item,".sprite")) {
if (data->verbose) {
- cout << "Found " << item << "\n";
+ std::cout << "Found " << item << "\n";
}
ReadSpriteFile(item);
}
else {
if (data->verbose) {
- cout << "Ignoreing " << item << "\n";
+ std::cout << "Ignoreing " << item << "\n";
}
}
}