From 84831a4b34b0b2319c8956b01c9b7bcd8d166dd2 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Dec 2015 13:35:04 +0100 Subject: [PATCH 01/13] Changed: Use std::string insteaf of const char* for filenames in CPersistentDataRecord --HG-- branch : develop --- .../ryzom/common/src/game_share/bnp_patch.cpp | 2 +- .../common/src/game_share/persistent_data.cpp | 42 +++++++++---------- .../common/src/game_share/persistent_data.h | 12 +++--- .../game_share/server_animation_module.cpp | 2 +- .../server/src/ai_share/ai_actions_dr.cpp | 4 +- .../server/src/backup_service/commands.cpp | 2 +- .../src/entities_game_service/admin.cpp | 8 ++-- .../entities_game_service.cpp | 20 ++++----- .../game_event_manager.cpp | 4 +- .../guild_manager/guild_commands.cpp | 4 +- .../guild_manager/guild_manager.cpp | 4 +- .../mission_manager/mission_queue_manager.cpp | 2 +- .../outpost_manager/outpost_manager.cpp | 4 +- .../player_manager/player.cpp | 12 +++--- .../player_manager/player_manager.cpp | 2 +- .../pvp_faction_reward_manager.cpp | 4 +- .../pvp_faction_reward_manager/totem_base.cpp | 4 +- .../shop_type/dynamic_items.cpp | 2 +- .../shop_type/named_items.cpp | 2 +- .../src/entities_game_service/stat_db.cpp | 8 ++-- .../stat_char_commands.cpp | 2 +- .../stat_character_scan_job.cpp | 2 +- .../pd_support_service/stat_char_commands.cpp | 2 +- .../stat_character_scan_job.cpp | 2 +- .../src/server_share/handy_commands.cpp | 26 ++++++------ .../tools/patch_gen/patch_gen_common.cpp | 38 ++++++++++------- code/ryzom/tools/pdr_util/pdr_util.cpp | 12 +++--- code/ryzom/tools/stats_scan/char_commands.cpp | 2 +- .../tools/stats_scan/character_scan_job.cpp | 2 +- 29 files changed, 120 insertions(+), 112 deletions(-) diff --git a/code/ryzom/common/src/game_share/bnp_patch.cpp b/code/ryzom/common/src/game_share/bnp_patch.cpp index fe5bdbc2b..baac733e8 100644 --- a/code/ryzom/common/src/game_share/bnp_patch.cpp +++ b/code/ryzom/common/src/game_share/bnp_patch.cpp @@ -766,7 +766,7 @@ bool CProductDescriptionForClient::load(const std::string& filePath) clear(); static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromBinFile(filePath.c_str()); + pdr.readFromBinFile(filePath); apply(pdr); return true; diff --git a/code/ryzom/common/src/game_share/persistent_data.cpp b/code/ryzom/common/src/game_share/persistent_data.cpp index 8b99692ca..b11fcf0b9 100644 --- a/code/ryzom/common/src/game_share/persistent_data.cpp +++ b/code/ryzom/common/src/game_share/persistent_data.cpp @@ -737,7 +737,7 @@ bool CPersistentDataRecord::toLines(std::string& result) return pdt.readFromPdr(*this) && pdt.writeToBuffer(reinterpret_cast(result)); } -bool CPersistentDataRecord::writeToBinFile(const char* fileName) +bool CPersistentDataRecord::writeToBinFile(const std::string &fileName) { H_AUTO(CPersistentDataRecordWriteToBinFile); @@ -750,7 +750,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName) // write the buffer to a file COFile f; bool open = f.open(fileName); - DROP_IF(!open,NLMISC::toString("Failed to open output file %s",fileName).c_str(),return false); + DROP_IF(!open, NLMISC::toString("Failed to open output file %s", fileName.c_str()).c_str(),return false); // write the binary data to file try @@ -759,7 +759,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName) } catch(...) { - DROP(NLMISC::toString("Failed to write output file: %s",fileName),return false); + DROP(NLMISC::toString("Failed to write output file: %s", fileName.c_str()),return false); } // rewind the read pointer 'cos it's at the end of file @@ -768,7 +768,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName) return true; } -bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat stringFormat) +bool CPersistentDataRecord::writeToTxtFile(const std::string &fileName,TStringFormat stringFormat) { H_AUTO(CPersistentDataRecordWriteToTxtFile); @@ -779,7 +779,7 @@ bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat st // write the text buffer to a file COFile f; bool open = f.open(fileName); - DROP_IF(!open,NLMISC::toString("Failed to open output file %s",fileName).c_str(),return false); + DROP_IF(!open,NLMISC::toString("Failed to open output file %s", fileName.c_str()).c_str(), return false); // write the binary data to file try @@ -788,7 +788,7 @@ bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat st } catch(...) { - DROP(NLMISC::toString("Failed to write output file: %s",fileName),return false); + DROP(NLMISC::toString("Failed to write output file: %s", fileName.c_str()), return false); } // rewind the read pointer 'cos it's at the end of file @@ -797,7 +797,7 @@ bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat st return true; } -bool CPersistentDataRecord::writeToFile(const char* fileName,TFileFormat fileFormat) +bool CPersistentDataRecord::writeToFile(const std::string &fileName, TFileFormat fileFormat) { H_AUTO(CPersistentDataRecordWriteToFile); @@ -805,18 +805,18 @@ bool CPersistentDataRecord::writeToFile(const char* fileName,TFileFormat fileFor { case BINARY_FILE: binary_file: - nlinfo("saving binary file: %s",fileName); + nlinfo("saving binary file: %s", fileName.c_str()); return writeToBinFile(fileName); case XML_FILE: xml_file: - nlinfo("saving xml file: %s",fileName); - return writeToTxtFile(fileName,XML_STRING); + nlinfo("saving xml file: %s", fileName.c_str()); + return writeToTxtFile(fileName, XML_STRING); case LINES_FILE: lines_file: - nlinfo("saving line-based txt file: %s",fileName); - return writeToTxtFile(fileName,LINES_STRING); + nlinfo("saving line-based txt file: %s", fileName.c_str()); + return writeToTxtFile(fileName, LINES_STRING); case ANY_FILE: { @@ -1113,15 +1113,15 @@ bool CPersistentDataRecord::fromBuffer(NLMISC::IStream& stream) } -bool CPersistentDataRecord::readFromFile(const char* fileName) +bool CPersistentDataRecord::readFromFile(const std::string &fileName) { H_AUTO(pdrReadFromFile) #ifdef NL_OS_WINDOWS // open the file - FILE* inf= fopen(fileName,"rb"); - DROP_IF( inf==NULL, "Failed to open input file "<Pdrs[first].writeToTxtFile( tmp.c_str() ); + animSession->Pdrs[first].writeToTxtFile( tmp ); } } diff --git a/code/ryzom/server/src/ai_share/ai_actions_dr.cpp b/code/ryzom/server/src/ai_share/ai_actions_dr.cpp index da668a725..1fa9cf40c 100644 --- a/code/ryzom/server/src/ai_share/ai_actions_dr.cpp +++ b/code/ryzom/server/src/ai_share/ai_actions_dr.cpp @@ -52,12 +52,12 @@ void CAIActionsDataRecordPtr::clear() void CAIActionsDataRecordPtr::readFile(const std::string &fileName) { - _PdrPtr->readFromFile(fileName.c_str()); + _PdrPtr->readFromFile(fileName); } void CAIActionsDataRecordPtr::writeFile(const std::string &fileName) { - _PdrPtr->writeToFile(fileName.c_str()); + _PdrPtr->writeToFile(fileName); } void CAIActionsDataRecordPtr::display() diff --git a/code/ryzom/server/src/backup_service/commands.cpp b/code/ryzom/server/src/backup_service/commands.cpp index 79ac6c0f3..4bbdb9dc9 100644 --- a/code/ryzom/server/src/backup_service/commands.cpp +++ b/code/ryzom/server/src/backup_service/commands.cpp @@ -121,7 +121,7 @@ NLMISC_COMMAND ( dumpCharacterFile, "dump the content of the save file for a cha static CPersistentDataRecord pdr; pdr.clear(); - if (!pdr.readFromBinFile(fileName.c_str())) + if (!pdr.readFromBinFile(fileName)) { log.displayNL("Error while reading file '%s'", fileName.c_str()); return true; diff --git a/code/ryzom/server/src/entities_game_service/admin.cpp b/code/ryzom/server/src/entities_game_service/admin.cpp index 22254c64b..ee9eb2630 100644 --- a/code/ryzom/server/src/entities_game_service/admin.cpp +++ b/code/ryzom/server/src/entities_game_service/admin.cpp @@ -2199,7 +2199,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,saveToXML,"save a character to an XML file","store(pdr); - pdr.writeToTxtFile((fileName+".xml").c_str()); + pdr.writeToTxtFile(fileName+".xml"); return true; } @@ -2225,7 +2225,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,loadFromXML,"load a character from an XML file"," static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromTxtFile((fileName+".xml").c_str()); + pdr.readFromTxtFile(fileName+".xml"); c->apply(pdr); c->setName(name); c->setGuildId(guildId); @@ -2256,7 +2256,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,saveToPDR,"save a character to a binary PDR file" static CPersistentDataRecordRyzomStore pdr; pdr.clear(); c->store(pdr); - pdr.writeToBinFile((fileName+".pdr").c_str()); + pdr.writeToBinFile(fileName+".pdr"); return true; } @@ -2282,7 +2282,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,loadFromPDR,"load a character from a binary PDR f static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromBinFile((fileName+".pdr").c_str()); + pdr.readFromBinFile(fileName+".pdr"); c->apply(pdr); c->setName(name); diff --git a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp index e6d4d3d8c..fa0985692 100644 --- a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp +++ b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp @@ -1720,7 +1720,7 @@ NLMISC_COMMAND(loadCharacterNames,"load all character save games and extract nam pdr.clear(); { H_AUTO(LoadCharacterNamesLoadFile); - pdr.readFromFile((*it).second.FileName.c_str()); + pdr.readFromFile((*it).second.FileName); } CCharacterNameExtraction nameExtractor; { @@ -1760,25 +1760,25 @@ NLMISC_COMMAND(loadCharacterNames,"load all character save games and extract nam // // std read tst // static CPersistentDataRecord pdrRead(""); // pdrRead.clear(); -// pdrRead.readFromBinFile(files[i].c_str()); -// pdrRead.writeToTxtFile((saveDir + "test/txt_read/" + CFile::getFilenameWithoutExtension(file) + ".txt").c_str(), CPersistentDataRecord::LINES_STRING); +// pdrRead.readFromBinFile(files[i]); +// pdrRead.writeToTxtFile(saveDir + "test/txt_read/" + CFile::getFilenameWithoutExtension(file) + ".txt", CPersistentDataRecord::LINES_STRING); // // // read write tst (even with a bad used RyzomStore class) // static CPersistentDataRecordRyzomStore pdr; // pdr.clear(); -// pdr.readFromBinFile(files[i].c_str()); +// pdr.readFromBinFile(files[i]); // TTime t0= CTime::getLocalTime(); -// pdr.writeToBinFile((saveDir + "test/bin_new/" + file).c_str()); +// pdr.writeToBinFile(saveDir + "test/bin_new/" + file); // TTime t1= CTime::getLocalTime(); // nlinfo("resaved %s in %d ms", file.c_str(), uint32(t1-t0)); -// pdr.writeToTxtFile((saveDir + "test/txt_before/" + CFile::getFilenameWithoutExtension(file) + ".txt").c_str(), CPersistentDataRecord::LINES_STRING); +// pdr.writeToTxtFile(saveDir + "test/txt_before/" + CFile::getFilenameWithoutExtension(file) + ".txt", CPersistentDataRecord::LINES_STRING); // } // // ReLoad // { // static CPersistentDataRecordRyzomStore pdr; // pdr.clear(); -// pdr.readFromBinFile((saveDir + "test/bin_new/" + file).c_str()); -// pdr.writeToTxtFile((saveDir + "test/txt_after/" + CFile::getFilenameWithoutExtension(file) + ".txt").c_str(), CPersistentDataRecord::LINES_STRING); +// pdr.readFromBinFile(saveDir + "test/bin_new/" + file); +// pdr.writeToTxtFile(saveDir + "test/txt_after/" + CFile::getFilenameWithoutExtension(file) + ".txt", CPersistentDataRecord::LINES_STRING); // } // } // } @@ -1813,10 +1813,10 @@ NLMISC_COMMAND(loadCharacterNames,"load all character save games and extract nam // { // static CPersistentDataRecord pdr; // pdr.clear(); -// pdr.readFromFile(files[i].c_str()); +// pdr.readFromFile(files[i]); // string txtFile= files[i]; // strFindReplace(txtFile, ".bin", ".txt"); -// pdr.writeToTxtFile(txtFile.c_str(), CPersistentDataRecord::LINES_STRING); +// pdr.writeToTxtFile(txtFile, CPersistentDataRecord::LINES_STRING); // } // } // } diff --git a/code/ryzom/server/src/entities_game_service/game_event_manager.cpp b/code/ryzom/server/src/entities_game_service/game_event_manager.cpp index b95fb1ad4..d96f122b9 100644 --- a/code/ryzom/server/src/entities_game_service/game_event_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/game_event_manager.cpp @@ -66,7 +66,7 @@ void CGameEventManager::init() { static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromTxtFile(sFilename.c_str()); + pdr.readFromTxtFile(sFilename); apply(pdr); createEventChannel(); } @@ -308,7 +308,7 @@ void CGameEventManager::saveGameEventFile() static CPersistentDataRecordRyzomStore pdr; pdr.clear(); store(pdr); - pdr.writeToTxtFile(sFilename.c_str()); + pdr.writeToTxtFile(sFilename); } } diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild_commands.cpp b/code/ryzom/server/src/entities_game_service/guild_manager/guild_commands.cpp index 9169443a6..3e840bd43 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild_commands.cpp +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild_commands.cpp @@ -510,7 +510,7 @@ NLMISC_COMMAND( importGuildFile, "Import a guild file into the server", " 0) { // this is a guild file. We can load it - pdr.readFromBinFile(args[0].c_str()); + pdr.readFromBinFile(args[0]); guildId = id; } @@ -540,7 +540,7 @@ NLMISC_COMMAND( importGuildFile, "Import a guild file into the server", " 0) { // this is a guild file. We can load it - pdr.readFromTxtFile(args[0].c_str()); + pdr.readFromTxtFile(args[0]); guildId = id; } else diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild_manager.cpp b/code/ryzom/server/src/entities_game_service/guild_manager/guild_manager.cpp index bb99c253f..a84f797dd 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild_manager.cpp @@ -328,7 +328,7 @@ void CGuildManager::saveGuild( CGuild* guild ) { H_AUTO( CGuildManagerUpdate_PDR_WRITE_TEXT ) string fileName = Bsi.getLocalPath()+NLMISC::toString("guilds/guild_%05u.txt", id & 0x000fffff); - pdr.writeToTxtFile(fileName.c_str()); + pdr.writeToTxtFile(fileName); } else { @@ -360,7 +360,7 @@ void CGuildManager::saveGuild( CGuild* guild ) else { H_AUTO( CGuildManagerUpdatePDR_WRITE_BIN_NO_PDS ) - pdr.writeToBinFile((Bsi.getLocalPath() + fileName).c_str()); + pdr.writeToBinFile(Bsi.getLocalPath() + fileName); } } diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp index a821eef45..76ddcc3ae 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp @@ -55,7 +55,7 @@ void CMissionQueueManager::init() { static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromTxtFile(sFilename.c_str()); + pdr.readFromTxtFile(sFilename); apply(pdr); } _InitOk = true; diff --git a/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp b/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp index 3fa6429a5..681a9d7dd 100644 --- a/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp @@ -430,7 +430,7 @@ void COutpostManager::loadOutpostSaveFiles() // // load dynamic data // static CPersistentDataRecord pdr; // pdr.clear(); -// pdr.readFromBinFile(files[i].c_str()); +// pdr.readFromBinFile(files[i]); // outpost->apply( pdr ); // loadedOutposts.push_back( outpost ); // } @@ -808,7 +808,7 @@ void COutpostManager::saveOutpost(NLMISC::CSmartPtr outpost) else { H_AUTO( COutpostManagerSTORE_NO_BS ) - pdr.writeToBinFile((Bsi.getLocalPath() + fileName).c_str()); + pdr.writeToBinFile(Bsi.getLocalPath() + fileName); } } diff --git a/code/ryzom/server/src/entities_game_service/player_manager/player.cpp b/code/ryzom/server/src/entities_game_service/player_manager/player.cpp index 03efc8291..fa5e216ae 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/player.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/player.cpp @@ -831,7 +831,7 @@ void CPlayer::loadAllCharacters() bool isOK; { H_AUTO(LoadAllCharactersPdrBinReadFile); - isOK= pdr.readFromBinFile(pdrBinFileName.c_str()); + isOK= pdr.readFromBinFile(pdrBinFileName); } if (!isOK) break; @@ -854,7 +854,7 @@ void CPlayer::loadAllCharacters() bool isOK; { H_AUTO(LoadAllCharactersPdrXmlReadFile); - isOK= pdr.readFromTxtFile(pdrXmlFileName.c_str()); + isOK= pdr.readFromTxtFile(pdrXmlFileName); } if (!isOK) break; @@ -975,7 +975,7 @@ void CPlayer::loadAllCharactersPdr() // try loading the save data from disk try { - bool isOK= pdr.readFromFile(fileName.c_str()); + bool isOK= pdr.readFromFile(fileName); if (!isOK) continue; } @@ -1478,11 +1478,11 @@ NLMISC_CATEGORISED_COMMAND(egs, convertToPdr, "Load all possible characters from bool writeSuccess = false; if (xml) { - writeSuccess = pdr.writeToTxtFile(dstFile.c_str()); + writeSuccess = pdr.writeToTxtFile(dstFile); } else { - writeSuccess = pdr.writeToBinFile(dstFile.c_str()); + writeSuccess = pdr.writeToBinFile(dstFile); } // check file can be read back @@ -1491,7 +1491,7 @@ NLMISC_CATEGORISED_COMMAND(egs, convertToPdr, "Load all possible characters from static CPersistentDataRecord pdrTest; pdrTest.clear(); - if (pdrTest.readFromFile(dstFile.c_str())) + if (pdrTest.readFromFile(dstFile)) { CCharacter* characterTest = new CCharacter(); characterTest->setId( PlayerManager.createCharacterId( UserId, CharId ) ); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp b/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp index befc0d95c..d02da2948 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/player_manager.cpp @@ -846,7 +846,7 @@ void CPlayerManager::savePlayerCharRecurs( uint32 userId, sint32 idx, std::set %s",fd.FileName.c_str(),outputFileName.c_str()); static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromFile(fd.FileName.c_str()); - pdr.writeToFile(outputFileName.c_str()); + pdr.readFromFile(fd.FileName); + pdr.writeToFile(outputFileName); } } @@ -170,8 +170,8 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2bin,"convert one or more sets of pdr files log.displayNL("Converting to Binary : %s => %s",fd.FileName.c_str(),outputFileName.c_str()); static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromFile(fd.FileName.c_str()); - pdr.writeToFile(outputFileName.c_str()); + pdr.readFromFile(fd.FileName); + pdr.writeToFile(outputFileName); } } @@ -202,8 +202,8 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2txt,"convert one or more sets of pdr files log.displayNL("Converting to TXT : %s => %s",fd.FileName.c_str(),outputFileName.c_str()); static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromFile(fd.FileName.c_str()); - pdr.writeToFile(outputFileName.c_str()); + pdr.readFromFile(fd.FileName); + pdr.writeToFile(outputFileName); } } @@ -218,10 +218,10 @@ NLMISC_CATEGORISED_COMMAND(utils,pdrFileCompare,"Compare 2 pdr files"," Date: Tue, 15 Dec 2015 13:39:02 +0100 Subject: [PATCH 02/13] Changed: Minor changes --HG-- branch : develop --- .../common/src/game_share/persistent_data.cpp | 14 +++--- .../common/src/game_share/persistent_data.h | 2 +- .../server/src/backup_service/commands.cpp | 2 +- .../src/entities_game_service/admin.cpp | 6 +-- .../game_event_manager.cpp | 2 +- .../mission_manager/mission_queue_manager.cpp | 2 +- .../outpost_manager/outpost_manager.cpp | 2 +- .../shop_type/named_items.cpp | 2 +- .../merge_commands.cpp | 4 +- .../stat_char_commands.cpp | 2 +- .../pd_support_service/stat_char_commands.cpp | 2 +- .../stat_character_scan_job.cpp | 2 +- .../src/server_share/handy_commands.cpp | 13 ++--- .../tools/patch_gen/patch_gen_common.cpp | 48 +++++++++---------- code/ryzom/tools/pdr_util/pdr_util.cpp | 2 +- code/ryzom/tools/stats_scan/char_commands.cpp | 4 +- .../tools/stats_scan/character_scan_job.cpp | 2 +- 17 files changed, 56 insertions(+), 55 deletions(-) diff --git a/code/ryzom/common/src/game_share/persistent_data.cpp b/code/ryzom/common/src/game_share/persistent_data.cpp index b11fcf0b9..85c873ba4 100644 --- a/code/ryzom/common/src/game_share/persistent_data.cpp +++ b/code/ryzom/common/src/game_share/persistent_data.cpp @@ -825,14 +825,14 @@ bool CPersistentDataRecord::writeToFile(const std::string &fileName, TFileFormat goto binary_file; } } - BOMB("Bad file type supplied to writeToFile() - file not saved: "<8 && *(uint32*)&buffer[4]==length); @@ -1143,7 +1143,7 @@ bool CPersistentDataRecord::readFromFile(const std::string &fileName) } // it's not a valid binary file so see whether it looks like a valid text file - DROP_IF(!buffer.isValidText(),"File is binary but 'file size' header entry doesn't match true file size",return false); + DROP_IF(!buffer.isValidText(),"File is binary but 'file size' header entry doesn't match true file size", return false); // parse the data as text... return fromString(buffer); @@ -1153,13 +1153,13 @@ bool CPersistentDataRecord::readFromFile(const std::string &fileName) // open the file CIFile f; bool open = f.open(fileName); - DROP_IF( !open, "Failed to open input file "<getGuildId(); NLMISC::CEntityId id= c->getId(); - static CPersistentDataRecord pdr; + static CPersistentDataRecord pdr; pdr.clear(); pdr.readFromTxtFile(fileName+".xml"); c->apply(pdr); @@ -2249,7 +2249,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,saveToPDR,"save a character to a binary PDR file" if (args.size () < 2) return false; GET_CHARACTER - std::string fileName = args[1]; + std::string fileName = args[1]; if( c ) { @@ -2280,7 +2280,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,loadFromPDR,"load a character from a binary PDR f uint32 guildId= c->getGuildId(); NLMISC::CEntityId id= c->getId(); - static CPersistentDataRecord pdr; + static CPersistentDataRecord pdr; pdr.clear(); pdr.readFromBinFile(fileName+".pdr"); c->apply(pdr); diff --git a/code/ryzom/server/src/entities_game_service/game_event_manager.cpp b/code/ryzom/server/src/entities_game_service/game_event_manager.cpp index d96f122b9..21117ef3e 100644 --- a/code/ryzom/server/src/entities_game_service/game_event_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/game_event_manager.cpp @@ -64,7 +64,7 @@ void CGameEventManager::init() if (CFile::fileExists(sFilename)) { - static CPersistentDataRecord pdr; + static CPersistentDataRecord pdr; pdr.clear(); pdr.readFromTxtFile(sFilename); apply(pdr); diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp index 76ddcc3ae..c88b11f66 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp @@ -53,7 +53,7 @@ void CMissionQueueManager::init() if (CFile::fileExists(sFilename)) { - static CPersistentDataRecord pdr; + static CPersistentDataRecord pdr; pdr.clear(); pdr.readFromTxtFile(sFilename); apply(pdr); diff --git a/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp b/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp index 681a9d7dd..681a32943 100644 --- a/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_manager.cpp @@ -428,7 +428,7 @@ void COutpostManager::loadOutpostSaveFiles() // else // { // // load dynamic data -// static CPersistentDataRecord pdr; +// static CPersistentDataRecord pdr; // pdr.clear(); // pdr.readFromBinFile(files[i]); // outpost->apply( pdr ); diff --git a/code/ryzom/server/src/entities_game_service/shop_type/named_items.cpp b/code/ryzom/server/src/entities_game_service/shop_type/named_items.cpp index 9c5425c94..ba29e78ad 100644 --- a/code/ryzom/server/src/entities_game_service/shop_type/named_items.cpp +++ b/code/ryzom/server/src/entities_game_service/shop_type/named_items.cpp @@ -66,7 +66,7 @@ void CNamedItems::loadNamedItemsFromFile(const std::string & fileName) return; } - static CPersistentDataRecord pdr; + static CPersistentDataRecord pdr; pdr.clear(); pdr.readFromTxtFile(path); CInventoryPtr inv = loadFromPdr(pdr); diff --git a/code/ryzom/server/src/general_utilities_service/merge_commands.cpp b/code/ryzom/server/src/general_utilities_service/merge_commands.cpp index c24a210c3..ef661eb75 100644 --- a/code/ryzom/server/src/general_utilities_service/merge_commands.cpp +++ b/code/ryzom/server/src/general_utilities_service/merge_commands.cpp @@ -60,7 +60,7 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeGuildIdFix,"set the guild ids in the nlinfo("Setting id for guild: %s to: %d",fdc[i].FileName.c_str(),id); // read the file - static CPersistentDataRecord pdr; + static CPersistentDataRecord pdr; pdr.clear(); pdr.readFromFile(fdc[i].FileName.c_str()); @@ -107,7 +107,7 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeChangeCharacterNames,"change names of // read the file NLMISC::CSString fileName= args[0]+NLMISC::toString("/characters/account_%d_%d_pdr.bin",account,slot); DROP_IF(!NLMISC::CFile::fileExists(fileName),"Skipping inexistant file: "+fileName,continue); - static CPersistentDataRecord pdr; + static CPersistentDataRecord pdr; pdr.clear(); pdr.readFromFile(fileName.c_str()); diff --git a/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp b/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp index 3a4c98232..03908bff2 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp +++ b/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp @@ -139,7 +139,7 @@ NLMISC_CATEGORISED_COMMAND(Stats,listCharNames,"display the names of the charact std::sort(files.begin(),files.end()); for (uint32 i=0;i %s",fd.FileName.c_str(),outputFileName.c_str()); - static CPersistentDataRecord pdr; + static CPersistentDataRecord pdr; pdr.clear(); pdr.readFromFile(fd.FileName); pdr.writeToFile(outputFileName); @@ -168,7 +168,7 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2bin,"convert one or more sets of pdr files fd.FileName.rightCrop(4)+".bin": fd.FileName+".bin"; log.displayNL("Converting to Binary : %s => %s",fd.FileName.c_str(),outputFileName.c_str()); - static CPersistentDataRecord pdr; + static CPersistentDataRecord pdr; pdr.clear(); pdr.readFromFile(fd.FileName); pdr.writeToFile(outputFileName); @@ -200,7 +200,7 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2txt,"convert one or more sets of pdr files fd.FileName.rightCrop(4)+".txt": fd.FileName+".txt"; log.displayNL("Converting to TXT : %s => %s",fd.FileName.c_str(),outputFileName.c_str()); - static CPersistentDataRecord pdr; + static CPersistentDataRecord pdr; pdr.clear(); pdr.readFromFile(fd.FileName); pdr.writeToFile(outputFileName); @@ -264,17 +264,18 @@ NLMISC_CATEGORISED_COMMAND(utils,pdrInfo,"Extract info from pdr file(s)"," Date: Tue, 15 Dec 2015 13:39:40 +0100 Subject: [PATCH 03/13] Changed: Use std::string insteaf of const char* for filenames in CPersistentDataRecord --HG-- branch : develop --- .../src/general_utilities_service/merge_commands.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/ryzom/server/src/general_utilities_service/merge_commands.cpp b/code/ryzom/server/src/general_utilities_service/merge_commands.cpp index ef661eb75..4f295481d 100644 --- a/code/ryzom/server/src/general_utilities_service/merge_commands.cpp +++ b/code/ryzom/server/src/general_utilities_service/merge_commands.cpp @@ -62,7 +62,7 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeGuildIdFix,"set the guild ids in the // read the file static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromFile(fdc[i].FileName.c_str()); + pdr.readFromFile(fdc[i].FileName); // convert to XML NLMISC::CSString inputString; @@ -80,8 +80,8 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeGuildIdFix,"set the guild ids in the pdr.fromXML(resultString); // write the file - pdr.writeToFile((fdc[i].FileName+".new.xml").c_str()); - pdr.writeToFile((fdc[i].FileName+".new.bin").c_str()); + pdr.writeToFile(fdc[i].FileName+".new.xml"); + pdr.writeToFile(fdc[i].FileName+".new.bin"); } return true; @@ -109,7 +109,7 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeChangeCharacterNames,"change names of DROP_IF(!NLMISC::CFile::fileExists(fileName),"Skipping inexistant file: "+fileName,continue); static CPersistentDataRecord pdr; pdr.clear(); - pdr.readFromFile(fileName.c_str()); + pdr.readFromFile(fileName); // convert to XML NLMISC::CSString inputString; @@ -127,8 +127,8 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeChangeCharacterNames,"change names of pdr.fromXML(resultString); // write the file - pdr.writeToFile((fileName+".new.xml").c_str()); - pdr.writeToFile((fileName+".new.bin").c_str()); + pdr.writeToFile(fileName+".new.xml"); + pdr.writeToFile(fileName+".new.bin"); } return true; From 2064fa269926083ac19067fa663c1a31b47ee94d Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Dec 2015 13:40:12 +0100 Subject: [PATCH 04/13] Fixed: _PatchDirectory already has a trailing slash --HG-- branch : develop --- code/ryzom/tools/patch_gen/patch_gen_common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/tools/patch_gen/patch_gen_common.cpp b/code/ryzom/tools/patch_gen/patch_gen_common.cpp index 77e46901b..dd4bf4211 100644 --- a/code/ryzom/tools/patch_gen/patch_gen_common.cpp +++ b/code/ryzom/tools/patch_gen/patch_gen_common.cpp @@ -384,7 +384,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const std::string refVersionFileName= prevVersionFileName; // create the subdirectory for this patch number - string versionSubDir = _PatchDirectory+"/"+toString("%05u/", curVersion.getVersionNumber()); + string versionSubDir = _PatchDirectory + toString("%05u/", curVersion.getVersionNumber()); CFile::createDirectory(versionSubDir); // generate the lzma packed version of the bnp if needed (lzma file are slow to generate) From c1716ae3db5300d4be6fe28f1ee2ff9232382409 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Dec 2015 13:41:07 +0100 Subject: [PATCH 05/13] Fixed: Include directories with Qt 5 CMake modules in PCH --HG-- branch : develop --- code/CMakeModules/PCHSupport.cmake | 62 +++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index f3ac564a9..45353d924 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -40,12 +40,15 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) GET_TARGET_PROPERTY(_targetType ${_target} TYPE) + SET(_USE_PIE OFF) + IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY") LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") ELSE() GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE) + MESSAGE(STATUS "Target ${_target} is using PIE") IF(_pic) - LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}") + SET(_USE_PIE ON) ENDIF() ENDIF() @@ -70,6 +73,20 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) ENDFOREACH() ENDIF() + GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS) + IF(DEFINITIONS) + FOREACH(item ${DEFINITIONS}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDFOREACH() + ENDIF() + + GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD}) + IF(DEFINITIONS) + FOREACH(item ${DEFINITIONS}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDFOREACH() + ENDIF() + GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS) IF(oldProps) LIST(APPEND _FLAGS " ${oldProps}") @@ -101,6 +118,49 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) ENDFOREACH() ENDIF() + GET_TARGET_PROPERTY(_LIBS ${_target} INTERFACE_LINK_LIBRARIES) + IF(_LIBS) + FOREACH(_LIB ${_LIBS}) + IF(TARGET "${_LIB}") + # use same include directories + GET_TARGET_PROPERTY(_DIRS ${_LIB} INTERFACE_INCLUDE_DIRECTORIES) + + IF(_DIRS) + FOREACH(item ${_DIRS}) + LIST(APPEND GLOBAL_DEFINITIONS " -I\"${item}\"") + ENDFOREACH() + ENDIF() + + # use same compile definitions + GET_TARGET_PROPERTY(_DEFINITIONS ${_LIB} INTERFACE_COMPILE_DEFINITIONS) + + IF(_DEFINITIONS) + FOREACH(item ${_DEFINITIONS}) + # don't use dynamic expressions + IF(NOT item MATCHES "\\$<") + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDIF() + ENDFOREACH() + ENDIF() + ENDIF() + ENDFOREACH() + ENDIF() + + # Hack to define missing QT_NO_DEBUG with Qt 5.2 + IF(USE_QT5 AND _UPPER_BUILD STREQUAL "RELEASE") + LIST(APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG") + ENDIF() + + # Qt5_POSITION_INDEPENDENT_CODE should be true if Qt was compiled with PIE + IF(Qt5_POSITION_INDEPENDENT_CODE) + SET(_USE_PIE ON) + ENDIF() + + IF(_USE_PIE) + LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}") + LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIC}") + ENDIF() + LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}") IF(CMAKE_VERSION VERSION_LESS "3.3.0") From 1ab5357804d0a7e988c7c8bb9b7fc9afe57666d6 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Dec 2015 13:41:27 +0100 Subject: [PATCH 06/13] Changed: Updates CMake modules --HG-- branch : develop --- code/CMakeModules/AndroidToolChain.cmake | 121 +++++++++++++++-------- code/CMakeModules/Find3dsMaxSDK.cmake | 8 +- code/CMakeModules/FindCustomMFC.cmake | 2 +- code/CMakeModules/FindDirectXSDK.cmake | 8 +- code/CMakeModules/FindMSVC.cmake | 32 +++--- code/CMakeModules/FindMercurial.cmake | 18 ++-- code/CMakeModules/FindWindowsSDK.cmake | 116 +++++++++++----------- code/CMakeModules/GetRevision.cmake | 1 + code/CMakeModules/iOSToolChain.cmake | 113 ++++++++++++--------- 9 files changed, 238 insertions(+), 181 deletions(-) diff --git a/code/CMakeModules/AndroidToolChain.cmake b/code/CMakeModules/AndroidToolChain.cmake index 6690497d4..81d9fe566 100644 --- a/code/CMakeModules/AndroidToolChain.cmake +++ b/code/CMakeModules/AndroidToolChain.cmake @@ -15,48 +15,76 @@ IF(NOT NDK_ROOT) IF(CMAKE_HOST_WIN32) FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT) - ENDIF(CMAKE_HOST_WIN32) -ENDIF(NOT NDK_ROOT) + ENDIF() +ENDIF() IF(NOT TARGET_CPU) SET(TARGET_CPU "armv7") -ENDIF(NOT TARGET_CPU) +ENDIF() + +SET(ARMV7_HARD_FLOAT OFF) IF(TARGET_CPU STREQUAL "armv7") SET(LIBRARY_ARCHITECTURE "armeabi-v7a") + IF(ARMV7_HARD_FLOAT) + SET(LIBRARY_ARCHITECTURE "${LIBRARY_ARCHITECTURE}-hard") + ENDIF() SET(CMAKE_SYSTEM_PROCESSOR "armv7") SET(TOOLCHAIN_ARCH "arm") SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi") - SET(TOOLCHAIN_BIN_PREFIX "arm") + SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi") SET(MINIMUM_NDK_TARGET 4) ELSEIF(TARGET_CPU STREQUAL "armv5") SET(LIBRARY_ARCHITECTURE "armeabi") SET(CMAKE_SYSTEM_PROCESSOR "armv5") SET(TOOLCHAIN_ARCH "arm") SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi") - SET(TOOLCHAIN_BIN_PREFIX "arm") + SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi") SET(MINIMUM_NDK_TARGET 4) +ELSEIF(TARGET_CPU STREQUAL "arm64") + SET(LIBRARY_ARCHITECTURE "arm64-v8a") + SET(CMAKE_SYSTEM_PROCESSOR "arm64") + SET(TOOLCHAIN_ARCH "arm64") + SET(GCC_TOOLCHAIN_PREFIX "aarch64-linux-android") + SET(TOOLCHAIN_BIN_PREFIX "aarch64-linux-android") + SET(MINIMUM_NDK_TARGET 21) ELSEIF(TARGET_CPU STREQUAL "x86") SET(LIBRARY_ARCHITECTURE "x86") SET(CMAKE_SYSTEM_PROCESSOR "x86") SET(TOOLCHAIN_ARCH "x86") SET(GCC_TOOLCHAIN_PREFIX "x86") - SET(TOOLCHAIN_BIN_PREFIX "i686") + SET(TOOLCHAIN_BIN_PREFIX "i686-linux-android") SET(MINIMUM_NDK_TARGET 9) +ELSEIF(TARGET_CPU STREQUAL "x86_64") + SET(LIBRARY_ARCHITECTURE "x86_64") + SET(CMAKE_SYSTEM_PROCESSOR "x86_64") + SET(TOOLCHAIN_ARCH "x86_64") + SET(GCC_TOOLCHAIN_PREFIX "x86_64") + SET(TOOLCHAIN_BIN_PREFIX "x86_64-linux-android") + SET(MINIMUM_NDK_TARGET 21) ELSEIF(TARGET_CPU STREQUAL "mips") SET(LIBRARY_ARCHITECTURE "mips") SET(CMAKE_SYSTEM_PROCESSOR "mips") SET(TOOLCHAIN_ARCH "mips") SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android") - SET(TOOLCHAIN_BIN_PREFIX "mipsel") + SET(TOOLCHAIN_BIN_PREFIX "mipsel-linux-android") SET(MINIMUM_NDK_TARGET 9) -ENDIF(TARGET_CPU STREQUAL "armv7") +ELSEIF(TARGET_CPU STREQUAL "mips64") + SET(LIBRARY_ARCHITECTURE "mips64") + SET(CMAKE_SYSTEM_PROCESSOR "mips64") + SET(TOOLCHAIN_ARCH "mips64") + SET(GCC_TOOLCHAIN_PREFIX "mips64el-linux-android") + SET(TOOLCHAIN_BIN_PREFIX "mips64el-linux-android") + SET(MINIMUM_NDK_TARGET 21) +ELSE() + MESSAGE(FATAL_ERROR "Unable to process TARGET_CPU ${TARGET_CPU}") +ENDIF() +SET(CLANG_TOOLCHAIN_PREFIX "llvm") SET(ANDROID_COMPILER "GCC") IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang") SET(ANDROID_COMPILER "clang") - SET(CLANG_TOOLCHAIN_PREFIX "llvm") SET(CLANG ON) ELSE() SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION}) @@ -64,7 +92,11 @@ ENDIF() IF(NOT NDK_TARGET) SET(NDK_TARGET ${MINIMUM_NDK_TARGET}) -ENDIF(NOT NDK_TARGET) +ELSE() + IF(NDK_TARGET LESS MINIMUM_NDK_TARGET) + SET(NDK_TARGET ${MINIMUM_NDK_TARGET}) + ENDIF() +ENDIF() IF(CMAKE_HOST_WIN32) SET(TOOLCHAIN_HOST "windows") @@ -75,7 +107,7 @@ ELSEIF(CMAKE_HOST_APPLE) ELSEIF(CMAKE_HOST_UNIX) SET(TOOLCHAIN_HOST "linux") SET(TOOLCHAIN_BIN_SUFFIX "") -ENDIF(CMAKE_HOST_WIN32) +ENDIF() MACRO(SEARCH_TOOLCHAIN _COMPILER) SET(${_COMPILER}_TOOLCHAIN_VERSIONS) @@ -110,7 +142,7 @@ MACRO(SEARCH_TOOLCHAIN _COMPILER) FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*") IF(_TOOLCHAIN_PREFIXES) LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT) - ENDIF(_TOOLCHAIN_PREFIXES) + ENDIF() ENDIF() ENDMACRO() @@ -123,8 +155,14 @@ ENDIF() SEARCH_TOOLCHAIN(GCC) MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}") -MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}") -MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}") + +IF(CLANG_TOOLCHAIN_ROOT) + MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}") +ENDIF() + +IF(GCC_TOOLCHAIN_ROOT) + MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}") +ENDIF() SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}") @@ -137,14 +175,7 @@ SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++") IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}") # NDK version >= 8b SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}") -ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}") - -# Determine bin prefix for toolchain -FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}") -IF(_TOOLCHAIN_BIN_PREFIXES) - LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX) - STRING(REGEX REPLACE "${GCC_TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}") -ENDIF(_TOOLCHAIN_BIN_PREFIXES) +ENDIF() SET(STL_INCLUDE_DIR "${STL_DIR}/include") SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}") @@ -160,39 +191,45 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY) - IF("${_BINARY}" MATCHES "clang") - SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE ) - ELSE() - SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE) - ENDIF() -ENDMACRO(SET_TOOLCHAIN_BINARY) +MACRO(SET_TOOLCHAIN_BINARY_LLVM _NAME _BINARY) + SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE ) +ENDMACRO() + +MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY) + SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE) +ENDMACRO() # Force the compilers to GCC for Android include (CMakeForceCompiler) IF(CLANG) - SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang) - SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++) + MESSAGE(STATUS "Using clang compiler") + + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang) + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++) CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang) CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang) - MESSAGE(STATUS "Using clang compiler") + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as) + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar) + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++) ELSE() - SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc) - SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++) + MESSAGE(STATUS "Using GCC compiler") + + SET_TOOLCHAIN_BINARY_GCC(CMAKE_C_COMPILER gcc) + SET_TOOLCHAIN_BINARY_GCC(CMAKE_CXX_COMPILER g++) CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU) CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU) - MESSAGE(STATUS "Using GCC compiler") + SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as) + SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar) + SET_TOOLCHAIN_BINARY_GCC(CMAKE_LINKER ld) ENDIF() -SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip) -SET_TOOLCHAIN_BINARY(CMAKE_AR ar) -SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld) -SET_TOOLCHAIN_BINARY(CMAKE_NM nm) -SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy) -SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump) -SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib) +SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip) +SET_TOOLCHAIN_BINARY_GCC(CMAKE_NM nm) +SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJCOPY objcopy) +SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJDUMP objdump) +SET_TOOLCHAIN_BINARY_GCC(CMAKE_RANLIB ranlib) diff --git a/code/CMakeModules/Find3dsMaxSDK.cmake b/code/CMakeModules/Find3dsMaxSDK.cmake index 0510d3a6e..bde126208 100644 --- a/code/CMakeModules/Find3dsMaxSDK.cmake +++ b/code/CMakeModules/Find3dsMaxSDK.cmake @@ -9,7 +9,7 @@ if(MAXSDK_INCLUDE_DIR) # Already in cache, be silent SET(MAXSDK_FIND_QUIETLY TRUE) -endif(MAXSDK_INCLUDE_DIR) +endif() FIND_PATH(MAXSDK_DIR "include/maxversion.h" @@ -37,9 +37,9 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h IF(TARGET_X64) SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib) -ELSE(TARGET_X64) +ELSE() SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib) -ENDIF(TARGET_X64) +ENDIF() MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) FIND_LIBRARY(${MYLIBRARY} @@ -47,7 +47,7 @@ MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) HINTS ${MAXSDK_LIBRARY_DIRS} ) -ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) +ENDMACRO() FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core) FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom) diff --git a/code/CMakeModules/FindCustomMFC.cmake b/code/CMakeModules/FindCustomMFC.cmake index 621bf49ae..45d5b8cce 100644 --- a/code/CMakeModules/FindCustomMFC.cmake +++ b/code/CMakeModules/FindCustomMFC.cmake @@ -45,6 +45,6 @@ IF(MFC_FOUND) # Set CMake flag to use MFC DLL SET(CMAKE_MFC_FLAG 2) -ENDIF(MFC_FOUND) +ENDIF() # TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project diff --git a/code/CMakeModules/FindDirectXSDK.cmake b/code/CMakeModules/FindDirectXSDK.cmake index b64fca6ea..847a6d596 100644 --- a/code/CMakeModules/FindDirectXSDK.cmake +++ b/code/CMakeModules/FindDirectXSDK.cmake @@ -30,16 +30,16 @@ MACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME) HINTS "${DXSDK_LIBRARY_DIR}" ) -ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME) +ENDMACRO() IF(DXSDK_DIR) SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include") IF(TARGET_X64) SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x64 ${DXSDK_DIR}/lib/amd64) - ELSE(TARGET_X64) + ELSE() SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x86 ${DXSDK_DIR}/lib) - ENDIF(TARGET_X64) + ENDIF() FIND_PATH(DXSDK_LIBRARY_DIR dxguid.lib @@ -52,7 +52,7 @@ IF(DXSDK_DIR) FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio) FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9) FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9) -ENDIF(DXSDK_DIR) +ENDIF() # Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if # all listed variables are TRUE. diff --git a/code/CMakeModules/FindMSVC.cmake b/code/CMakeModules/FindMSVC.cmake index 94146775d..5c433f429 100644 --- a/code/CMakeModules/FindMSVC.cmake +++ b/code/CMakeModules/FindMSVC.cmake @@ -14,8 +14,8 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION) GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE) IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/") - ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") - ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry") + ENDIF() + ENDIF() IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") SET(VC${_VERSION}_FOUND ON) @@ -24,14 +24,14 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION) SET(_VERSION_STR ${_VERSION}) IF(MSVC_EXPRESS) SET(_VERSION_STR "${_VERSION_STR} Express") - ENDIF(MSVC_EXPRESS) + ENDIF() MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}") - ENDIF(NOT MSVC_FIND_QUIETLY) + ENDIF() ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") SET(VC${_VERSION}_FOUND OFF) SET(VC${_VERSION}_DIR "") - ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") -ENDMACRO(DETECT_VC_VERSION_HELPER) + ENDIF() +ENDMACRO() MACRO(DETECT_VC_VERSION _VERSION) SET(VC${_VERSION}_FOUND OFF) @@ -39,21 +39,21 @@ MACRO(DETECT_VC_VERSION _VERSION) IF(NOT VC${_VERSION}_FOUND) DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) - ENDIF(NOT VC${_VERSION}_FOUND) + ENDIF() IF(VC${_VERSION}_FOUND) SET(VC_FOUND ON) SET(VC_DIR "${VC${_VERSION}_DIR}") - ENDIF(VC${_VERSION}_FOUND) -ENDMACRO(DETECT_VC_VERSION) + ENDIF() +ENDMACRO() MACRO(DETECT_EXPRESS_VERSION _VERSION) GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE) IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry") SET(MSVC_EXPRESS ON) - ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry") -ENDMACRO(DETECT_EXPRESS_VERSION) + ENDIF() +ENDMACRO() IF(MSVC12) DETECT_VC_VERSION("12.0") @@ -62,7 +62,7 @@ IF(MSVC12) IF(NOT MSVC12_REDIST_DIR) # If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF(NOT MSVC12_REDIST_DIR) + ENDIF() ELSEIF(MSVC11) DETECT_VC_VERSION("11.0") SET(MSVC_TOOLSET "110") @@ -70,7 +70,7 @@ ELSEIF(MSVC11) IF(NOT MSVC11_REDIST_DIR) # If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF(NOT MSVC11_REDIST_DIR) + ENDIF() ELSEIF(MSVC10) DETECT_VC_VERSION("10.0") SET(MSVC_TOOLSET "100") @@ -78,19 +78,19 @@ ELSEIF(MSVC10) IF(NOT MSVC10_REDIST_DIR) # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF(NOT MSVC10_REDIST_DIR) + ENDIF() ELSEIF(MSVC90) DETECT_VC_VERSION("9.0") SET(MSVC_TOOLSET "90") ELSEIF(MSVC80) DETECT_VC_VERSION("8.0") SET(MSVC_TOOLSET "80") -ENDIF(MSVC12) +ENDIF() # If you plan to use VC++ compilers with WINE, set VC_DIR environment variable IF(NOT VC_DIR) SET(VC_DIR $ENV{VC_DIR}) -ENDIF(NOT VC_DIR) +ENDIF() IF(NOT VC_DIR) STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER}) diff --git a/code/CMakeModules/FindMercurial.cmake b/code/CMakeModules/FindMercurial.cmake index dbb2110ff..f85952557 100644 --- a/code/CMakeModules/FindMercurial.cmake +++ b/code/CMakeModules/FindMercurial.cmake @@ -31,7 +31,7 @@ # MESSAGE("Current revision is ${Project_WC_REVISION}") # Mercurial_WC_LOG(${PROJECT_SOURCE_DIR} Project) # MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}") -# ENDIF(MERCURIAL_FOUND) +# ENDIF() #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -74,22 +74,22 @@ IF(Mercurial_HG_EXECUTABLE) IF(NOT ${Mercurial_hg_info_result} EQUAL 0) MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}") - ELSE(NOT ${Mercurial_hg_info_result} EQUAL 0) + ELSE() LIST(LENGTH ${prefix}_WC_INFO _COUNT) IF(_COUNT EQUAL 4) LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION) LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET) LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH) LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR) - ELSE(_COUNT EQUAL 4) + ELSE() MESSAGE(STATUS "Bad output from HG") SET(${prefix}_WC_REVISION "unknown") SET(${prefix}_WC_CHANGESET "unknown") SET(${prefix}_WC_BRANCH "unknown") - ENDIF(_COUNT EQUAL 4) - ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0) + ENDIF() + ENDIF() - ENDMACRO(Mercurial_WC_INFO) + ENDMACRO() MACRO(Mercurial_WC_LOG dir prefix) # This macro can block if the certificate is not signed: @@ -105,9 +105,9 @@ IF(Mercurial_HG_EXECUTABLE) IF(NOT ${Mercurial_hg_log_result} EQUAL 0) MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Mercurial_hg_log_error}") - ENDIF(NOT ${Mercurial_hg_log_result} EQUAL 0) - ENDMACRO(Mercurial_WC_LOG) -ENDIF(Mercurial_HG_EXECUTABLE) + ENDIF() + ENDMACRO() +ENDIF() INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE) diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index bdc940090..93540a7e8 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -9,7 +9,7 @@ IF(WINSDK_FOUND) # If Windows SDK already found, skip it RETURN() -ENDIF(WINSDK_FOUND) +ENDIF() # Values can be CURRENT or any existing versions 7.1, 8.0A, etc... SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer") @@ -25,8 +25,8 @@ MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION) ENDIF(NOT WindowsSDK_FIND_QUIETLY) ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") SET(WINSDK${_VERSION}_DIR "") - ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") -ENDMACRO(DETECT_WINSDK_VERSION_HELPER) + ENDIF() +ENDMACRO() MACRO(DETECT_WINSDK_VERSION _VERSION) SET(WINSDK${_VERSION}_FOUND OFF) @@ -34,8 +34,8 @@ MACRO(DETECT_WINSDK_VERSION _VERSION) IF(NOT WINSDK${_VERSION}_FOUND) DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) - ENDIF(NOT WINSDK${_VERSION}_FOUND) -ENDMACRO(DETECT_WINSDK_VERSION) + ENDIF() +ENDMACRO() SET(WINSDK_VERSIONS "8.1" "8.0" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A") SET(WINSDK_DETECTED_VERSIONS) @@ -46,8 +46,8 @@ FOREACH(_VERSION ${WINSDK_VERSIONS}) IF(WINSDK${_VERSION}_FOUND) LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION}) - ENDIF(WINSDK${_VERSION}_FOUND) -ENDFOREACH(_VERSION) + ENDIF() +ENDFOREACH() SET(WINSDK_SUFFIX) @@ -58,19 +58,19 @@ ELSEIF(TARGET_X64) SET(WINSDK_SUFFIX "x64") ELSEIF(TARGET_X86) SET(WINSDK8_SUFFIX "x86") -ENDIF(TARGET_ARM) +ENDIF() SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE}) IF(WINSDKCURRENT_VERSION_INCLUDE) FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE) -ENDIF(WINSDKCURRENT_VERSION_INCLUDE) +ENDIF() SET(WINSDKENV_DIR $ENV{WINSDK_DIR}) IF(NOT WINSDKENV_DIR) SET(WINSDKENV_DIR $ENV{WindowsSDKDir}) -ENDIF(NOT WINSDKENV_DIR) +ENDIF() MACRO(FIND_WINSDK_VERSION_HEADERS) IF(WINSDK_DIR AND NOT WINSDK_VERSION) @@ -88,8 +88,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) IF(_CONTENT) SET(WINSDK_VERSION "8.1") - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() IF(NOT WINSDK_VERSION) # Look for Windows SDK 8.0 @@ -97,8 +97,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) IF(_CONTENT) SET(WINSDK_VERSION "8.0") - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() IF(NOT WINSDK_VERSION) # Look for Windows SDK 7.0 @@ -123,14 +123,14 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) SET(WINSDK_VERSION "7.1") ELSEIF(_WINSDKVER STREQUAL "0601") SET(WINSDK_VERSION "7.0A") - ELSE(_WINSDKVER STREQUAL "06010000") + ELSE() MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}") - ENDIF(_WINSDKVER STREQUAL "06010000") - ELSE(_WINSDKVER_FILE) + ENDIF() + ELSE() SET(WINSDK_VERSION "7.0") - ENDIF(_WINSDKVER_FILE) - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() + ENDIF() IF(NOT WINSDK_VERSION) # Look for Windows SDK 6.0 @@ -138,8 +138,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) IF(_CONTENT) SET(WINSDK_VERSION "6.0") - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() IF(NOT WINSDK_VERSION) # Look for Windows SDK 5.2 @@ -147,8 +147,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) IF(_CONTENT) SET(WINSDK_VERSION "5.2") - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() IF(NOT WINSDK_VERSION) # Look for Windows SDK 5.1 @@ -156,8 +156,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) IF(_CONTENT) SET(WINSDK_VERSION "5.1") - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() IF(NOT WINSDK_VERSION) # Look for Windows SDK 5.0 @@ -165,13 +165,13 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) IF(_CONTENT) SET(WINSDK_VERSION "5.0") - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) - ELSE(_MSI_FILE) + ENDIF() + ENDIF() + ELSE() MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}") - ENDIF(_MSI_FILE) - ENDIF(WINSDK_DIR AND NOT WINSDK_VERSION) -ENDMACRO(FIND_WINSDK_VERSION_HEADERS) + ENDIF() + ENDIF() +ENDMACRO() MACRO(USE_CURRENT_WINSDK) SET(WINSDK_DIR "") @@ -185,7 +185,7 @@ MACRO(USE_CURRENT_WINSDK) ${WINSDKENV_DIR}/Include/um ${WINSDKENV_DIR}/Include ) - ENDIF(WINSDKENV_DIR) + ENDIF() # Use INCLUDE environment variable IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE) @@ -197,9 +197,9 @@ MACRO(USE_CURRENT_WINSDK) STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE}) MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}") BREAK() - ENDIF(EXISTS ${_INCLUDE}/Windows.h) - ENDFOREACH(_INCLUDE) - ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE) + ENDIF() + ENDFOREACH() + ENDIF() IF(WINSDK_DIR) # Compare WINSDK_DIR with registered Windows SDKs @@ -208,11 +208,11 @@ MACRO(USE_CURRENT_WINSDK) SET(WINSDK_VERSION ${_VERSION}) SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") BREAK() - ENDIF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}") - ENDFOREACH(_VERSION) + ENDIF() + ENDFOREACH() FIND_WINSDK_VERSION_HEADERS() - ENDIF(WINSDK_DIR) + ENDIF() IF(NOT WINSDK_DIR) # Use Windows SDK versions installed with VC++ when possible @@ -223,19 +223,19 @@ MACRO(USE_CURRENT_WINSDK) ELSEIF(MSVC10) IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS) SET(WINSDK_VERSION "7.0A") - ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS) + ENDIF() ELSEIF(MSVC90) IF(NOT MSVC_EXPRESS) SET(WINSDK_VERSION "6.0A") - ENDIF(NOT MSVC_EXPRESS) + ENDIF() ELSEIF(MSVC80) IF(NOT MSVC_EXPRESS) # TODO: fix this version SET(WINSDK_VERSION "5.2A") - ENDIF(NOT MSVC_EXPRESS) - ELSE(MSVC12) + ENDIF() + ELSE() MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.") - ENDIF(MSVC12) + ENDIF() # Use installed Windows SDK IF(NOT WINSDK_VERSION) @@ -262,27 +262,27 @@ MACRO(USE_CURRENT_WINSDK) SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}") BREAK() - ENDIF(WINSDK_VERSION STREQUAL _VERSION) - ENDFOREACH(_VERSION) - ENDIF(NOT WINSDK_DIR) -ENDMACRO(USE_CURRENT_WINSDK) + ENDIF() + ENDFOREACH() + ENDIF() +ENDMACRO() IF(WINSDK_VERSION STREQUAL "CURRENT") USE_CURRENT_WINSDK() -ELSE(WINSDK_VERSION STREQUAL "CURRENT") +ELSE() IF(WINSDK${WINSDK_VERSION}_FOUND) SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}") - ELSE(WINSDK${WINSDK_VERSION}_FOUND) + ELSE() USE_CURRENT_WINSDK() - ENDIF(WINSDK${WINSDK_VERSION}_FOUND) -ENDIF(WINSDK_VERSION STREQUAL "CURRENT") + ENDIF() +ENDIF() IF(WINSDK_DIR) MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}") -ELSE(WINSDK_DIR) +ELSE() MESSAGE(FATAL_ERROR "Unable to find Windows SDK!") -ENDIF(WINSDK_DIR) +ENDIF() # directory where Win32 headers are found FIND_PATH(WINSDK_INCLUDE_DIR Windows.h @@ -339,9 +339,9 @@ IF(WINSDK_INCLUDE_DIR) # Fix for using Windows SDK 7.1 with Visual C++ 2012 IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11) ADD_DEFINITIONS(-D_USING_V110_SDK71_) - ENDIF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11) -ELSE(WINSDK_INCLUDE_DIR) + ENDIF() +ELSE() IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Windows SDK!") - ENDIF(NOT WindowsSDK_FIND_QUIETLY) -ENDIF(WINSDK_INCLUDE_DIR) + ENDIF() +ENDIF() diff --git a/code/CMakeModules/GetRevision.cmake b/code/CMakeModules/GetRevision.cmake index 7a22d2003..b29a8763e 100644 --- a/code/CMakeModules/GetRevision.cmake +++ b/code/CMakeModules/GetRevision.cmake @@ -2,6 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) # ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory) # SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt) +# BINARY_DIR should be set to root of your build directory IF(SOURCE_DIR) # Replace spaces by semi-columns diff --git a/code/CMakeModules/iOSToolChain.cmake b/code/CMakeModules/iOSToolChain.cmake index 5b419778e..bccfc0236 100644 --- a/code/CMakeModules/iOSToolChain.cmake +++ b/code/CMakeModules/iOSToolChain.cmake @@ -40,48 +40,67 @@ include (CMakeForceCompiler) CMAKE_FORCE_C_COMPILER (clang Clang) CMAKE_FORCE_CXX_COMPILER (clang++ Clang) +IF(CMAKE_CXX_COMPILER) + EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version + OUTPUT_VARIABLE CLANG_VERSION_RAW + OUTPUT_STRIP_TRAILING_WHITESPACE) + + STRING(REGEX REPLACE "Apple LLVM version ([\\.0-9]+).*" + "\\1" CMAKE_CXX_COMPILER_VERSION "${CLANG_VERSION_RAW}") + + SET(CMAKE_C_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}) + SET(CMAKE_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}) +ENDIF() + # Setup iOS platform -if (NOT DEFINED IOS_PLATFORM) - set (IOS_PLATFORM "OS") -endif (NOT DEFINED IOS_PLATFORM) -set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform") +IF(NOT DEFINED IOS_PLATFORM) + SET(IOS_PLATFORM "OS") +ENDIF() + +SET(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform") SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform") SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform") # Check the platform selection and setup for developer root -if (${IOS_PLATFORM} STREQUAL "OS") +if(${IOS_PLATFORM} STREQUAL "OS") # This causes the installers to properly locate the output libraries set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos") -elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR") +elseif(${IOS_PLATFORM} STREQUAL "SIMULATOR") # This causes the installers to properly locate the output libraries set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator") -elseif (${IOS_PLATFORM} STREQUAL "ALL") +elseif(${IOS_PLATFORM} STREQUAL "ALL") # This causes the installers to properly locate the output libraries set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos") -else (${IOS_PLATFORM} STREQUAL "OS") +else() message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR") -endif (${IOS_PLATFORM} STREQUAL "OS") +endif() set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform") # Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT # Note Xcode 4.3 changed the installation location, choose the most recent one available -SET(XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms") -SET(XCODE_PRE_43_ROOT "/Developer/Platforms") +SET(XCODE_DEFAULT_ROOT "/Applications/Xcode.app/Contents") IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) - IF(EXISTS ${XCODE_POST_43_ROOT}) - SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT}) - ELSEIF(EXISTS ${XCODE_PRE_43_ROOT}) - SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT}) - ENDIF(EXISTS ${XCODE_POST_43_ROOT}) - IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) - SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) - ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) - IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) - SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) - ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) -ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) + IF(NOT DEFINED CMAKE_XCODE_ROOT) + IF(EXISTS ${XCODE_DEFAULT_ROOT}) + SET(CMAKE_XCODE_ROOT ${XCODE_DEFAULT_ROOT} CACHE STRING "Xcode root") + ELSE() + MESSAGE(FATAL_ERROR "Xcode directory ${XCODE_DEFAULT_ROOT} doesn't exist") + ENDIF() + ENDIF() + SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer) + IF(EXISTS ${TMP}) + SET(CMAKE_IOS_DEVELOPER_ROOT ${TMP}) + MESSAGE(STATUS "Use iOS developer root: ${CMAKE_IOS_DEVELOPER_ROOT}") + ENDIF() + SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) + IF(EXISTS ${TMP}) + SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${TMP}) + MESSAGE(STATUS "Use iOS simulator developer root: ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}") + ENDIF() +ENDIF() + SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform") SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform") @@ -93,36 +112,36 @@ MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS) FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS}) STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}") LIST(APPEND ${VERSIONS} ${_IOS_SDK}) - ENDFOREACH(_CMAKE_IOS_SDK) - ENDIF(_CMAKE_IOS_SDKS) -ENDMACRO(GET_AVAILABLE_SDK_VERSIONS) + ENDFOREACH() + ENDIF() +ENDMACRO() -# Find and use the most recent iOS sdk +# Find and use the most recent iOS sdk IF(NOT DEFINED CMAKE_IOS_SDK_ROOT) # Search for a specific version of a SDK GET_AVAILABLE_SDK_VERSIONS(${CMAKE_IOS_DEVELOPER_ROOT} IOS_VERSIONS) IF(NOT IOS_VERSIONS) MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.") - ENDIF(NOT IOS_VERSIONS) - + ENDIF() + IF(IOS_VERSION) LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX) IF(_INDEX EQUAL -1) LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION) - ELSE(_INDEX EQUAL -1) + ELSE() SET(IOS_SDK_VERSION ${IOS_VERSION}) - ENDIF(_INDEX EQUAL -1) - ELSE(IOS_VERSION) + ENDIF() + ELSE() LIST(GET IOS_VERSIONS 0 IOS_VERSION) SET(IOS_SDK_VERSION ${IOS_VERSION}) - ENDIF(IOS_VERSION) + ENDIF() MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}") SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk) SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk) -endif (NOT DEFINED CMAKE_IOS_SDK_ROOT) +endif() SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK") SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK") @@ -134,31 +153,32 @@ SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS sup SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support") IF(CMAKE_GENERATOR MATCHES Xcode) - SET(ARCHS "$(ARCHS_STANDARD_32_BIT)") IF(${IOS_PLATFORM} STREQUAL "OS") SET(CMAKE_SYSTEM_PROCESSOR "armv7") ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR") SET(CMAKE_SYSTEM_PROCESSOR "x86") ELSEIF(${IOS_PLATFORM} STREQUAL "ALL") SET(CMAKE_SYSTEM_PROCESSOR "armv7") - ENDIF(${IOS_PLATFORM} STREQUAL "OS") -ELSE(CMAKE_GENERATOR MATCHES Xcode) + ENDIF() +ELSE() IF(${IOS_PLATFORM} STREQUAL "OS") - SET(ARCHS "armv7") + SET(ARCHS "armv7;arm64") SET(CMAKE_SYSTEM_PROCESSOR "armv7") ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR") # iPhone simulator targets i386 SET(ARCHS "i386") SET(CMAKE_SYSTEM_PROCESSOR "x86") ELSEIF(${IOS_PLATFORM} STREQUAL "ALL") - SET(ARCHS "armv7;i386") + SET(ARCHS "armv7;arm64;i386;x86_64") SET(CMAKE_SYSTEM_PROCESSOR "armv7") - ENDIF(${IOS_PLATFORM} STREQUAL "OS") -ENDIF(CMAKE_GENERATOR MATCHES Xcode) + ENDIF() +ENDIF() -# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard. +# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard. # The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only -set (CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS") +IF(ARCHS) + SET(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS") +ENDIF() # Set the find root to the iOS developer roots and to user defined paths set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root") @@ -174,10 +194,9 @@ set (CMAKE_SYSTEM_FRAMEWORK_PATH ) # only search the iOS sdks, not the remainder of the host filesystem -set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include) -#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib) -#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin) +# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH +include(CMakeFindBinUtils) From bc12a142c8c148caf515201ca133a30390982db4 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Dec 2015 14:05:56 +0100 Subject: [PATCH 07/13] Changed: Replace atoi by fromString --HG-- branch : develop --- .../mission_manager/mission_step_kill.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp index 9124c1fc3..7e8e809d4 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp @@ -1095,14 +1095,19 @@ class CMissionStepKillPlayer : public IMissionStepTemplate return false; } // missionData.ChatParams.push_back( make_pair( args[0], STRING_MANAGER::clan ) ); - subStep.MinLevel = atoi( args[1].c_str() ) * kFameMultipler; - subStep.MaxLevel = atoi( args[2].c_str() ) * kFameMultipler; + NLMISC::fromString(args[1], subStep.MinLevel); + NLMISC::fromString(args[2], subStep.MaxLevel); + + subStep.MinLevel *= kFameMultipler; + subStep.MaxLevel *= kFameMultipler; + if ( subStep.MinLevel >= subStep.MaxLevel ) { MISLOGERROR("min_level >= max_level"); return false; } - subStep.Quantity = (uint16) atoi( args[3].c_str() ); + NLMISC::fromString(args[3], subStep.Quantity); + if ( subStep.Quantity == 0 ) { MISLOGERROR("invalid quantity 0"); From 70196d2f90d057565accf14a3d3cf9bc9a3b2b23 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Dec 2015 14:06:49 +0100 Subject: [PATCH 08/13] Fixed: Implement launch of executables under OS X --HG-- branch : develop --- code/nel/src/misc/common.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 03bd6c3d0..3a8f5e85c 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -728,7 +728,30 @@ bool launchProgram(const std::string &programName, const std::string &arguments, CloseHandle( pi.hThread ); } -#elif defined(NL_OS_UNIX) +#elif defined(NL_OS_MAC) + std::string command; + + if (CFile::getExtension(programName) == "app") + { + // we need to open bundles with "open" command + command = NLMISC::toString("open \"%s\"", programName.c_str()); + } + else + { + command = programName; + } + + // append arguments if any + if (!arguments.empty()) + { + command += NLMISC::toString(" --args %s", arguments.c_str()); + } + + int res = system(command.c_str()); + + if (res && log) + nlwarning ("LAUNCH: Failed launched '%s' with arg '%s' return code %d", programName.c_str(), arguments.c_str(), res); +#else static bool firstLaunchProgram = true; if (firstLaunchProgram) @@ -811,9 +834,6 @@ bool launchProgram(const std::string &programName, const std::string &arguments, return true; } -#else - if (log) - nlwarning ("LAUNCH: launchProgram() not implemented"); #endif return false; From a550f2c7606b704c71c7c893e11cb32b2917faf5 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Dec 2015 14:07:32 +0100 Subject: [PATCH 09/13] Changed: Minor changes --HG-- branch : develop --- code/nel/src/misc/common.cpp | 2 +- .../game_item_manager/game_item_manager.cpp | 10 ++++++---- .../entities_game_service/player_manager/cdb_branch.h | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 3a8f5e85c..4c0db690e 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -708,7 +708,7 @@ bool launchProgram(const std::string &programName, const std::string &arguments, } string arg = " " + arguments; - BOOL res = CreateProcessA(programName.c_str(), (char*)arg.c_str(), 0, 0, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, 0, 0, &si, &pi); + BOOL res = CreateProcessA(programName.c_str(), (char*)arg.c_str(), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL, &si, &pi); if (res) { diff --git a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp index 16258192c..72e9b2c8c 100644 --- a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp @@ -918,8 +918,9 @@ NLMISC_COMMAND(createItem,"create a new item","") // return false; // } // -// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0].c_str()) ); -// //uint16 quality = (uint16)NLMISC::fromString(args[1].c_str()); +// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0]) ); +// //uint16 quality; +// //NLMISC::fromString(args[1]; quality); // // sint32 x; // NLMISC::fromString(args[2], x); @@ -957,9 +958,10 @@ NLMISC_COMMAND(createItem,"create a new item","") // } // else // { -// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0].c_str()) ); +// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0]) ); // CSheetId sheetId(args[1]); -// uint16 quality = (uint16)NLMISC::fromString(args[2].c_str()); +// uint16 quality; +// NLMISC::fromString(args[2], quality); // sint32 x = (sint32)NLMISC::fromString(args[3].c_str()) * 1000; // sint32 y = (sint32)NLMISC::fromString(args[4].c_str()) * 1000; // sint32 z = (sint32)NLMISC::fromString(args[5].c_str()) * 1000; diff --git a/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.h b/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.h index bb16436e9..ef76578fd 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.h @@ -140,8 +140,7 @@ public: //get the number of nodes uint16 getNbNodes() const { - return (uint16) - _Nodes.size(); + return (uint16)_Nodes.size(); } /** From 3a3a8752d13c4203772c5f175045e0328cdeda00 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Dec 2015 14:33:59 +0100 Subject: [PATCH 10/13] Changed: Replace (uint16)~0 by std::numeric_limits::max() --HG-- branch : develop --- code/ryzom/common/src/game_share/base_types.h | 5 ++-- .../src/game_share/change_tracker_base.h | 2 +- .../src/game_share/mirrored_data_set_inline.h | 3 +- .../src/game_share/persistent_data_template.h | 28 +++++++++---------- .../game_share/property_allocator_client.h | 4 ++- .../server/src/ai_service/ai_world_map.h | 2 +- .../src/entities_game_service/deposit.h | 2 +- .../egs_sheets/egs_static_emot.h | 2 +- .../egs_sheets/egs_static_text_emotes.h | 2 +- .../phrase_manager/special_power_phrase.cpp | 2 +- .../special_power_shielding.cpp | 2 +- .../phrase_manager/special_power_taunt.cpp | 2 +- .../player_manager/character.cpp | 4 +-- .../player_manager/powers_and_auras.cpp | 6 ++-- .../player_manager/powers_and_auras.h | 2 +- 15 files changed, 36 insertions(+), 32 deletions(-) diff --git a/code/ryzom/common/src/game_share/base_types.h b/code/ryzom/common/src/game_share/base_types.h index f24daa69a..b1b0dc1e5 100644 --- a/code/ryzom/common/src/game_share/base_types.h +++ b/code/ryzom/common/src/game_share/base_types.h @@ -24,6 +24,7 @@ #include "nel/misc/types_nl.h" #include "nel/net/unified_network.h" +#include /* * Types for options of CMirroredDataSet::declareProperty() @@ -374,13 +375,13 @@ const TPropertyIndex INVALID_PROPERTY_INDEX = (TPropertyIndex)~0; #ifdef MIRROR_LIST_ROW_32BITS typedef uint32 TSharedListRow; -const TSharedListRow INVALID_SHAREDLIST_ROW = ~0; //((uint16)~0)-1; +const TSharedListRow INVALID_SHAREDLIST_ROW = std::numeric_limits::max(); // std::numeric_limits::max()-1; const uint NB_SHAREDLIST_CELLS = 500000; // property+list container footprint with data size of 32 bit and 500000 rows: 5.8 MB #else typedef uint16 TSharedListRow; -const TSharedListRow INVALID_SHAREDLIST_ROW = ((uint16)~0)-1; +const TSharedListRow INVALID_SHAREDLIST_ROW = std::numeric_limits::max()-1; const uint NB_SHAREDLIST_CELLS = INVALID_SHAREDLIST_ROW; // property+list container footprint with data size of 32 bit and 500000 rows: 1.3 MB #endif diff --git a/code/ryzom/common/src/game_share/change_tracker_base.h b/code/ryzom/common/src/game_share/change_tracker_base.h index 47ff79c3e..70298aadf 100644 --- a/code/ryzom/common/src/game_share/change_tracker_base.h +++ b/code/ryzom/common/src/game_share/change_tracker_base.h @@ -68,7 +68,7 @@ struct TChangeTrackerHeader }; -const uint16 LOCAL_TRACKER_SERVICE_ID = (uint16)~0; +const uint16 LOCAL_TRACKER_SERVICE_ID = std::numeric_limits::max(); /** * Item in a tracker diff --git a/code/ryzom/common/src/game_share/mirrored_data_set_inline.h b/code/ryzom/common/src/game_share/mirrored_data_set_inline.h index 518d2ede4..50ab076b7 100644 --- a/code/ryzom/common/src/game_share/mirrored_data_set_inline.h +++ b/code/ryzom/common/src/game_share/mirrored_data_set_inline.h @@ -22,6 +22,7 @@ #include //#include +#include const uint MAX_NB_DATASETS = 4; extern bool VerboseWarnWhenMirrorReturningUnknownEntityId; @@ -260,7 +261,7 @@ inline uint16 datasetToBitIndex( CMirroredDataSet *dataSet ) if ( DataSetQuickArray[i] == dataSet ) return (uint16)i; } - return (uint16)~0; + return std::numeric_limits::max(); } diff --git a/code/ryzom/common/src/game_share/persistent_data_template.h b/code/ryzom/common/src/game_share/persistent_data_template.h index 560603f0a..0115febef 100644 --- a/code/ryzom/common/src/game_share/persistent_data_template.h +++ b/code/ryzom/common/src/game_share/persistent_data_template.h @@ -370,13 +370,13 @@ void PERSISTENT_CLASS::store(CPersistentDataRecord &pdr _PERSISTENT_STORE_ARGS) #else // define the set of tokens - this makes sure that the tokens exist in the map and that we only look them up the once - static uint16 __Tok__MapKey= (uint16)~0u; pdr.addString("__Key__",__Tok__MapKey); - static uint16 __Tok__MapVal= (uint16)~0u; pdr.addString("__Val__",__Tok__MapVal); - #define _PROP(token,name,type,logic,get,set) static uint16 token= (uint16)~0u; pdr.addString(name,token); - #define _STRUCT(token,name,logic,write,read) static uint16 token= (uint16)~0u; pdr.addString(name,token); - #define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token= (uint16)~0u; pdr.addString(name,token); - #define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token= (uint16)~0u; pdr.addString(name,token); - #define _FLAG(token,name,logic,code) static uint16 token= (uint16)~0u; pdr.addString(name,token); + static uint16 __Tok__MapKey = std::numeric_limits::max(); pdr.addString("__Key__",__Tok__MapKey); + static uint16 __Tok__MapVal = std::numeric_limits::max(); pdr.addString("__Val__",__Tok__MapVal); + #define _PROP(token,name,type,logic,get,set) static uint16 token = std::numeric_limits::max(); pdr.addString(name,token); + #define _STRUCT(token,name,logic,write,read) static uint16 token = std::numeric_limits::max(); pdr.addString(name,token); + #define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token = std::numeric_limits::max(); pdr.addString(name,token); + #define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token = std::numeric_limits::max(); pdr.addString(name,token); + #define _FLAG(token,name,logic,code) static uint16 token = std::numeric_limits::max(); pdr.addString(name,token); PERSISTENT_DATA #undef _PROP #undef _STRUCT @@ -471,13 +471,13 @@ void PERSISTENT_CLASS::apply(CPersistentDataRecord &pdr _PERSISTENT_APPLY_ARGS) #endif // define the set of tokens - this makes sure that the tokens exist in the map and that we only look them up the once - static uint16 __Tok__MapKey= (uint16)~0u; pdr.addString("__Key__",__Tok__MapKey); - static uint16 __Tok__MapVal= (uint16)~0u; pdr.addString("__Val__",__Tok__MapVal); - #define _PROP(token,name,type,logic,get,set) static uint16 token= (uint16)~0u; pdr.addString(name,token); - #define _STRUCT(token,name,logic,write,read) static uint16 token= (uint16)~0u; pdr.addString(name,token); - #define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token= (uint16)~0u; pdr.addString(name,token); - #define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token= (uint16)~0u; pdr.addString(name,token); - #define _FLAG(token,name,logic,code) static uint16 token= (uint16)~0u; pdr.addString(name,token); + static uint16 __Tok__MapKey = std::numeric_limits::max(); pdr.addString("__Key__",__Tok__MapKey); + static uint16 __Tok__MapVal = std::numeric_limits::max(); pdr.addString("__Val__",__Tok__MapVal); + #define _PROP(token,name,type,logic,get,set) static uint16 token = std::numeric_limits::max(); pdr.addString(name,token); + #define _STRUCT(token,name,logic,write,read) static uint16 token = std::numeric_limits::max(); pdr.addString(name,token); + #define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token = std::numeric_limits::max(); pdr.addString(name,token); + #define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token = std::numeric_limits::max(); pdr.addString(name,token); + #define _FLAG(token,name,logic,code) static uint16 token = std::numeric_limits::max(); pdr.addString(name,token); PERSISTENT_DATA #undef _PROP #undef _STRUCT diff --git a/code/ryzom/common/src/game_share/property_allocator_client.h b/code/ryzom/common/src/game_share/property_allocator_client.h index 1ab7bc73b..8d0b00857 100644 --- a/code/ryzom/common/src/game_share/property_allocator_client.h +++ b/code/ryzom/common/src/game_share/property_allocator_client.h @@ -23,6 +23,8 @@ #include "property_allocator.h" +#include + namespace NLNET { class CMessage; @@ -40,7 +42,7 @@ class CPropertyAllocatorClient : public CPropertyAllocator public: /// Constructor - CPropertyAllocatorClient() : _LocalMSId((uint16)~0) {} + CPropertyAllocatorClient() : _LocalMSId(std::numeric_limits::max()) {} /** Ask to allocate, if not done yet, a segment for the specified property. * The pointer will be soon returned by getPropertySegment(), but not always diff --git a/code/ryzom/server/src/ai_service/ai_world_map.h b/code/ryzom/server/src/ai_service/ai_world_map.h index 33d23bf16..724bd842f 100644 --- a/code/ryzom/server/src/ai_service/ai_world_map.h +++ b/code/ryzom/server/src/ai_service/ai_world_map.h @@ -228,7 +228,7 @@ inline CAIMapSurfaceNeighbour::CAIMapSurfaceNeighbour(bool isNoGo) // constructo nlassert(isNoGo=true); // by definition this code can't be executed with isNoGo false _surface=NULL; - _distance=(uint16)-1; + _distance = std::numeric_limits::max(); //bool _sameRegion=false; memset(_direction,0,sizeof(_direction)); } diff --git a/code/ryzom/server/src/entities_game_service/deposit.h b/code/ryzom/server/src/entities_game_service/deposit.h index 79b9e9e53..fee33662a 100644 --- a/code/ryzom/server/src/entities_game_service/deposit.h +++ b/code/ryzom/server/src/entities_game_service/deposit.h @@ -33,7 +33,7 @@ class CDeposit; -const uint16 MaxNbActiveSources = (uint16)~0; +const uint16 MaxNbActiveSources = std::numeric_limits::max(); /** * A recent forage site prevents from extracting too much material from the same place in a short time. diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_emot.h b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_emot.h index 7e9c93491..ce0c388ad 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_emot.h +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_emot.h @@ -52,7 +52,7 @@ public: std::map::const_iterator it = _AnimIdMap.find(animId); if (it!=_AnimIdMap.end()) return (uint16)it->second; - return (uint16)~0; + return std::numeric_limits::max(); } /// Removed diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_text_emotes.h b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_text_emotes.h index 0819db53f..64b237d73 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_text_emotes.h +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_text_emotes.h @@ -117,7 +117,7 @@ public: std::map::const_iterator it = _EmoteIdMap.find(emoteId); if (it!=_EmoteIdMap.end()) return (uint16)it->second; - return (uint16)~0; + return std::numeric_limits::max(); } MBEHAV::EBehaviour getEmoteBehav(const std::string& emoteId) const; diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_phrase.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_phrase.cpp index 8ef7532ec..84d4d31fb 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_phrase.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_phrase.cpp @@ -61,7 +61,7 @@ CSpecialPowerPhrase::CSpecialPowerPhrase() _IsStatic = false; _AddRecastTime = 0; _PhraseType = BRICK_TYPE::SPECIAL_POWER; - _ConsumableFamilyId = (uint16)~0; + _ConsumableFamilyId = std::numeric_limits::max(); } //----------------------------------------------- diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_shielding.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_shielding.cpp index f02acb3d7..36422f517 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_shielding.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_shielding.cpp @@ -54,7 +54,7 @@ bool CSpecialPowerShielding::validate(std::string &errorCode) } TGameCycle endDate; - if (!actor->canUsePower(_PowerType, (uint16)~0, endDate)) + if (!actor->canUsePower(_PowerType, std::numeric_limits::max(), endDate)) { uint16 seconds = uint16((endDate - CTickEventHandler::getGameCycle())*CTickEventHandler::getGameTimeStep()); uint8 minutes = uint8(seconds/60); diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_taunt.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_taunt.cpp index 6ffef15b7..86547178a 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_taunt.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/special_power_taunt.cpp @@ -66,7 +66,7 @@ bool CSpecialPowerTaunt::validate(std::string &errorCode) } TGameCycle endDate; - if (!actor->canUsePower(_PowerType, (uint16)~0, endDate)) + if (!actor->canUsePower(_PowerType, std::numeric_limits::max(), endDate)) { uint16 seconds = uint16( (endDate - CTickEventHandler::getGameCycle())*CTickEventHandler::getGameTimeStep() ); uint8 minutes = uint8(seconds/60); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp index b5cb58a07..0945983c6 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -2611,7 +2611,7 @@ void CCharacter::serial(NLMISC::IStream &f) throw(NLMISC::EStream) void CCharacter::setPositionToDefaultRespawnPoint() { CContinent * continent = CZoneManager::getInstance().getContinent( getX(), getY() ); - uint16 zoneId = (uint16)~0; + uint16 zoneId = std::numeric_limits::max(); if( continent == 0 ) { nlwarning("::max() ) { // get the tp coords const CTpSpawnZone* zone = CZoneManager::getInstance().getTpSpawnZone( zoneId ); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/powers_and_auras.cpp b/code/ryzom/server/src/entities_game_service/player_manager/powers_and_auras.cpp index 1939f21b3..7c9108bc6 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/powers_and_auras.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/powers_and_auras.cpp @@ -60,7 +60,7 @@ void CPowerActivationDateVector::clearConsumable() { for(sint32 i = (sint32)PowerActivationDates.size()-1; i >= 0; --i ) { - if (PowerActivationDates[i].ConsumableFamilyId != (uint16)~0) + if (PowerActivationDates[i].ConsumableFamilyId != std::numeric_limits::max()) { PowerActivationDates[i] = PowerActivationDates[PowerActivationDates.size()-1]; PowerActivationDates.pop_back(); @@ -117,7 +117,7 @@ bool CPowerActivationDateVector::isPowerAllowed(POWERS::TPowerType type, uint16 } else { - if ( (*it).PowerType == type || ((*it).ConsumableFamilyId != (uint16)~0 && (*it).ConsumableFamilyId == consumableFamilyId)) + if ( (*it).PowerType == type || ((*it).ConsumableFamilyId != std::numeric_limits::max() && (*it).ConsumableFamilyId == consumableFamilyId)) { endDate = (*it).ActivationDate; result = false; @@ -195,7 +195,7 @@ void CAuraActivationDateVector::clear() //----------------------------------------------------------------------------- void CAuraActivationDateVector::disableAura(POWERS::TPowerType type, NLMISC::TGameCycle startDate, NLMISC::TGameCycle endDate, const NLMISC::CEntityId &userId) { - _AuraActivationDates.push_back( CPowerActivationDate(type,(uint16)~0, startDate, endDate) ); + _AuraActivationDates.push_back( CPowerActivationDate(type, std::numeric_limits::max(), startDate, endDate) ); _AuraUsers.push_back(userId); } diff --git a/code/ryzom/server/src/entities_game_service/player_manager/powers_and_auras.h b/code/ryzom/server/src/entities_game_service/player_manager/powers_and_auras.h index 829167fd6..8061d91b1 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/powers_and_auras.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/powers_and_auras.h @@ -37,7 +37,7 @@ struct CPowerActivationDate NLMISC::TGameCycle DeactivationDate; NLMISC::TGameCycle ActivationDate; - CPowerActivationDate() : PowerType(POWERS::UnknownType), ConsumableFamilyId((uint16)~0), DeactivationDate(0), ActivationDate(0) + CPowerActivationDate() : PowerType(POWERS::UnknownType), ConsumableFamilyId(std::numeric_limits::max()), DeactivationDate(0), ActivationDate(0) {} CPowerActivationDate(POWERS::TPowerType type, uint16 consumableFamilyId, NLMISC::TGameCycle dateOff, NLMISC::TGameCycle dateOn) : PowerType(type), ConsumableFamilyId(consumableFamilyId), DeactivationDate(dateOff), ActivationDate(dateOn) From 3b3b1d0d4c1d76243d6f32fa35d9845b4a3a76fa Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Dec 2015 15:03:42 +0100 Subject: [PATCH 11/13] Fixed: Allow to sign OS X bundles with APPLE_CERTIFICATE --HG-- branch : develop --- code/ryzom/client/src/CMakeLists.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 2a5b1c175..29ec33d09 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -74,6 +74,31 @@ IF(APPLE) IF(RYZOM_DATA_DIR) ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -RpX ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR}) ENDIF() + + IF(APPLE_CERTIFICATE) + # Find codesign_allocate + + # Xcode 7.0 and later versions + SET(CODESIGN_ALLOCATE ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate) + + IF(NOT EXISTS "${CODESIGN_ALLOCATE}") + # Xcode 6.4 and previous versions + SET(CODESIGN_ALLOCATE ${CMAKE_OSX_SYSROOT}/usr/bin/codesign_allocate) + ENDIF() + + IF(NOT EXISTS "${CODESIGN_ALLOCATE}") + # System path + SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate) + ENDIF() + + IF(NOT EXISTS "${CODESIGN_ALLOCATE}") + MESSAGE(WARNING "Unable to find codesign_allocate in standard directories") + ELSE() + ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${RYZOM_OUTPUT_DIR}" COMMENT "Signing bundle...") + ENDIF() + ENDIF() + + ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/installscript_osx.vdf ${RYZOM_OUTPUT_DIR}) ENDIF() INCLUDE_DIRECTORIES( From b1701682953fa686043934de1c148fc64dbef510 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Dec 2015 15:05:31 +0100 Subject: [PATCH 12/13] Fixed: Use NELID16 macros --HG-- branch : develop --- code/ryzom/server/src/ai_share/world_map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/ryzom/server/src/ai_share/world_map.cpp b/code/ryzom/server/src/ai_share/world_map.cpp index f468c1144..677e8cb97 100644 --- a/code/ryzom/server/src/ai_share/world_map.cpp +++ b/code/ryzom/server/src/ai_share/world_map.cpp @@ -372,7 +372,7 @@ uint16 CSingleLayerCell::_MaskMap[16]; void CSingleLayerCell::serial(NLMISC::IStream& f) { - f.serialCheck((uint16)'SL'); + f.serialCheck(NELID16("SL")); uint i; for (i=0; i<16; ++i) @@ -403,7 +403,7 @@ void CSingleLayerCell::serial(NLMISC::IStream& f) void CMultiLayerCell::serial(NLMISC::IStream& f) { - f.serialCheck((uint16)'ML'); + f.serialCheck(NELID16("ML")); uint slot; From 4e8ba880469acfa087aa4f3c3110ec532ae534da Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Dec 2015 15:08:54 +0100 Subject: [PATCH 13/13] Fixed: Clang warning --HG-- branch : develop --- code/ryzom/server/src/ai_data_service/pacs_scan.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp index e52b97573..48dd8c189 100644 --- a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp +++ b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp @@ -1346,12 +1346,14 @@ public: CComputeCell *cell = _WorldMap.getComputeCell(scanline); { - uint i; - for (i=0; i<16*16; ++i) + for (uint i = 0; i < 16; ++i) { - toposGridList[0][i].topos[0] = - toposGridList[0][i].topos[1] = - toposGridList[0][i].topos[2] = -1; + for (uint j = 0; j < 16; ++j) + { + toposGridList[i][j].topos[0] = + toposGridList[i][j].topos[1] = + toposGridList[i][j].topos[2] = -1; + } } }