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

View File

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

View File

@ -119,7 +119,7 @@ std::optional<RWArgConfigLayer> RWArgumentParser::parseArguments(int argc, const
}
po::notify(vm);
} catch (po::error& ex) {
std::cerr << "Error parsing arguments: " << ex.what() << std::endl;
std::cerr << "Error parsing arguments: " << ex.what() << '\n';
return std::nullopt;
} catch (boost::exception& ex) {
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 {
vm->execute(dt);
} catch (SCMException& ex) {
std::cerr << ex.what() << std::endl;
std::cerr << ex.what() << '\n';
log.error("Script", ex.what());
throw;
}

View File

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

View File

@ -500,7 +500,7 @@ void DebugState::printCameraDetails() {
std::cout << " " << _debugCam.position.x << " " << _debugCam.position.y
<< " " << _debugCam.position.z << " " << _debugCam.rotation.x
<< " " << _debugCam.rotation.y << " " << _debugCam.rotation.z
<< " " << _debugCam.rotation.w << std::endl;
<< " " << _debugCam.rotation.w << '\n';
}
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(); }},
{t.text(MenuDefaults::kOptionsId),
[] { std::cout << "Options" << std::endl; }},
[] { std::cout << "Options" << '\n'; }},
{t.text(MenuDefaults::kQuitGameId),
[=] { game->getStateManager().clear(); }}},
glm::vec2(200.f, 200.f)};