aboutsummaryrefslogtreecommitdiff
path: root/src/gettext.h
Commit message (Expand)AuthorAge
* Fix various code & correctness issues (#11815)sfan52021-12-05
* Localize error messages in mainmenu (#11495)Riceball LEE2021-11-01
* Add fwgettext util functionrubenwardy2021-08-19
* Fix segfault caused by wrong wgettext()sfan52018-04-09
* Fix for translating empty stringsminduser002018-04-09
* C++ modernize: Pragma once (#6264)Loïc Blot2017-08-17
* Cleanup various headers to reduce compilation times (#6255)Loïc Blot2017-08-16
* gettext.h: include <locale> before defining the gettext macro (#4452)kahrl2016-08-21
* Fix compilation under MSVC and remove unnecessary conditional function prototypekwolekr2015-10-24
* Remove wstrgettextest312015-10-18
* Clean up gettext initializationShadowNinja2015-10-15
* Use UTF-8 instead of narrowest312015-07-08
* Fix Android text bug (no text displaying)Craig Robbins2015-03-07
* Fix gettext on MSVCBlockMen2015-02-12
* Fix gettextShadowNinja2015-02-05
* Reduce gettext wide/narrow and string/char* conversionsShadowNinja2015-02-05
* Fix errors/warnings reported by valgrindsfan52014-07-06
* Use narrow_to_wide in gettext instead of os dependent conversion fctsapier2014-04-19
* fix gettext compile issues under win32MetaDucky2013-11-18
* Fix win32/msvc i18n (quite UGLY version, blame Microsoft)sapier2013-11-11
* Fix formspec label issues in win builds (MSVC)BlockMen2013-08-04
* Add support for IPv6proller2013-06-23
* Add Freetype supportIlya Zhuravlev2013-02-14
* Clean up log messages everywherePerttu Ahola2012-03-11
* fixed some error :/Constantin Wenger2011-08-05
* Introduce wgettextGiuseppe Bilotta2011-08-02
* last fix was shit but this one works (tested)Constantin Wenger2011-07-31
* fixe for msvc broke linuxConstantin Wenger2011-07-30
* this fixes problem with msvc++ and should work on other systems and so on any...Constantin Wenger2011-07-30
* fixed redefinitivon of gettext.h is included more than onceConstantin Wenger2011-07-30
* set locales to C because en_US not installed on some systems, only UTF-8 vers...Constantin Wenger2011-07-30
* Read config from gettext.hGiuseppe Bilotta2011-07-24
* Sanitize GETTEXT usage macrosGiuseppe Bilotta2011-07-24
* Refactor gettext initGiuseppe Bilotta2011-07-24
* updated cmakerules to autodetect if gettext can be usedConstantin Wenger2011-07-23
* Make gettext optionalGiuseppe Bilotta2011-07-21
* added gettext supportConstantin Wenger2011-07-20
hl kwb">void Database_LevelDB::endSave() {} void Database_LevelDB::saveBlock(MapBlock *block) { DSTACK(__FUNCTION_NAME); /* Dummy blocks are not written */ if(block->isDummy()) { return; } // Format used for writing u8 version = SER_FMT_VER_HIGHEST_WRITE; // Get destination v3s16 p3d = block->getPos(); /* [0] u8 serialization version [1] data */ std::ostringstream o(std::ios_base::binary); o.write((char*)&version, 1); // Write basic data block->serialize(o, version, true); // Write block to database std::string tmp = o.str(); m_database->Put(leveldb::WriteOptions(), i64tos(getBlockAsInteger(p3d)), tmp); // We just wrote it to the disk so clear modified flag block->resetModified(); } MapBlock* Database_LevelDB::loadBlock(v3s16 blockpos) { v2s16 p2d(blockpos.X, blockpos.Z); std::string datastr; leveldb::Status s = m_database->Get(leveldb::ReadOptions(), i64tos(getBlockAsInteger(blockpos)), &datastr); if (datastr.length() == 0 && s.ok()) { errorstream << "Blank block data in database (datastr.length() == 0) (" << blockpos.X << "," << blockpos.Y << "," << blockpos.Z << ")" << std::endl; if (g_settings->getBool("ignore_world_load_errors")) { errorstream << "Ignoring block load error. Duck and cover! " << "(ignore_world_load_errors)" << std::endl; } else { throw SerializationError("Blank block data in database"); } return NULL; } if (s.ok()) { /* Make sure sector is loaded */ MapSector *sector = srvmap->createSector(p2d); try { std::istringstream is(datastr, std::ios_base::binary); u8 version = SER_FMT_VER_INVALID; is.read((char *)&version, 1); if (is.fail()) throw SerializationError("ServerMap::loadBlock(): Failed" " to read MapBlock version"); MapBlock *block = NULL; bool created_new = false; block = sector->getBlockNoCreateNoEx(blockpos.Y); if (block == NULL) { block = sector->createBlankBlockNoInsert(blockpos.Y); created_new = true; } // Read basic data block->deSerialize(is, version, true); // If it's a new block, insert it to the map if (created_new) sector->insertBlock(block); /* Save blocks loaded in old format in new format */ //if(version < SER_FMT_VER_HIGHEST || save_after_load) // Only save if asked to; no need to update version //if(save_after_load) // saveBlock(block); // We just loaded it from, so it's up-to-date. block->resetModified(); } catch (SerializationError &e) { errorstream << "Invalid block data in database" << " (" << blockpos.X << "," << blockpos.Y << "," << blockpos.Z << ") (SerializationError): " << e.what() << std::endl; // TODO: Block should be marked as invalid in memory so that it is // not touched but the game can run if (g_settings->getBool("ignore_world_load_errors")) { errorstream << "Ignoring block load error. Duck and cover! " << "(ignore_world_load_errors)" << std::endl; } else { throw SerializationError("Invalid block data in database"); //assert(0); } } return srvmap->getBlockNoCreateNoEx(blockpos); // should not be using this here } return NULL; } void Database_LevelDB::listAllLoadableBlocks(std::list<v3s16> &dst) { leveldb::Iterator* it = m_database->NewIterator(leveldb::ReadOptions()); for (it->SeekToFirst(); it->Valid(); it->Next()) { dst.push_back(getIntegerAsBlock(stoi64(it->key().ToString()))); } assert(it->status().ok()); // Check for any errors found during the scan delete it; } Database_LevelDB::~Database_LevelDB() { delete m_database; } #endif