Merge lp:~widelands-dev/widelands/remove_nocom_logs_campaign_data into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8741
Proposed branch: lp:~widelands-dev/widelands/remove_nocom_logs_campaign_data
Merge into: lp:widelands
Diff against target: 57 lines (+7/-13)
1 file modified
src/scripting/lua_bases.cc (+7/-13)
To merge this branch: bzr merge lp:~widelands-dev/widelands/remove_nocom_logs_campaign_data
Reviewer Review Type Date Requested Status
Benedikt Straub review, test Approve
Review via email: mp+349088@code.launchpad.net

Commit message

Removed logs in campaign data that are no longer needed. Made some strings const.

To post a comment you must log in.
Revision history for this message
Benedikt Straub (nordfriese) wrote :

Compiled and tested, works as it should.
Code changes look good to me.

review: Approve (review, test)
Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks for the review :)

@bunnybot merge

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3634. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/401193238.
Appveyor build 3433. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_remove_nocom_logs_campaign_data-3433.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/scripting/lua_bases.cc'
2--- src/scripting/lua_bases.cc 2018-06-01 13:29:38 +0000
3+++ src/scripting/lua_bases.cc 2018-07-07 11:07:24 +0000
4@@ -338,7 +338,7 @@
5 If a table is an array, the map 'keys' will contain no mappings for the array's key_keys.
6 */
7 static void save_table_recursively(lua_State* L,
8- std::string depth,
9+ const std::string& depth,
10 std::map<std::string, const char*>* data,
11 std::map<std::string, const char*>* keys,
12 std::map<std::string, const char*>* type,
13@@ -346,11 +346,11 @@
14 lua_pushnil(L);
15 uint32_t i = 0;
16 while (lua_next(L, -2) != 0) {
17- std::string key_key = depth + "_" + std::to_string(i);
18+ const std::string key_key = depth + "_" + std::to_string(i);
19
20 // check the value's type
21 const char* type_name = lua_typename(L, lua_type(L, -1));
22- std::string t = std::string(type_name);
23+ const std::string t = std::string(type_name);
24
25 (*type)[key_key] = type_name;
26
27@@ -461,7 +461,7 @@
28 and the key-value pair is written to the table as the correct type.
29 */
30 static void push_table_recursively(lua_State* L,
31- std::string depth,
32+ const std::string& depth,
33 Section* data_section,
34 Section* keys_section,
35 Section* type_section,
36@@ -469,19 +469,13 @@
37 const uint32_t size = size_section->get_natural(depth.c_str());
38 lua_newtable(L);
39 for (uint32_t i = 0; i < size; i++) {
40- std::string key_key_str(depth + '_' + std::to_string(i));
41+ const std::string key_key_str(depth + '_' + std::to_string(i));
42 const char* key_key = key_key_str.c_str();
43-
44- log("Checking whether a key for '%s' (data type is %s) exists ... ", key_key,
45- type_section->get_string(key_key)); // NOCOM remove this log
46 if (keys_section->has_val(key_key)) {
47- // this is a table
48- log("YES, the key is called '%s'.\n",
49- keys_section->get_string(key_key)); // NOCOM remove this log
50+ // This is a table
51 lua_pushstring(L, keys_section->get_string(key_key));
52 } else {
53- // this must be an array
54- log("NO, [%i] will be used as key.\n", i + 1); // NOCOM remove this log
55+ // This must be an array
56 lua_pushinteger(L, i + 1);
57 }
58

Subscribers

People subscribed via source and target branches

to status/vote changes: