File confec.cpp changed (mode: 100644) (index fc92b6d..0fd65f8) |
... |
... |
int main( int argc, char* argv[] ){ |
938 |
938 |
#else |
#else |
939 |
939 |
// Determine language. Reset locale to deal with "unholy things" in GCC. |
// Determine language. Reset locale to deal with "unholy things" in GCC. |
940 |
940 |
std::string loc = setlocale( LC_ALL, "" ); |
std::string loc = setlocale( LC_ALL, "" ); |
|
941 |
|
setlocale( LC_ALL, "C" ); |
941 |
942 |
if( ( loc.length() >= 2 && loc.substr( 0, 2 ) == "zh" ) |
if( ( loc.length() >= 2 && loc.substr( 0, 2 ) == "zh" ) |
942 |
943 |
|| ( loc.length() >= 7 && loc.substr( 0, 7 ) == "Chinese" ) ){ |
|| ( loc.length() >= 7 && loc.substr( 0, 7 ) == "Chinese" ) ){ |
943 |
944 |
language = "zh"; |
language = "zh"; |
File include/fworld.h changed (mode: 100755) (index 7b954f7..1264814) |
14 |
14 |
#include <cmath> |
#include <cmath> |
15 |
15 |
|
|
16 |
16 |
#include <algorithm> |
#include <algorithm> |
|
17 |
|
//#include <charconv> |
17 |
18 |
#include <functional> |
#include <functional> |
18 |
19 |
#include <map> |
#include <map> |
19 |
20 |
#include <string> |
#include <string> |
|
... |
... |
class World { |
291 |
292 |
double mapFps; |
double mapFps; |
292 |
293 |
void (*portalCallback)(std::string); |
void (*portalCallback)(std::string); |
293 |
294 |
long double safeStold( const std::string &str ); |
long double safeStold( const std::string &str ); |
|
295 |
|
std::string safeDtos( double num ); |
294 |
296 |
fgl::Texture getTexture( std::string basePath, std::string imageName, bool filter ); |
fgl::Texture getTexture( std::string basePath, std::string imageName, bool filter ); |
295 |
297 |
bool tileBlocking( long long x, long long y, bool checkEntities = false ); |
bool tileBlocking( long long x, long long y, bool checkEntities = false ); |
296 |
298 |
void loadMap( std::string dataPath, std::string filePath ); |
void loadMap( std::string dataPath, std::string filePath ); |
|
... |
... |
long double World::safeStold( const std::string &str ){ |
622 |
624 |
} |
} |
623 |
625 |
} |
} |
624 |
626 |
|
|
|
627 |
|
std::string safeDtos( double num ){ |
|
628 |
|
// TODO: C++17 only, and only in the ultra deluxe platinum edition. |
|
629 |
|
/* |
|
630 |
|
char buf[64]; |
|
631 |
|
char *last = buf + sizeof(buf); |
|
632 |
|
auto result = std::to_chars( (char*)buf, (char*)last, (double)num ); |
|
633 |
|
if( result.ptr == last ) return "0.0"; // Error. |
|
634 |
|
return std::string( buf, result.ptr - buf ); |
|
635 |
|
*/ |
|
636 |
|
return std::to_string( num ); // Locale-dependent. |
|
637 |
|
} |
|
638 |
|
|
625 |
639 |
fgl::Texture World::getTexture( std::string basePath, std::string imageName, bool filter ){ |
fgl::Texture World::getTexture( std::string basePath, std::string imageName, bool filter ){ |
626 |
640 |
if( imageName.length() < 1 ){ |
if( imageName.length() < 1 ){ |
627 |
641 |
return fgl::newTexture; |
return fgl::newTexture; |