widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #15234
[Merge] lp:~widelands-dev/widelands/bug-1800337-unlocalize-log into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1800337-unlocalize-log into lp:widelands.
Commit message:
Use internal names rather than descnames for log messages and workarea IDs.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1800337 in widelands: "logoutput should not be localized"
https://bugs.launchpad.net/widelands/+bug/1800337
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1800337-unlocalize-log/+merge/358424
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1800337-unlocalize-log into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/militarysite.cc'
--- src/logic/map_objects/tribes/militarysite.cc 2018-04-07 16:59:00 +0000
+++ src/logic/map_objects/tribes/militarysite.cc 2018-11-07 10:28:51 +0000
@@ -307,7 +307,7 @@
heal_per_second_ = table.get_int("heal_per_second");
if (conquer_radius_ > 0)
- workarea_info_[conquer_radius_].insert(descname() + " conquer");
+ workarea_info_[conquer_radius_].insert(name() + " conquer");
prefers_heroes_at_start_ = table.get_bool("prefer_heroes");
std::unique_ptr<LuaTable> items_table = table.get_table("messages");
=== modified file 'src/logic/map_objects/tribes/production_program.cc'
--- src/logic/map_objects/tribes/production_program.cc 2018-10-12 10:29:33 +0000
+++ src/logic/map_objects/tribes/production_program.cc 2018-11-07 10:28:51 +0000
@@ -575,7 +575,7 @@
if (it == programs.end())
throw GameDataError("the program \"%s\" has not (yet) been declared in %s "
"(wrong declaration order?)",
- program_name, descr.descname().c_str());
+ program_name, descr.name().c_str());
program_ = it->second.get();
}
@@ -663,13 +663,13 @@
for (const auto& area_info : worker_workarea_info) {
std::set<std::string>& building_radius_infos = descr->workarea_info_[area_info.first];
- for (const std::string& worker_descname : area_info.second) {
- std::string description = descr->descname();
+ for (const std::string& worker_name : area_info.second) {
+ std::string description = descr->name();
description += ' ';
description += production_program_name;
description += " worker ";
description += main_worker_descr.name();
- description += worker_descname;
+ description += worker_name;
building_radius_infos.insert(description);
}
}
@@ -1124,8 +1124,8 @@
throw GameDataError("expected %s but found \"%s\"", "percentage", parameters);
}
std::string description =
- (boost::format("%1$s %2$s mine %3$s") % descr->descname() % production_program_name %
- world.get_resource(resource_)->descname())
+ (boost::format("%1$s %2$s mine %3$s") % descr->name() % production_program_name %
+ world.get_resource(resource_)->name())
.str();
descr->workarea_info_[distance_].insert(description);
=== modified file 'src/logic/map_objects/tribes/productionsite.cc'
--- src/logic/map_objects/tribes/productionsite.cc 2018-09-10 05:59:47 +0000
+++ src/logic/map_objects/tribes/productionsite.cc 2018-11-07 10:28:51 +0000
@@ -559,7 +559,7 @@
* Intercept remove_worker() calls to unassign our worker, if necessary.
*/
void ProductionSite::remove_worker(Worker& w) {
- molog("%s leaving\n", w.descr().descname().c_str());
+ molog("%s leaving\n", w.descr().name().c_str());
WorkingPosition* wp = working_positions_;
for (const auto& temp_wp : descr().working_positions()) {
@@ -657,7 +657,7 @@
if (current == nuwo)
throw wexception(
"Something went wrong! No fitting place for worker %s in %s at (%u, %u) found!",
- w->descr().descname().c_str(), psite.descr().descname().c_str(),
+ w->descr().name().c_str(), psite.descr().name().c_str(),
psite.get_position().x, psite.get_position().y);
}
}
=== modified file 'src/logic/map_objects/tribes/tribe_descr.cc'
--- src/logic/map_objects/tribes/tribe_descr.cc 2018-09-15 07:47:59 +0000
+++ src/logic/map_objects/tribes/tribe_descr.cc 2018-11-07 10:28:51 +0000
@@ -393,7 +393,7 @@
if (!res || !amount) {
auto list = resource_indicators_.find("");
if (list == resource_indicators_.end() || list->second.empty()) {
- throw GameDataError("Tribe '%s' has no indicator for no resources!", descname_.c_str());
+ throw GameDataError("Tribe '%s' has no indicator for no resources!", name_.c_str());
}
return list->second.begin()->second;
}
@@ -401,7 +401,7 @@
auto list = resource_indicators_.find(res->name());
if (list == resource_indicators_.end() || list->second.empty()) {
throw GameDataError(
- "Tribe '%s' has no indicators for resource '%s'!", descname_.c_str(), res->name().c_str());
+ "Tribe '%s' has no indicators for resource '%s'!", name_.c_str(), res->name().c_str());
}
uint32_t lowest = 0;
@@ -416,7 +416,7 @@
if (lowest < amount) {
throw GameDataError("Tribe '%s' has no indicators for amount %i of resource '%s' (highest "
"possible amount is %i)!",
- descname_.c_str(), amount, res->name().c_str(), lowest);
+ name_.c_str(), amount, res->name().c_str(), lowest);
}
return list->second.find(lowest)->second;
=== modified file 'src/logic/map_objects/tribes/warehouse.cc'
--- src/logic/map_objects/tribes/warehouse.cc 2018-09-04 15:48:47 +0000
+++ src/logic/map_objects/tribes/warehouse.cc 2018-11-07 10:28:51 +0000
@@ -299,7 +299,7 @@
heal_per_second_ = table.get_int("heal_per_second");
if (table.has_key("conquers")) {
conquers_ = table.get_int("conquers");
- workarea_info_[conquers_].insert(descname() + " conquer");
+ workarea_info_[conquers_].insert(name() + " conquer");
}
}
@@ -1072,7 +1072,7 @@
} else
throw wexception("worker type %s needs \"%s\" to be built but that is neither "
"a ware type nor a worker type defined in the tribe %s",
- w_desc.descname().c_str(), input_name.c_str(),
+ w_desc.name().c_str(), input_name.c_str(),
owner().tribe().name().c_str());
}
}
=== modified file 'src/logic/map_objects/tribes/worker.cc'
--- src/logic/map_objects/tribes/worker.cc 2018-09-25 06:32:35 +0000
+++ src/logic/map_objects/tribes/worker.cc 2018-11-07 10:28:51 +0000
@@ -2101,7 +2101,7 @@
/// Give the recruit his diploma and say farwell to him.
void Worker::start_task_releaserecruit(Game& game, Worker& recruit) {
push_task(game, taskReleaserecruit);
- molog("Starting to release %s %u...\n", recruit.descr().descname().c_str(), recruit.serial());
+ molog("Starting to release %s %u...\n", recruit.descr().name().c_str(), recruit.serial());
return schedule_act(game, 5000);
}
=== modified file 'src/map_io/map_buildingdata_packet.cc'
--- src/map_io/map_buildingdata_packet.cc 2018-07-08 15:16:16 +0000
+++ src/map_io/map_buildingdata_packet.cc 2018-11-07 10:28:51 +0000
@@ -152,7 +152,7 @@
if (building.old_buildings_.empty() && !is_a(ConstructionSite, &building)) {
throw GameDataError("Failed to read %s %u: No former buildings information.\n"
"Your savegame is corrupted",
- building.descr().descname().c_str(), building.serial());
+ building.descr().name().c_str(), building.serial());
}
if (fr.unsigned_8()) {
@@ -161,7 +161,7 @@
log("WARNING: Found a stopped %s at (%i, %i) in the "
"savegame. Militarysites are not stoppable. "
"Ignoring.",
- building.descr().descname().c_str(), building.get_position().x,
+ building.descr().name().c_str(), building.get_position().x,
building.get_position().y);
} else {
productionsite->set_stopped(true);
@@ -170,7 +170,7 @@
log("WARNING: Found a stopped %s at (%i, %i) in the "
"savegame. Only productionsites are stoppable. "
"Ignoring.",
- building.descr().descname().c_str(), building.get_position().x,
+ building.descr().name().c_str(), building.get_position().x,
building.get_position().y);
}
@@ -372,7 +372,7 @@
if (!game.tribes().worker_exists(worker_index)) {
log("WARNING: %s %u has a next_spawn time for nonexistent "
"worker type \"%s\" set to %u, ignoring\n",
- warehouse.descr().descname().c_str(), warehouse.serial(), worker_typename,
+ warehouse.descr().name().c_str(), warehouse.serial(), worker_typename,
next_spawn);
continue;
}
@@ -380,7 +380,7 @@
log("WARNING: %s %u has a next_spawn time for worker type "
"\"%s\", that costs something to build, set to %u, "
"ignoring\n",
- warehouse.descr().descname().c_str(), warehouse.serial(), worker_typename,
+ warehouse.descr().name().c_str(), warehouse.serial(), worker_typename,
next_spawn);
continue;
}
@@ -391,7 +391,7 @@
throw GameDataError("%s %u has a next_spawn time for worker type "
"\"%s\" set to %u, but it was previously set "
"to %u\n",
- warehouse.descr().descname().c_str(), warehouse.serial(),
+ warehouse.descr().name().c_str(), warehouse.serial(),
worker_typename, next_spawn,
warehouse.next_worker_without_cost_spawn_[i]);
warehouse.next_worker_without_cost_spawn_[i] = next_spawn;
@@ -717,7 +717,7 @@
} catch (const WException& e) {
throw GameDataError(
- "productionsite (%s): %s", productionsite.descr().descname().c_str(), e.what());
+ "productionsite (%s): %s", productionsite.descr().name().c_str(), e.what());
}
}
=== modified file 'src/map_io/map_object_packet.cc'
--- src/map_io/map_object_packet.cc 2018-04-07 16:59:00 +0000
+++ src/map_io/map_object_packet.cc 2018-11-07 10:28:51 +0000
@@ -153,7 +153,7 @@
if (!obj.has_new_save_support())
throw GameDataError("MO(%u of type %s) without new style save support not saved "
"explicitly",
- obj.serial(), obj.descr().descname().c_str());
+ obj.serial(), obj.descr().name().c_str());
mos.register_object(obj);
obj.save(egbase, mos, fw);
=== modified file 'src/map_io/map_players_view_packet.cc'
--- src/map_io/map_players_view_packet.cc 2018-07-12 08:08:47 +0000
+++ src/map_io/map_players_view_packet.cc 2018-11-07 10:28:51 +0000
@@ -856,8 +856,8 @@
else {
// We should never get here.. output some information about the situation.
log("\nwidelands_map_players_view_data_packet.cc::write_unseen_immovable(): ");
- log("%s %s (%s) was not expected.\n", typeid(*map_object_descr).name(),
- map_object_descr->name().c_str(), map_object_descr->descname().c_str());
+ log("%s %s was not expected.\n", typeid(*map_object_descr).name(),
+ map_object_descr->name().c_str());
NEVER_HERE();
}
immovable_kinds_file.unsigned_8(immovable_kind);
Follow ups