@@ -492,19 +492,17 @@ static void correctBlockNodeIds(const NameIdMapping *nimap, MapNode *nodes,
492
492
// the information to convert those to names.
493
493
// nodedef contains information to convert our names to globally
494
494
// correct ids.
495
- std::set <content_t > unnamed_contents;
496
- std::set <std::string> unallocatable_contents;
495
+ std::unordered_set <content_t > unnamed_contents;
496
+ std::unordered_set <std::string> unallocatable_contents;
497
497
for (u32 i = 0 ; i < MapBlock::nodecount; i++) {
498
498
content_t local_id = nodes[i].getContent ();
499
499
std::string name;
500
- bool found = nimap->getName (local_id, name);
501
- if (!found){
500
+ if (!nimap->getName (local_id, name)) {
502
501
unnamed_contents.insert (local_id);
503
502
continue ;
504
503
}
505
504
content_t global_id;
506
- found = nodedef->getId (name, global_id);
507
- if (!found){
505
+ if (!nodedef->getId (name, global_id)) {
508
506
global_id = gamedef->allocateUnknownNodeId (name);
509
507
if (global_id == CONTENT_IGNORE){
510
508
unallocatable_contents.insert (name);
@@ -513,19 +511,16 @@ static void correctBlockNodeIds(const NameIdMapping *nimap, MapNode *nodes,
513
511
}
514
512
nodes[i].setContent (global_id);
515
513
}
516
- for (std::set<content_t >::const_iterator
517
- i = unnamed_contents.begin ();
518
- i != unnamed_contents.end (); ++i){
519
- errorstream<<" correctBlockNodeIds(): IGNORING ERROR: "
520
- <<" Block contains id " <<(*i)
521
- <<" with no name mapping" <<std::endl;
514
+
515
+ for (const content_t c: unnamed_contents) {
516
+ errorstream << " correctBlockNodeIds(): IGNORING ERROR: "
517
+ << " Block contains id " << c
518
+ << " with no name mapping" << std::endl;
522
519
}
523
- for (std::set<std::string>::const_iterator
524
- i = unallocatable_contents.begin ();
525
- i != unallocatable_contents.end (); ++i){
526
- errorstream<<" correctBlockNodeIds(): IGNORING ERROR: "
527
- <<" Could not allocate global id for node name \" "
528
- <<(*i)<<" \" " <<std::endl;
520
+ for (const std::string &node_name: unallocatable_contents) {
521
+ errorstream << " correctBlockNodeIds(): IGNORING ERROR: "
522
+ << " Could not allocate global id for node name \" "
523
+ << node_name << " \" " << std::endl;
529
524
}
530
525
}
531
526
0 commit comments