Merge lp:~widelands-dev/widelands/bug-1800337-unlocalize-log into lp:widelands

Proposed by GunChleoc on 2018-11-07
Status: Merged
Merged at revision: 8916
Proposed branch: lp:~widelands-dev/widelands/bug-1800337-unlocalize-log
Merge into: lp:widelands
Diff against target: 236 lines (+25/-25)
9 files modified
src/logic/map_objects/tribes/militarysite.cc (+1/-1)
src/logic/map_objects/tribes/production_program.cc (+6/-6)
src/logic/map_objects/tribes/productionsite.cc (+2/-2)
src/logic/map_objects/tribes/tribe_descr.cc (+3/-3)
src/logic/map_objects/tribes/warehouse.cc (+2/-2)
src/logic/map_objects/tribes/worker.cc (+1/-1)
src/map_io/map_buildingdata_packet.cc (+7/-7)
src/map_io/map_object_packet.cc (+1/-1)
src/map_io/map_players_view_packet.cc (+2/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1800337-unlocalize-log
Reviewer Review Type Date Requested Status
Toni Förster 2018-11-07 Approve on 2018-11-09
Review via email: mp+358424@code.launchpad.net

Commit message

Use internal names rather than descnames for log messages and workarea IDs.

To post a comment you must log in.
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4192. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/452673599.
Appveyor build 3988. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1800337_unlocalize_log-3988.

Toni Förster (stonerl) wrote :

Looks good to me. Also playtested it.

review: Approve
GunChleoc (gunchleoc) wrote :

Thanks for the review! :)

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/map_objects/tribes/militarysite.cc'
2--- src/logic/map_objects/tribes/militarysite.cc 2018-04-07 16:59:00 +0000
3+++ src/logic/map_objects/tribes/militarysite.cc 2018-11-07 10:28:51 +0000
4@@ -307,7 +307,7 @@
5 heal_per_second_ = table.get_int("heal_per_second");
6
7 if (conquer_radius_ > 0)
8- workarea_info_[conquer_radius_].insert(descname() + " conquer");
9+ workarea_info_[conquer_radius_].insert(name() + " conquer");
10 prefers_heroes_at_start_ = table.get_bool("prefer_heroes");
11
12 std::unique_ptr<LuaTable> items_table = table.get_table("messages");
13
14=== modified file 'src/logic/map_objects/tribes/production_program.cc'
15--- src/logic/map_objects/tribes/production_program.cc 2018-10-12 10:29:33 +0000
16+++ src/logic/map_objects/tribes/production_program.cc 2018-11-07 10:28:51 +0000
17@@ -575,7 +575,7 @@
18 if (it == programs.end())
19 throw GameDataError("the program \"%s\" has not (yet) been declared in %s "
20 "(wrong declaration order?)",
21- program_name, descr.descname().c_str());
22+ program_name, descr.name().c_str());
23 program_ = it->second.get();
24 }
25
26@@ -663,13 +663,13 @@
27 for (const auto& area_info : worker_workarea_info) {
28 std::set<std::string>& building_radius_infos = descr->workarea_info_[area_info.first];
29
30- for (const std::string& worker_descname : area_info.second) {
31- std::string description = descr->descname();
32+ for (const std::string& worker_name : area_info.second) {
33+ std::string description = descr->name();
34 description += ' ';
35 description += production_program_name;
36 description += " worker ";
37 description += main_worker_descr.name();
38- description += worker_descname;
39+ description += worker_name;
40 building_radius_infos.insert(description);
41 }
42 }
43@@ -1124,8 +1124,8 @@
44 throw GameDataError("expected %s but found \"%s\"", "percentage", parameters);
45 }
46 std::string description =
47- (boost::format("%1$s %2$s mine %3$s") % descr->descname() % production_program_name %
48- world.get_resource(resource_)->descname())
49+ (boost::format("%1$s %2$s mine %3$s") % descr->name() % production_program_name %
50+ world.get_resource(resource_)->name())
51 .str();
52
53 descr->workarea_info_[distance_].insert(description);
54
55=== modified file 'src/logic/map_objects/tribes/productionsite.cc'
56--- src/logic/map_objects/tribes/productionsite.cc 2018-09-10 05:59:47 +0000
57+++ src/logic/map_objects/tribes/productionsite.cc 2018-11-07 10:28:51 +0000
58@@ -559,7 +559,7 @@
59 * Intercept remove_worker() calls to unassign our worker, if necessary.
60 */
61 void ProductionSite::remove_worker(Worker& w) {
62- molog("%s leaving\n", w.descr().descname().c_str());
63+ molog("%s leaving\n", w.descr().name().c_str());
64 WorkingPosition* wp = working_positions_;
65
66 for (const auto& temp_wp : descr().working_positions()) {
67@@ -657,7 +657,7 @@
68 if (current == nuwo)
69 throw wexception(
70 "Something went wrong! No fitting place for worker %s in %s at (%u, %u) found!",
71- w->descr().descname().c_str(), psite.descr().descname().c_str(),
72+ w->descr().name().c_str(), psite.descr().name().c_str(),
73 psite.get_position().x, psite.get_position().y);
74 }
75 }
76
77=== modified file 'src/logic/map_objects/tribes/tribe_descr.cc'
78--- src/logic/map_objects/tribes/tribe_descr.cc 2018-09-15 07:47:59 +0000
79+++ src/logic/map_objects/tribes/tribe_descr.cc 2018-11-07 10:28:51 +0000
80@@ -393,7 +393,7 @@
81 if (!res || !amount) {
82 auto list = resource_indicators_.find("");
83 if (list == resource_indicators_.end() || list->second.empty()) {
84- throw GameDataError("Tribe '%s' has no indicator for no resources!", descname_.c_str());
85+ throw GameDataError("Tribe '%s' has no indicator for no resources!", name_.c_str());
86 }
87 return list->second.begin()->second;
88 }
89@@ -401,7 +401,7 @@
90 auto list = resource_indicators_.find(res->name());
91 if (list == resource_indicators_.end() || list->second.empty()) {
92 throw GameDataError(
93- "Tribe '%s' has no indicators for resource '%s'!", descname_.c_str(), res->name().c_str());
94+ "Tribe '%s' has no indicators for resource '%s'!", name_.c_str(), res->name().c_str());
95 }
96
97 uint32_t lowest = 0;
98@@ -416,7 +416,7 @@
99 if (lowest < amount) {
100 throw GameDataError("Tribe '%s' has no indicators for amount %i of resource '%s' (highest "
101 "possible amount is %i)!",
102- descname_.c_str(), amount, res->name().c_str(), lowest);
103+ name_.c_str(), amount, res->name().c_str(), lowest);
104 }
105
106 return list->second.find(lowest)->second;
107
108=== modified file 'src/logic/map_objects/tribes/warehouse.cc'
109--- src/logic/map_objects/tribes/warehouse.cc 2018-09-04 15:48:47 +0000
110+++ src/logic/map_objects/tribes/warehouse.cc 2018-11-07 10:28:51 +0000
111@@ -299,7 +299,7 @@
112 heal_per_second_ = table.get_int("heal_per_second");
113 if (table.has_key("conquers")) {
114 conquers_ = table.get_int("conquers");
115- workarea_info_[conquers_].insert(descname() + " conquer");
116+ workarea_info_[conquers_].insert(name() + " conquer");
117 }
118 }
119
120@@ -1072,7 +1072,7 @@
121 } else
122 throw wexception("worker type %s needs \"%s\" to be built but that is neither "
123 "a ware type nor a worker type defined in the tribe %s",
124- w_desc.descname().c_str(), input_name.c_str(),
125+ w_desc.name().c_str(), input_name.c_str(),
126 owner().tribe().name().c_str());
127 }
128 }
129
130=== modified file 'src/logic/map_objects/tribes/worker.cc'
131--- src/logic/map_objects/tribes/worker.cc 2018-09-25 06:32:35 +0000
132+++ src/logic/map_objects/tribes/worker.cc 2018-11-07 10:28:51 +0000
133@@ -2101,7 +2101,7 @@
134 /// Give the recruit his diploma and say farwell to him.
135 void Worker::start_task_releaserecruit(Game& game, Worker& recruit) {
136 push_task(game, taskReleaserecruit);
137- molog("Starting to release %s %u...\n", recruit.descr().descname().c_str(), recruit.serial());
138+ molog("Starting to release %s %u...\n", recruit.descr().name().c_str(), recruit.serial());
139 return schedule_act(game, 5000);
140 }
141
142
143=== modified file 'src/map_io/map_buildingdata_packet.cc'
144--- src/map_io/map_buildingdata_packet.cc 2018-07-08 15:16:16 +0000
145+++ src/map_io/map_buildingdata_packet.cc 2018-11-07 10:28:51 +0000
146@@ -152,7 +152,7 @@
147 if (building.old_buildings_.empty() && !is_a(ConstructionSite, &building)) {
148 throw GameDataError("Failed to read %s %u: No former buildings information.\n"
149 "Your savegame is corrupted",
150- building.descr().descname().c_str(), building.serial());
151+ building.descr().name().c_str(), building.serial());
152 }
153
154 if (fr.unsigned_8()) {
155@@ -161,7 +161,7 @@
156 log("WARNING: Found a stopped %s at (%i, %i) in the "
157 "savegame. Militarysites are not stoppable. "
158 "Ignoring.",
159- building.descr().descname().c_str(), building.get_position().x,
160+ building.descr().name().c_str(), building.get_position().x,
161 building.get_position().y);
162 } else {
163 productionsite->set_stopped(true);
164@@ -170,7 +170,7 @@
165 log("WARNING: Found a stopped %s at (%i, %i) in the "
166 "savegame. Only productionsites are stoppable. "
167 "Ignoring.",
168- building.descr().descname().c_str(), building.get_position().x,
169+ building.descr().name().c_str(), building.get_position().x,
170 building.get_position().y);
171 }
172
173@@ -372,7 +372,7 @@
174 if (!game.tribes().worker_exists(worker_index)) {
175 log("WARNING: %s %u has a next_spawn time for nonexistent "
176 "worker type \"%s\" set to %u, ignoring\n",
177- warehouse.descr().descname().c_str(), warehouse.serial(), worker_typename,
178+ warehouse.descr().name().c_str(), warehouse.serial(), worker_typename,
179 next_spawn);
180 continue;
181 }
182@@ -380,7 +380,7 @@
183 log("WARNING: %s %u has a next_spawn time for worker type "
184 "\"%s\", that costs something to build, set to %u, "
185 "ignoring\n",
186- warehouse.descr().descname().c_str(), warehouse.serial(), worker_typename,
187+ warehouse.descr().name().c_str(), warehouse.serial(), worker_typename,
188 next_spawn);
189 continue;
190 }
191@@ -391,7 +391,7 @@
192 throw GameDataError("%s %u has a next_spawn time for worker type "
193 "\"%s\" set to %u, but it was previously set "
194 "to %u\n",
195- warehouse.descr().descname().c_str(), warehouse.serial(),
196+ warehouse.descr().name().c_str(), warehouse.serial(),
197 worker_typename, next_spawn,
198 warehouse.next_worker_without_cost_spawn_[i]);
199 warehouse.next_worker_without_cost_spawn_[i] = next_spawn;
200@@ -717,7 +717,7 @@
201
202 } catch (const WException& e) {
203 throw GameDataError(
204- "productionsite (%s): %s", productionsite.descr().descname().c_str(), e.what());
205+ "productionsite (%s): %s", productionsite.descr().name().c_str(), e.what());
206 }
207 }
208
209
210=== modified file 'src/map_io/map_object_packet.cc'
211--- src/map_io/map_object_packet.cc 2018-04-07 16:59:00 +0000
212+++ src/map_io/map_object_packet.cc 2018-11-07 10:28:51 +0000
213@@ -153,7 +153,7 @@
214 if (!obj.has_new_save_support())
215 throw GameDataError("MO(%u of type %s) without new style save support not saved "
216 "explicitly",
217- obj.serial(), obj.descr().descname().c_str());
218+ obj.serial(), obj.descr().name().c_str());
219
220 mos.register_object(obj);
221 obj.save(egbase, mos, fw);
222
223=== modified file 'src/map_io/map_players_view_packet.cc'
224--- src/map_io/map_players_view_packet.cc 2018-07-12 08:08:47 +0000
225+++ src/map_io/map_players_view_packet.cc 2018-11-07 10:28:51 +0000
226@@ -856,8 +856,8 @@
227 else {
228 // We should never get here.. output some information about the situation.
229 log("\nwidelands_map_players_view_data_packet.cc::write_unseen_immovable(): ");
230- log("%s %s (%s) was not expected.\n", typeid(*map_object_descr).name(),
231- map_object_descr->name().c_str(), map_object_descr->descname().c_str());
232+ log("%s %s was not expected.\n", typeid(*map_object_descr).name(),
233+ map_object_descr->name().c_str());
234 NEVER_HERE();
235 }
236 immovable_kinds_file.unsigned_8(immovable_kind);