1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-25 20:02:40 +01:00

Use '\n' instead of std::endl

This commit is contained in:
Filip Gawin 2019-01-18 01:37:23 +01:00
parent dd8de77b8e
commit 44148c528a
10 changed files with 55 additions and 55 deletions

View File

@ -42,9 +42,9 @@ void WinBreak();
#if defined(RW_DEBUG) && defined(RW_VERBOSE_DEBUG_MESSAGES) #if defined(RW_DEBUG) && defined(RW_VERBOSE_DEBUG_MESSAGES)
#include <iostream> #include <iostream>
#define RW_MESSAGE(msg) \ #define RW_MESSAGE(msg) \
std::cout << __FILE__ << ":" << __LINE__ << ": " << msg << std::endl std::cout << __FILE__ << ":" << __LINE__ << ": " << msg << '\n'
#define RW_ERROR(msg) \ #define RW_ERROR(msg) \
std::cerr << __FILE__ << ":" << __LINE__ << ": " << msg << std::endl std::cerr << __FILE__ << ":" << __LINE__ << ": " << msg << '\n'
#else #else
#define RW_MESSAGE(msg) #define RW_MESSAGE(msg)
#define RW_ERROR(msg) #define RW_ERROR(msg)

View File

@ -24,6 +24,6 @@ void checkALerror(const std::string& file, unsigned int line) {
std::cerr << err; std::cerr << err;
} }
std::cerr << std::endl; std::cerr << '\n';
} }
} }

View File

@ -45,5 +45,5 @@ std::map<Logger::MessageSeverity, char> severityStr{{Logger::Error, 'E'},
void StdOutReceiver::messageReceived(const Logger::LogMessage& message) { void StdOutReceiver::messageReceived(const Logger::LogMessage& message) {
std::cout << severityStr[message.severity] << " [" << message.component std::cout << severityStr[message.severity] << " [" << message.component
<< "] " << message.message << std::endl; << "] " << message.message << '\n';
} }

View File

@ -606,11 +606,11 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "Player Health: " << ped.info.health << " (" std::cout << "Player Health: " << ped.info.health << " ("
<< ped.info.armour << ")" << std::endl; << ped.info.armour << ")" << '\n';
std::cout << "Player model: " << ped.modelName << std::endl; std::cout << "Player model: " << ped.modelName << '\n';
for (const auto &wep : players[p].info.weapons) { for (const auto &wep : players[p].info.weapons) {
std::cout << "ID " << wep.weaponId << " " << wep.inClip << " " std::cout << "ID " << wep.weaponId << " " << wep.inClip << " "
<< wep.totalBullets << std::endl; << wep.totalBullets << '\n';
} }
#endif #endif
} }
@ -640,19 +640,19 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
} }
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "Garages: " << garageData.garageCount << std::endl; std::cout << "Garages: " << garageData.garageCount << '\n';
std::cout << "Bombs Free: " << garageData.freeBombs << std::endl; std::cout << "Bombs Free: " << garageData.freeBombs << '\n';
std::cout << "Sprays Free: " << garageData.freeResprays << std::endl; std::cout << "Sprays Free: " << garageData.freeResprays << '\n';
std::cout << "Portland IE: " << garageData.bfImportExportPortland std::cout << "Portland IE: " << garageData.bfImportExportPortland
<< std::endl; << '\n';
std::cout << "Shoreside IE: " << garageData.bfImportExportShoreside std::cout << "Shoreside IE: " << garageData.bfImportExportShoreside
<< std::endl; << '\n';
std::cout << "GA21 last shown: " << garageData.GA_21lastTime << std::endl; std::cout << "GA21 last shown: " << garageData.GA_21lastTime << '\n';
for (const auto &car : garageData.cars) { for (const auto &car : garageData.cars) {
if (car.modelId == 0) continue; if (car.modelId == 0) continue;
std::cout << " " << car.modelId << " " << uint16_t(car.colorFG) << "/" std::cout << " " << car.modelId << " " << uint16_t(car.colorFG) << "/"
<< uint16_t(car.colorBG) << " " << car.immunities << uint16_t(car.colorBG) << " " << car.immunities
<< std::endl; << '\n';
} }
#endif #endif
@ -677,7 +677,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << " v " << veh.modelId << " " << veh.state.position.x << " " std::cout << " v " << veh.modelId << " " << veh.state.position.x << " "
<< veh.state.position.y << " " << veh.state.position.z << veh.state.position.y << " " << veh.state.position.z
<< std::endl; << '\n';
#endif #endif
} }
std::vector<Block3Boat> boats(boatCount); std::vector<Block3Boat> boats(boatCount);
@ -690,7 +690,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << " b " << veh.modelId << " " << veh.state.position.x << " " std::cout << " b " << veh.modelId << " " << veh.state.position.x << " "
<< veh.state.position.y << " " << veh.state.position.z << veh.state.position.y << " " << veh.state.position.z
<< std::endl; << '\n';
#endif #endif
} }
@ -737,7 +737,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
} }
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "Objects " << objectCount << std::endl; std::cout << "Objects " << objectCount << '\n';
for (size_t o = 0; o < objectCount; ++o) { for (size_t o = 0; o < objectCount; ++o) {
auto& obj = objects[o]; auto& obj = objects[o];
glm::vec3 right = glm::normalize( glm::vec3 right = glm::normalize(
@ -754,9 +754,9 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
std::cout << "forward " << forward.x << " " << forward.y << " " std::cout << "forward " << forward.x << " " << forward.y << " "
<< forward.z << " "; << forward.z << " ";
std::cout << "down " << down.x << " " << down.y << " " << down.z std::cout << "down " << down.x << " " << down.y << " " << down.z
<< std::endl; << '\n';
} }
std::cout << std::endl; std::cout << '\n';
#endif #endif
// Block 5 // Block 5
@ -787,13 +787,13 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
} }
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "Cranes: " << craneData.numCranes << std::endl; std::cout << "Cranes: " << craneData.numCranes << '\n';
for (size_t c = 0; c < craneData.numCranes; ++c) { for (size_t c = 0; c < craneData.numCranes; ++c) {
Block6Crane& crane = craneData.cranes[c]; Block6Crane& crane = craneData.cranes[c];
std::cout << "pickup " << crane.x1Pickup << " " << crane.y1Pickup << " " std::cout << "pickup " << crane.x1Pickup << " " << crane.y1Pickup << " "
<< crane.x2Pickup << " " << crane.y2Pickup << std::endl; << crane.x2Pickup << " " << crane.y2Pickup << '\n';
std::cout << "vehicles collected " << uint16_t(crane.vehiclesCollected) std::cout << "vehicles collected " << uint16_t(crane.vehiclesCollected)
<< std::endl; << '\n';
} }
#endif #endif
@ -810,7 +810,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
for (const auto &pickup : pickupData.pickups) { for (const auto &pickup : pickupData.pickups) {
if (pickup.type == 0) continue; if (pickup.type == 0) continue;
std::cout << " " << uint16_t(pickup.type) << " " << pickup.position.x << " " std::cout << " " << uint16_t(pickup.type) << " " << pickup.position.x << " "
<< pickup.position.y << " " << pickup.position.z << std::endl; << pickup.position.y << " " << pickup.position.z << '\n';
} }
#endif #endif
@ -828,11 +828,11 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
} }
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "Payphones: " << payphoneData.numPayphones << std::endl; std::cout << "Payphones: " << payphoneData.numPayphones << '\n';
for (const auto& payphone : payphones) { for (const auto& payphone : payphones) {
std::cout << " " << uint16_t(payphone.state) << " " << payphone.position.x std::cout << " " << uint16_t(payphone.state) << " " << payphone.position.x
<< " " << payphone.position.y << " " << payphone.position.z << " " << payphone.position.y << " " << payphone.position.z
<< std::endl; << '\n';
} }
#endif #endif
@ -849,16 +849,16 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "Hospitals: " << restartData.numHospitals std::cout << "Hospitals: " << restartData.numHospitals
<< " police: " << restartData.numPolice << std::endl; << " police: " << restartData.numPolice << '\n';
for (int s = 0; s < restartData.numHospitals; ++s) { for (int s = 0; s < restartData.numHospitals; ++s) {
Block9Restart& p = restartData.hospitalRestarts[s]; Block9Restart& p = restartData.hospitalRestarts[s];
std::cout << " H " << p.position.x << " " << p.position.y << " " std::cout << " H " << p.position.x << " " << p.position.y << " "
<< p.position.z << std::endl; << p.position.z << '\n';
} }
for (int s = 0; s < restartData.numPolice; ++s) { for (int s = 0; s < restartData.numPolice; ++s) {
Block9Restart& p = restartData.policeRestarts[s]; Block9Restart& p = restartData.policeRestarts[s];
std::cout << " P " << p.position.x << " " << p.position.y << " " std::cout << " P " << p.position.x << " " << p.position.y << " "
<< p.position.z << std::endl; << p.position.z << '\n';
} }
#endif #endif
@ -877,7 +877,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
for (const auto &blip : radarData.blips) { for (const auto &blip : radarData.blips) {
if (blip.type == 0) continue; if (blip.type == 0) continue;
std::cout << " " << blip.position.x << " " << blip.position.y << " " std::cout << " " << blip.position.x << " " << blip.position.y << " "
<< blip.position.z << std::endl; << blip.position.z << '\n';
} }
#endif #endif
@ -937,10 +937,10 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "zones: " << zoneData.numNavZones << " " std::cout << "zones: " << zoneData.numNavZones << " "
<< zoneData.numZoneInfos << " " << zoneData.numMapZones << " " << zoneData.numZoneInfos << " " << zoneData.numMapZones << " "
<< zoneData.numAudioZones << std::endl; << zoneData.numAudioZones << '\n';
for (int z = 0; z < zoneData.numNavZones; ++z) { for (int z = 0; z < zoneData.numNavZones; ++z) {
Block11Zone& zone = zoneData.navZones[z]; Block11Zone& zone = zoneData.navZones[z];
std::cout << " " << zone.name << std::endl; std::cout << " " << zone.name << '\n';
auto& dayinfo = zoneData.dayNightInfo[zone.dayZoneInfo]; auto& dayinfo = zoneData.dayNightInfo[zone.dayZoneInfo];
std::cout << " DAY " << dayinfo.density << " " << dayinfo.peddensity std::cout << " DAY " << dayinfo.density << " " << dayinfo.peddensity
<< " " << dayinfo.copdensity << " " << " " << dayinfo.copdensity << " "
@ -948,11 +948,11 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
for (BlockDword gang : dayinfo.gangpeddensity) { for (BlockDword gang : dayinfo.gangpeddensity) {
std::cout << " " << gang; std::cout << " " << gang;
} }
std::cout << "] " << dayinfo.pedgroup << std::endl; std::cout << "] " << dayinfo.pedgroup << '\n';
for (BlockDword dw : dayinfo.unknown1) { for (BlockDword dw : dayinfo.unknown1) {
std::cout << " " << dw; std::cout << " " << dw;
} }
std::cout << std::endl; std::cout << '\n';
auto& nightinfo = zoneData.dayNightInfo[zone.nightZoneInfo]; auto& nightinfo = zoneData.dayNightInfo[zone.nightZoneInfo];
std::cout << " NIGHT " << nightinfo.density << " " std::cout << " NIGHT " << nightinfo.density << " "
@ -961,15 +961,15 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
for (BlockDword gang : nightinfo.gangpeddensity) { for (BlockDword gang : nightinfo.gangpeddensity) {
std::cout << " " << gang; std::cout << " " << gang;
} }
std::cout << "] " << nightinfo.pedgroup << std::endl; std::cout << "] " << nightinfo.pedgroup << '\n';
for (BlockDword dw : nightinfo.unknown1) { for (BlockDword dw : nightinfo.unknown1) {
std::cout << " " << dw; std::cout << " " << dw;
} }
std::cout << std::endl; std::cout << '\n';
} }
for (int z = 0; z < zoneData.numMapZones; ++z) { for (int z = 0; z < zoneData.numMapZones; ++z) {
Block11Zone& zone = zoneData.mapZones[z]; Block11Zone& zone = zoneData.mapZones[z];
std::cout << " " << zone.name << std::endl; std::cout << " " << zone.name << '\n';
} }
#endif #endif
@ -1007,7 +1007,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
#ifdef RW_DEBUG #ifdef RW_DEBUG
for (const auto &gang : gangData.gangs) { for (const auto &gang : gangData.gangs) {
std::cout << " " << gang.carModelId << " " << gang.weaponPrimary << " " std::cout << " " << gang.carModelId << " " << gang.weaponPrimary << " "
<< gang.weaponSecondary << std::endl; << gang.weaponSecondary << '\n';
} }
#endif #endif
@ -1030,11 +1030,11 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "Car generators: " << carGeneratorData.generatorCount std::cout << "Car generators: " << carGeneratorData.generatorCount
<< std::endl; << '\n';
for (size_t g = 0; g < carGeneratorData.generatorCount; ++g) { for (size_t g = 0; g < carGeneratorData.generatorCount; ++g) {
Block13CarGenerator& gen = carGenerators[g]; Block13CarGenerator& gen = carGenerators[g];
std::cout << " " << gen.modelId << " " << gen.position.x << " " std::cout << " " << gen.modelId << " " << gen.position.x << " "
<< gen.position.y << " " << gen.position.z << std::endl; << gen.position.y << " " << gen.position.z << '\n';
} }
#endif #endif
@ -1052,7 +1052,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
} }
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "particles: " << particleCount << std::endl; std::cout << "particles: " << particleCount << '\n';
#endif #endif
// Block 15 // Block 15
@ -1072,7 +1072,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
} }
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "Audio Objects: " << audioCount << std::endl; std::cout << "Audio Objects: " << audioCount << '\n';
#endif #endif
// Block 16 // Block 16
@ -1096,7 +1096,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "Player money: " << state.playerInfo.money << " (" std::cout << "Player money: " << state.playerInfo.money << " ("
<< state.playerInfo.displayedMoney << ")" << std::endl; << state.playerInfo.displayedMoney << ")" << '\n';
#endif #endif
// Block 17 // Block 17
@ -1158,9 +1158,9 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
READ_VALUE(state.gameStats.lastMissionGXT); READ_VALUE(state.gameStats.lastMissionGXT);
#ifdef RW_DEBUG #ifdef RW_DEBUG
std::cout << "Player kills: " << state.gameStats.playerKills << std::endl; std::cout << "Player kills: " << state.gameStats.playerKills << '\n';
std::cout << "longest flight " << state.gameStats.longestDodoFlight std::cout << "longest flight " << state.gameStats.longestDodoFlight
<< std::endl; << '\n';
#endif #endif
// Block 18 // Block 18
@ -1183,7 +1183,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
std::cout << " "; std::cout << " ";
} }
} }
std::cout << std::endl; std::cout << '\n';
} }
#endif #endif
@ -1241,7 +1241,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
if (playerCount > 0) { if (playerCount > 0) {
auto& ply = players[0]; auto& ply = players[0];
std::cout << ply.reference << std::endl; std::cout << ply.reference << '\n';
auto player = state.world->createPlayer(players[0].info.position); auto player = state.world->createPlayer(players[0].info.position);
CharacterState& cs = player->getCurrentState(); CharacterState& cs = player->getCurrentState();
cs.health = players[0].info.health; cs.health = players[0].info.health;
@ -1354,7 +1354,7 @@ std::vector<SaveGameInfo> SaveGame::getAllSaveGameInfo() {
auto homedir = getenv("HOME"); auto homedir = getenv("HOME");
#endif #endif
if (homedir == nullptr) { if (homedir == nullptr) {
std::cerr << "Unable to determine home directory" << std::endl; std::cerr << "Unable to determine home directory" << '\n';
return {}; return {};
} }
const char gameDir[] = "GTA3 User Files"; const char gameDir[] = "GTA3 User Files";

View File

@ -88,12 +88,12 @@ void DebugDraw::flush(GameRenderer &renderer) {
} }
void DebugDraw::reportErrorWarning(const char *warningString) { void DebugDraw::reportErrorWarning(const char *warningString) {
std::cerr << warningString << std::endl; std::cerr << warningString << '\n';
} }
void DebugDraw::draw3dText(const btVector3 &location, const char *textString) { void DebugDraw::draw3dText(const btVector3 &location, const char *textString) {
RW_UNUSED(location); RW_UNUSED(location);
std::cout << textString << std::endl; std::cout << textString << '\n';
} }
void DebugDraw::setDebugMode(int debugMode) { void DebugDraw::setDebugMode(int debugMode) {

View File

@ -119,7 +119,7 @@ std::optional<RWArgConfigLayer> RWArgumentParser::parseArguments(int argc, const
} }
po::notify(vm); po::notify(vm);
} catch (po::error& ex) { } catch (po::error& ex) {
std::cerr << "Error parsing arguments: " << ex.what() << std::endl; std::cerr << "Error parsing arguments: " << ex.what() << '\n';
return std::nullopt; return std::nullopt;
} catch (boost::exception& ex) { } catch (boost::exception& ex) {
std::cerr << "A boost::exception object was thrown (bug in Boost.Program_options?).\n"; std::cerr << "A boost::exception object was thrown (bug in Boost.Program_options?).\n";

View File

@ -579,7 +579,7 @@ void RWGame::tick(float dt) {
try { try {
vm->execute(dt); vm->execute(dt);
} catch (SCMException& ex) { } catch (SCMException& ex) {
std::cerr << ex.what() << std::endl; std::cerr << ex.what() << '\n';
log.error("Script", ex.what()); log.error("Script", ex.what());
throw; throw;
} }

View File

@ -56,7 +56,7 @@ void BenchmarkState::enter() {
track.push_back(point); track.push_back(point);
} }
std::cout << "Loaded " << track.size() << " points" << std::endl; std::cout << "Loaded " << track.size() << " points" << '\n';
} }
void BenchmarkState::exit() { void BenchmarkState::exit() {
@ -66,7 +66,7 @@ void BenchmarkState::exit() {
<< "Duration: " << duration << " seconds\n" << "Duration: " << duration << " seconds\n"
<< "Avg frametime: " << std::setprecision(3) << "Avg frametime: " << std::setprecision(3)
<< (duration / frameCounter) << " (" << (frameCounter / duration) << (duration / frameCounter) << " (" << (frameCounter / duration)
<< " fps)" << std::endl; << " fps)" << '\n';
} }
void BenchmarkState::tick(float dt) { void BenchmarkState::tick(float dt) {

View File

@ -500,7 +500,7 @@ void DebugState::printCameraDetails() {
std::cout << " " << _debugCam.position.x << " " << _debugCam.position.y std::cout << " " << _debugCam.position.x << " " << _debugCam.position.y
<< " " << _debugCam.position.z << " " << _debugCam.rotation.x << " " << _debugCam.position.z << " " << _debugCam.rotation.x
<< " " << _debugCam.rotation.y << " " << _debugCam.rotation.z << " " << _debugCam.rotation.y << " " << _debugCam.rotation.z
<< " " << _debugCam.rotation.w << std::endl; << " " << _debugCam.rotation.w << '\n';
} }
void DebugState::spawnVehicle(unsigned int id) { void DebugState::spawnVehicle(unsigned int id) {

View File

@ -11,7 +11,7 @@ PauseState::PauseState(RWGame* game) : State(game) {
Menu menu{{{t.text(MenuDefaults::kResumeGameId), [&] { done(); }}, Menu menu{{{t.text(MenuDefaults::kResumeGameId), [&] { done(); }},
{t.text(MenuDefaults::kOptionsId), {t.text(MenuDefaults::kOptionsId),
[] { std::cout << "Options" << std::endl; }}, [] { std::cout << "Options" << '\n'; }},
{t.text(MenuDefaults::kQuitGameId), {t.text(MenuDefaults::kQuitGameId),
[=] { game->getStateManager().clear(); }}}, [=] { game->getStateManager().clear(); }}},
glm::vec2(200.f, 200.f)}; glm::vec2(200.f, 200.f)};