Skip to content

Commit 3b74cc4

Browse files
numberZerosfan5
authored andcommitted
Replace PP with direct printing
1 parent de77fe8 commit 3b74cc4

18 files changed

Lines changed: 110 additions & 109 deletions

src/database/database-leveldb.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2727
#include "filesys.h"
2828
#include "exceptions.h"
2929
#include "remoteplayer.h"
30+
#include "irrlicht_changes/printing.h"
3031
#include "server/player_sao.h"
3132
#include "util/serialize.h"
3233
#include "util/string.h"
@@ -58,7 +59,7 @@ bool Database_LevelDB::saveBlock(const v3s16 &pos, const std::string &data)
5859
i64tos(getBlockAsInteger(pos)), data);
5960
if (!status.ok()) {
6061
warningstream << "saveBlock: LevelDB error saving block "
61-
<< PP(pos) << ": " << status.ToString() << std::endl;
62+
<< pos << ": " << status.ToString() << std::endl;
6263
return false;
6364
}
6465

@@ -80,7 +81,7 @@ bool Database_LevelDB::deleteBlock(const v3s16 &pos)
8081
i64tos(getBlockAsInteger(pos)));
8182
if (!status.ok()) {
8283
warningstream << "deleteBlock: LevelDB error deleting block "
83-
<< PP(pos) << ": " << status.ToString() << std::endl;
84+
<< pos << ": " << status.ToString() << std::endl;
8485
return false;
8586
}
8687

src/database/database-redis.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2626
#include "settings.h"
2727
#include "log.h"
2828
#include "exceptions.h"
29+
#include "irrlicht_changes/printing.h"
2930
#include "util/string.h"
3031

3132
#include <hiredis.h>
@@ -98,13 +99,13 @@ bool Database_Redis::saveBlock(const v3s16 &pos, const std::string &data)
9899
hash.c_str(), tmp.c_str(), data.c_str(), data.size()));
99100
if (!reply) {
100101
warningstream << "saveBlock: redis command 'HSET' failed on "
101-
"block " << PP(pos) << ": " << ctx->errstr << std::endl;
102+
"block " << pos << ": " << ctx->errstr << std::endl;
102103
freeReplyObject(reply);
103104
return false;
104105
}
105106

106107
if (reply->type == REDIS_REPLY_ERROR) {
107-
warningstream << "saveBlock: saving block " << PP(pos)
108+
warningstream << "saveBlock: saving block " << pos
108109
<< " failed: " << std::string(reply->str, reply->len) << std::endl;
109110
freeReplyObject(reply);
110111
return false;
@@ -134,7 +135,7 @@ void Database_Redis::loadBlock(const v3s16 &pos, std::string *block)
134135
case REDIS_REPLY_ERROR: {
135136
std::string errstr(reply->str, reply->len);
136137
freeReplyObject(reply);
137-
errorstream << "loadBlock: loading block " << PP(pos)
138+
errorstream << "loadBlock: loading block " << pos
138139
<< " failed: " << errstr << std::endl;
139140
throw DatabaseException(std::string(
140141
"Redis command 'HGET %s %s' errored: ") + errstr);
@@ -146,7 +147,7 @@ void Database_Redis::loadBlock(const v3s16 &pos, std::string *block)
146147
}
147148
}
148149

149-
errorstream << "loadBlock: loading block " << PP(pos)
150+
errorstream << "loadBlock: loading block " << pos
150151
<< " returned invalid reply type " << reply->type
151152
<< ": " << std::string(reply->str, reply->len) << std::endl;
152153
freeReplyObject(reply);
@@ -164,7 +165,7 @@ bool Database_Redis::deleteBlock(const v3s16 &pos)
164165
throw DatabaseException(std::string(
165166
"Redis command 'HDEL %s %s' failed: ") + ctx->errstr);
166167
} else if (reply->type == REDIS_REPLY_ERROR) {
167-
warningstream << "deleteBlock: deleting block " << PP(pos)
168+
warningstream << "deleteBlock: deleting block " << pos
168169
<< " failed: " << std::string(reply->str, reply->len) << std::endl;
169170
freeReplyObject(reply);
170171
return false;

src/database/database-sqlite3.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ SQLite format specification:
3434
#include "porting.h"
3535
#include "util/string.h"
3636
#include "remoteplayer.h"
37+
#include "irrlicht_changes/printing.h"
3738
#include "server/player_sao.h"
3839

3940
#include <cassert>
@@ -252,7 +253,7 @@ bool MapDatabaseSQLite3::deleteBlock(const v3s16 &pos)
252253

253254
if (!good) {
254255
warningstream << "deleteBlock: Block failed to delete "
255-
<< PP(pos) << ": " << sqlite3_errmsg(m_database) << std::endl;
256+
<< pos << ": " << sqlite3_errmsg(m_database) << std::endl;
256257
}
257258
return good;
258259
}

src/emerge.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
3131
#include "config.h"
3232
#include "constants.h"
3333
#include "environment.h"
34+
#include "irrlicht_changes/printing.h"
3435
#include "log.h"
3536
#include "map.h"
3637
#include "mapblock.h"
@@ -631,7 +632,7 @@ MapBlock *EmergeThread::finishGen(v3s16 pos, BlockMakeData *bmdata,
631632
MapBlock *block = m_map->getBlockNoCreateNoEx(pos);
632633
if (!block) {
633634
errorstream << "EmergeThread::finishGen: Couldn't grab block we "
634-
"just generated: " << PP(pos) << std::endl;
635+
"just generated: " << pos << std::endl;
635636
return NULL;
636637
}
637638

@@ -701,7 +702,7 @@ void *EmergeThread::run()
701702
continue;
702703

703704
bool allow_gen = bedata.flags & BLOCK_EMERGE_ALLOW_GEN;
704-
EMERGE_DBG_OUT("pos=" PP(pos) " allow_gen=" << allow_gen);
705+
EMERGE_DBG_OUT("pos=" << pos << " allow_gen=" << allow_gen);
705706

706707
action = getBlockOrStartGen(pos, allow_gen, &block, &bmdata);
707708
if (action == EMERGE_GENERATED) {
@@ -733,7 +734,7 @@ void *EmergeThread::run()
733734
}
734735
} catch (VersionMismatchException &e) {
735736
std::ostringstream err;
736-
err << "World data version mismatch in MapBlock " << PP(pos) << std::endl
737+
err << "World data version mismatch in MapBlock " << pos << std::endl
737738
<< "----" << std::endl
738739
<< "\"" << e.what() << "\"" << std::endl
739740
<< "See debug.txt." << std::endl
@@ -742,7 +743,7 @@ void *EmergeThread::run()
742743
m_server->setAsyncFatalError(err.str());
743744
} catch (SerializationError &e) {
744745
std::ostringstream err;
745-
err << "Invalid data in MapBlock " << PP(pos) << std::endl
746+
err << "Invalid data in MapBlock " << pos << std::endl
746747
<< "----" << std::endl
747748
<< "\"" << e.what() << "\"" << std::endl
748749
<< "See debug.txt." << std::endl

src/main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2020
#include "irrlichttypes.h" // must be included before anything irrlicht, see comment in the file
2121
#include "irrlicht.h" // createDevice
2222
#include "irrlichttypes_extrabloated.h"
23+
#include "irrlicht_changes/printing.h"
2324
#include "benchmark/benchmark.h"
2425
#include "chat_interface.h"
2526
#include "debug.h"
@@ -1204,7 +1205,7 @@ static bool migrate_map_database(const GameParams &game_params, const Settings &
12041205
if (!data.empty()) {
12051206
new_db->saveBlock(*it, data);
12061207
} else {
1207-
errorstream << "Failed to load block " << PP(*it) << ", skipping it." << std::endl;
1208+
errorstream << "Failed to load block " << *it << ", skipping it." << std::endl;
12081209
}
12091210
if (++count % 0xFF == 0 && time(NULL) - last_update_time >= 1) {
12101211
std::cerr << " Migrated " << count << " blocks, "
@@ -1259,7 +1260,7 @@ static bool recompress_map_database(const GameParams &game_params, const Setting
12591260
std::string data;
12601261
db->loadBlock(*it, &data);
12611262
if (data.empty()) {
1262-
errorstream << "Failed to load block " << PP(*it) << std::endl;
1263+
errorstream << "Failed to load block " << *it << std::endl;
12631264
return false;
12641265
}
12651266

src/map.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
3232
#include "nodedef.h"
3333
#include "gamedef.h"
3434
#include "util/directiontables.h"
35-
#include "util/basic_macros.h"
3635
#include "rollback_interface.h"
3736
#include "environment.h"
3837
#include "reflowscan.h"
@@ -45,6 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
4544
#include "database/database-dummy.h"
4645
#include "database/database-sqlite3.h"
4746
#include "script/scripting_server.h"
47+
#include "irrlicht_changes/printing.h"
4848
#include <deque>
4949
#include <queue>
5050
#if USE_LEVELDB
@@ -174,7 +174,7 @@ static void set_node_in_block(MapBlock *block, v3s16 relpos, MapNode n)
174174
errorstream<<"Not allowing to place CONTENT_IGNORE"
175175
<<" while trying to replace \""
176176
<<nodedef->get(block->getNodeNoCheck(relpos)).name
177-
<<"\" at "<<PP(p)<<" (block "<<PP(blockpos)<<")"<<std::endl;
177+
<<"\" at "<<p<<" (block "<<blockpos<<")"<<std::endl;
178178
return;
179179
}
180180
block->setNodeNoCheck(relpos, n);
@@ -917,7 +917,7 @@ std::vector<v3s16> Map::findNodesWithMetadata(v3s16 p1, v3s16 p2)
917917
MapBlock *block = getBlockNoCreateNoEx(blockpos);
918918
if (!block) {
919919
verbosestream << "Map::getNodeMetadata(): Need to emerge "
920-
<< PP(blockpos) << std::endl;
920+
<< blockpos << std::endl;
921921
block = emergeBlock(blockpos, false);
922922
}
923923
if (!block) {
@@ -947,7 +947,7 @@ NodeMetadata *Map::getNodeMetadata(v3s16 p)
947947
MapBlock *block = getBlockNoCreateNoEx(blockpos);
948948
if(!block){
949949
infostream<<"Map::getNodeMetadata(): Need to emerge "
950-
<<PP(blockpos)<<std::endl;
950+
<<blockpos<<std::endl;
951951
block = emergeBlock(blockpos, false);
952952
}
953953
if(!block){
@@ -966,7 +966,7 @@ bool Map::setNodeMetadata(v3s16 p, NodeMetadata *meta)
966966
MapBlock *block = getBlockNoCreateNoEx(blockpos);
967967
if(!block){
968968
infostream<<"Map::setNodeMetadata(): Need to emerge "
969-
<<PP(blockpos)<<std::endl;
969+
<<blockpos<<std::endl;
970970
block = emergeBlock(blockpos, false);
971971
}
972972
if(!block){
@@ -999,7 +999,7 @@ NodeTimer Map::getNodeTimer(v3s16 p)
999999
MapBlock *block = getBlockNoCreateNoEx(blockpos);
10001000
if(!block){
10011001
infostream<<"Map::getNodeTimer(): Need to emerge "
1002-
<<PP(blockpos)<<std::endl;
1002+
<<blockpos<<std::endl;
10031003
block = emergeBlock(blockpos, false);
10041004
}
10051005
if(!block){
@@ -1020,7 +1020,7 @@ void Map::setNodeTimer(const NodeTimer &t)
10201020
MapBlock *block = getBlockNoCreateNoEx(blockpos);
10211021
if(!block){
10221022
infostream<<"Map::setNodeTimer(): Need to emerge "
1023-
<<PP(blockpos)<<std::endl;
1023+
<<blockpos<<std::endl;
10241024
block = emergeBlock(blockpos, false);
10251025
}
10261026
if(!block){
@@ -1348,7 +1348,7 @@ bool ServerMap::initBlockMake(v3s16 blockpos, BlockMakeData *data)
13481348
return false;
13491349

13501350
bool enable_mapgen_debug_info = m_emerge->enable_mapgen_debug_info;
1351-
EMERGE_DBG_OUT("initBlockMake(): " PP(bpmin) " - " PP(bpmax));
1351+
EMERGE_DBG_OUT("initBlockMake(): " << bpmin << " - " << bpmax);
13521352

13531353
v3s16 extra_borders(1, 1, 1);
13541354
v3s16 full_bpmin = bpmin - extra_borders;
@@ -1410,7 +1410,7 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
14101410
v3s16 bpmax = data->blockpos_max;
14111411

14121412
bool enable_mapgen_debug_info = m_emerge->enable_mapgen_debug_info;
1413-
EMERGE_DBG_OUT("finishBlockMake(): " PP(bpmin) " - " PP(bpmax));
1413+
EMERGE_DBG_OUT("finishBlockMake(): " << bpmin << " - " << bpmax);
14141414

14151415
/*
14161416
Blit generated stuff to map

src/mapblock.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2525
#include "nodedef.h"
2626
#include "nodemetadata.h"
2727
#include "gamedef.h"
28+
#include "irrlicht_changes/printing.h"
2829
#include "log.h"
2930
#include "nameidmapping.h"
3031
#include "content_mapnode.h" // For legacy name-id mapping
@@ -91,13 +92,13 @@ bool MapBlock::onObjectsActivation()
9192
return false;
9293

9394
verbosestream << "MapBlock::onObjectsActivation(): "
94-
<< "activating objects of block " << PP(getPos()) << " ("
95+
<< "activating objects of block " << getPos() << " ("
9596
<< m_static_objects.getStoredSize() << " objects)" << std::endl;
9697

9798
if (m_static_objects.getStoredSize() > g_settings->getU16("max_objects_per_block")) {
9899
errorstream << "suspiciously large amount of objects detected: "
99100
<< m_static_objects.getStoredSize() << " in "
100-
<< PP(getPos()) << "; removing all of them." << std::endl;
101+
<< getPos() << "; removing all of them." << std::endl;
101102
// Clear stored list
102103
m_static_objects.clearStored();
103104
raiseModified(MOD_STATE_WRITE_NEEDED, MOD_REASON_TOO_MANY_OBJECTS);
@@ -111,7 +112,7 @@ bool MapBlock::saveStaticObject(u16 id, const StaticObject &obj, u32 reason)
111112
{
112113
if (m_static_objects.getStoredSize() >= g_settings->getU16("max_objects_per_block")) {
113114
warningstream << "MapBlock::saveStaticObject(): Trying to store id = " << id
114-
<< " statically but block " << PP(getPos()) << " already contains "
115+
<< " statically but block " << getPos() << " already contains "
115116
<< m_static_objects.getStoredSize() << " objects."
116117
<< std::endl;
117118
return false;
@@ -487,7 +488,7 @@ void MapBlock::deSerialize(std::istream &in_compressed, u8 version, bool disk)
487488
if(!ser_ver_supported(version))
488489
throw VersionMismatchException("ERROR: MapBlock format not supported");
489490

490-
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())<<std::endl);
491+
TRACESTREAM(<<"MapBlock::deSerialize "<<getPos()<<std::endl);
491492

492493
m_day_night_differs_expired = false;
493494

@@ -515,18 +516,18 @@ void MapBlock::deSerialize(std::istream &in_compressed, u8 version, bool disk)
515516
NameIdMapping nimap;
516517
if (disk && version >= 29) {
517518
// Timestamp
518-
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
519+
TRACESTREAM(<<"MapBlock::deSerialize "<<getPos()
519520
<<": Timestamp"<<std::endl);
520521
setTimestampNoChangedFlag(readU32(is));
521522
m_disk_timestamp = m_timestamp;
522523

523524
// Node/id mapping
524-
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
525+
TRACESTREAM(<<"MapBlock::deSerialize "<<getPos()
525526
<<": NameIdMapping"<<std::endl);
526527
nimap.deSerialize(is);
527528
}
528529

529-
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
530+
TRACESTREAM(<<"MapBlock::deSerialize "<<getPos()
530531
<<": Bulk node data"<<std::endl);
531532
u8 content_width = readU8(is);
532533
u8 params_width = readU8(is);
@@ -551,7 +552,7 @@ void MapBlock::deSerialize(std::istream &in_compressed, u8 version, bool disk)
551552
/*
552553
NodeMetadata
553554
*/
554-
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
555+
TRACESTREAM(<<"MapBlock::deSerialize "<<getPos()
555556
<<": Node metadata"<<std::endl);
556557
if (version >= 29) {
557558
m_node_metadata.deSerialize(is, m_gamedef->idef());
@@ -570,7 +571,7 @@ void MapBlock::deSerialize(std::istream &in_compressed, u8 version, bool disk)
570571
} catch(SerializationError &e) {
571572
warningstream<<"MapBlock::deSerialize(): Ignoring an error"
572573
<<" while deserializing node metadata at ("
573-
<<PP(getPos())<<": "<<e.what()<<std::endl;
574+
<<getPos()<<": "<<e.what()<<std::endl;
574575
}
575576
}
576577

@@ -584,25 +585,25 @@ void MapBlock::deSerialize(std::istream &in_compressed, u8 version, bool disk)
584585
readU8(is);
585586
}
586587
if (version == 24) {
587-
TRACESTREAM(<< "MapBlock::deSerialize " << PP(getPos())
588+
TRACESTREAM(<< "MapBlock::deSerialize " << getPos()
588589
<< ": Node timers (ver==24)" << std::endl);
589590
m_node_timers.deSerialize(is, version);
590591
}
591592

592593
// Static objects
593-
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
594+
TRACESTREAM(<<"MapBlock::deSerialize "<<getPos()
594595
<<": Static objects"<<std::endl);
595596
m_static_objects.deSerialize(is);
596597

597598
if (version < 29) {
598599
// Timestamp
599-
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
600+
TRACESTREAM(<<"MapBlock::deSerialize "<<getPos()
600601
<<": Timestamp"<<std::endl);
601602
setTimestampNoChangedFlag(readU32(is));
602603
m_disk_timestamp = m_timestamp;
603604

604605
// Node/id mapping
605-
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
606+
TRACESTREAM(<<"MapBlock::deSerialize "<<getPos()
606607
<<": NameIdMapping"<<std::endl);
607608
nimap.deSerialize(is);
608609
}
@@ -611,13 +612,13 @@ void MapBlock::deSerialize(std::istream &in_compressed, u8 version, bool disk)
611612
correctBlockNodeIds(&nimap, data, m_gamedef);
612613

613614
if(version >= 25){
614-
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
615+
TRACESTREAM(<<"MapBlock::deSerialize "<<getPos()
615616
<<": Node timers (ver>=25)"<<std::endl);
616617
m_node_timers.deSerialize(is, version);
617618
}
618619
}
619620

620-
TRACESTREAM(<<"MapBlock::deSerialize "<<PP(getPos())
621+
TRACESTREAM(<<"MapBlock::deSerialize "<<getPos()
621622
<<": Done."<<std::endl);
622623
}
623624

0 commit comments

Comments
 (0)