Merge lp:~widelands-dev/widelands/ai-hint-debug into lp:widelands

Proposed by Toni Förster
Status: Merged
Merged at revision: 8944
Proposed branch: lp:~widelands-dev/widelands/ai-hint-debug
Merge into: lp:widelands
Diff against target: 477 lines (+96/-64)
6 files modified
src/ai/ai_hints.cc (+2/-2)
src/graphic/text/rt_parse.cc (+6/-6)
src/logic/map_objects/tribes/worker_program.cc (+57/-25)
src/scripting/lua_bases.cc (+3/-3)
src/scripting/lua_globals.cc (+2/-2)
src/scripting/lua_map.cc (+26/-26)
To merge this branch: bzr merge lp:~widelands-dev/widelands/ai-hint-debug
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+360943@code.launchpad.net

Commit message

set correct indent for documentation

Description of the change

Debug builds on travis are failing, because of erroneous indents. This should fix it.

To post a comment you must log in.
Revision history for this message
kaputtnik (franku) wrote :

This happens when running clang_format: it breaks lines at column 100.

Since you are on it: Please make sure the indented lines do not exceed the limit of 100 characters again. Otherwise they will break sphinx again after running clang-format.

Thanks :-)

Revision history for this message
kaputtnik (franku) wrote :

Maybe the regular expression for 'CommentPragmas:' in the file '.clang-format' (in the base directory) has to be adjusted?

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4339. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/468090637.
Appveyor build 4134. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_ai_hint_debug-4134.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4340. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/468217701.
Appveyor build 4135. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_ai_hint_debug-4135.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks for fixing this :)

It messes up the Lua comments in the documentation code examples though - see my comments. Best move the complete comments above the line if they don't fit after.

Also, run clang-format locally to double-check that it won't get messed up again when we merge the branch, because bunnybot will execute clang-format automatically.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4343. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/468776979.
Appveyor build 4137. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_ai_hint_debug-4137.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4344. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/468835505.
Appveyor build 4138. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_ai_hint_debug-4138.

Revision history for this message
Toni Förster (stonerl) wrote :

Should be alright, now. If nobody objects I would merge this branch into trunk.

Revision history for this message
Toni Förster (stonerl) wrote :

@bunnybot merge force

Revision history for this message
Toni Förster (stonerl) wrote :

The 'CommentPragmas:' in the file '.clang-format' does work. But it only applies to a line and not a codeblock. According to the documentation this is needed:

// clang-format off
  some code that must not be formatted
// clang-format on

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ai/ai_hints.cc'
2--- src/ai/ai_hints.cc 2018-12-13 07:24:01 +0000
3+++ src/ai/ai_hints.cc 2018-12-17 02:15:24 +0000
4@@ -138,7 +138,7 @@
5 **collects_ware_from_map**
6 The building will generate this ware from the map, e.g. a well mining the ``water`` ware,
7 or the hunter returning from the hunt with the ``meat`` ware. The same ware needs also to be
8-listed as the first one of the building's outputs, e.g.::
9+ listed as the first one of the building's outputs, e.g.::
10
11 aihints = {
12 collects_ware_from_map = "meat"
13@@ -151,7 +151,7 @@
14
15 **Note:** The AI expects exactly one such building type for each of the following wares:
16 ``fish`` (fisher), ``granite`` (quarry), ``log`` (lumberjack/woodcutter), ``meat`` (hunter),
17-``water`` (well).
18+ ``water`` (well).
19
20 **mines**
21 The building will mine to obtain the given ware, e.g.::
22
23=== modified file 'src/graphic/text/rt_parse.cc'
24--- src/graphic/text/rt_parse.cc 2018-12-13 07:24:01 +0000
25+++ src/graphic/text/rt_parse.cc 2018-12-17 02:15:24 +0000
26@@ -209,7 +209,7 @@
27 ^^^^^^^^^^
28
29 * **padding**: The rectangle of this tag is shrunk so leave a gap on its outside, on all four outer
30-edges.
31+ edges.
32 * **padding_r**: Padding on the right-hand side
33 * **padding_l**: Padding on the left-hand side
34 * **padding_b**: Padding on the bottom
35@@ -218,7 +218,7 @@
36 * **background**: Give this tag's rectangle a background color as a hex value.
37
38 * **keep_spaces**: Do now trim away trailing and double spaces. Use this where the user is editing
39-text.
40+ text.
41 * **db_show_spaces**: Highlight all blank spaces for debugging purposes.
42
43 Sub-tags
44@@ -264,11 +264,11 @@
45 The same attributes as :ref:`rt_tags_rt`, plus the following:
46
47 * **margin**: Shrink all contents to leave a margin towards the outer edge of this tag's rectangle.
48-* **float**: Make text float around this div. Allowed values are ``left``, ``right``.
49+* **float**: Make text float around this div. Allowed values are ``left``, ``right``.
50 The structure has to be something like: ``div("width=100%", div("float=left padding_r=6",
51-p(img(imagepath))) .. p(text))``, with the first embedded div being the floating one.
52+ p(img(imagepath))) .. p(text))``, with the first embedded div being the floating one.
53 * **valign**: Align the contents vertically. Allowed values are ``top`` (default), ``center`` or
54-``middle``, ``bottom``.
55+ ``middle``, ``bottom``.
56 * **width**: The width of this element, as a pixel amount, or as a percentage.
57 The last ``div`` in a row can be expanded automatically by using ``*``.
58
59@@ -484,7 +484,7 @@
60 * **ref**: To be implemented
61 * **color**: Player color for the image as a hex value
62 * **width**: Width of the image as a pixel amount. The corresponding height will be matched
63-automatically.
64+ automatically.
65
66 :ref:`Return to tag index<rt_tags>`
67 */
68
69=== modified file 'src/logic/map_objects/tribes/worker_program.cc'
70--- src/logic/map_objects/tribes/worker_program.cc 2018-12-13 07:24:01 +0000
71+++ src/logic/map_objects/tribes/worker_program.cc 2018-12-17 02:15:24 +0000
72@@ -271,13 +271,20 @@
73
74 cut_granite = {
75 "findobject=attrib:rocks radius:6", -- Find rocks on the map within a radius of 6 from your
76-building "walk=object", -- Now walk to those rocks "playsound=sound/atlanteans/cutting stonecutter
77-192", "animate=hacking 12000", "callobject=shrink", "createware=granite", "return"
78+ building
79+ "walk=object", -- Now walk to those rocks
80+ "playsound=sound/atlanteans/cutting stonecutter 192",
81+ "animate=hacking 12000",
82+ "callobject=shrink",
83+ "createware=granite",
84+ "return"
85 },
86
87 hunt = {
88 "findobject=type:bob radius:13 attrib:eatable", -- Find an eatable bob (animal) within a
89-radius of 13 from your building "walk=object", -- Walk to where the animal is "animate=idle 1500",
90+ radius of 13 from your building
91+ "walk=object", -- Walk to where the animal is
92+ "animate=idle 1500",
93 "removeobject",
94 "createware=meat",
95 "return"
96@@ -327,7 +334,7 @@
97 findspace
98 ^^^^^^^^^
99 .. function:: findspace=size:\<plot\> radius:\<distance\> [breed] [resource:\<name\>]
100-[avoid:\<immovable_attribute\>] [saplingsearches:\<number\>] [space]
101+ [avoid:\<immovable_attribute\>] [saplingsearches:\<number\>] [space]
102
103 :arg string size: The size or building plot type of the free space.
104 The possible values are:
105@@ -362,13 +369,19 @@
106 The field can then be used in other commands like ``walk``. Examples::
107
108 breed = {
109- "findspace=size:any radius:7 breed resource:fish", -- Find any field that can have fish in
110-it for adding a fish to it below "walk=coords", "animate=freeing 3000", "breed=fish 1", "return"
111+ -- Find any field that can have fish in it for adding a fish to it below
112+ "findspace=size:any radius:7 breed resource:fish",
113+ "walk=coords",
114+ "animate=freeing 3000",
115+ "breed=fish 1",
116+ "return"
117 },
118
119 plant = {
120- "findspace=size:any radius:5 avoid:field saplingsearches:8", -- Don't get in the way of the
121-farmer's crops when planting trees. Retry 8 times. "walk=coords", "animate=dig 2000",
122+ -- Don't get in the way of the farmer's crops when planting trees. Retry 8 times.
123+ "findspace=size:any radius:5 avoid:field saplingsearches:8",
124+ "walk=coords",
125+ "animate=dig 2000",
126 "animate=planting 1000",
127 "plant=attrib:tree_sapling",
128 "animate=water 2000",
129@@ -376,8 +389,11 @@
130 },
131
132 plant = {
133- "findspace=size:any radius:2 space", -- The farmer will want to walk to this field again
134-later for harvesting his crop "walk coords", "animate=planting 4000", "plant=attrib:seed_wheat",
135+ -- The farmer will want to walk to this field again later for harvesting his crop
136+ "findspace=size:any radius:2 space",
137+ "walk=coords",
138+ "animate=planting 4000",
139+ "plant=attrib:seed_wheat",
140 "animate=planting 4000",
141 "return",
142 },
143@@ -497,9 +513,13 @@
144
145 buildship = {
146 "walk=object-or-coords", -- Walk to coordinates from 1. or to object from 2.
147- "plant=attrib:shipconstruction unless object", -- 2. This will create an object for us if
148-we don't have one yet "playsound=sound/sawmill sawmill 230", "animate=work 500", "construct", -- 1.
149-This will find a space for us if no object has been planted yet "animate=work 5000", "return"
150+ -- 2. This will create an object for us if we don't have one yet
151+ "plant=attrib:shipconstruction unless object",
152+ "playsound=sound/sawmill sawmill 230",
153+ "animate=work 500",
154+ "construct", -- 1. This will find a space for us if no object has been planted yet
155+ "animate=work 5000",
156+ "return"
157 },
158 */
159 /**
160@@ -646,14 +666,19 @@
161 "findspace=size:any radius:2 space",
162 "walk=coords",
163 "animate=planting 4000",
164- "plant=attrib:seed_wheat", -- Plant the tiny field immovable that the worker's tribe knows
165-about "animate=planting 4000", "return",
166+ -- Plant the tiny field immovable that the worker's tribe knows about
167+ "plant=attrib:seed_wheat",
168+ "animate=planting 4000",
169+ "return",
170 },
171
172 buildship = {
173 "walk=object-or-coords",
174- "plant=attrib:shipconstruction unless object", -- Only create a shipconstruction if we
175-don't already have one "playsound=sound/sawmill sawmill 230", "animate=work 500", "construct",
176+ -- Only create a shipconstruction if we don't already have one
177+ "plant=attrib:shipconstruction unless object",
178+ "playsound=sound/sawmill sawmill 230",
179+ "animate=work 500",
180+ "construct",
181 "animate=work 5000",
182 "return"
183 }
184@@ -743,8 +768,10 @@
185 "findobject=type:bob radius:13 attrib:eatable", -- Select an object to remove
186 "walk=object",
187 "animate=idle 1000",
188- "removeobject", -- The selected eatable map object has been hunted, so remove it from the
189-map "createware=meat", "return"
190+ -- The selected eatable map object has been hunted, so remove it from the map
191+ "removeobject",
192+ "createware=meat",
193+ "return"
194 }
195 */
196 void WorkerProgram::parse_removeobject(Worker::Action* act, const std::vector<std::string>&) {
197@@ -805,8 +832,8 @@
198 "animate=idle 2000",
199 "playsound=sound/hammering geologist_hammer 192",
200 "animate=hacking 3000",
201- "findresources" -- Plant a resource marker at the current location, according to what has
202-been found.
203+ -- Plant a resource marker at the current location, according to what has been found.
204+ "findresources"
205 }
206 */
207 void WorkerProgram::parse_findresources(Worker::Action* act, const std::vector<std::string>& cmd) {
208@@ -894,10 +921,15 @@
209
210 buildship = {
211 "walk=object-or-coords", -- Walk to coordinates from 1. or to object from 2.
212- "plant=attrib:shipconstruction unless object", -- 2. This will create an object for us if
213-we don't have one yet "playsound=sound/sawmill sawmill 230", "animate=work 500", "construct", -- 1.
214-Add the current ware to the shipconstruction. This will find a space for us if no shipconstruction
215-object has been planted yet "animate=work 5000", "return"
216+ -- 2. This will create an object for us if we don't have one yet
217+ "plant=attrib:shipconstruction unless object",
218+ "playsound=sound/sawmill sawmill 230",
219+ "animate=work 500",
220+ -- 1. Add the current ware to the shipconstruction. This will find a space for us if no
221+ -- shipconstruction object has been planted yet
222+ "construct",
223+ "animate=work 5000",
224+ "return"
225 },
226 */
227 /**
228
229=== modified file 'src/scripting/lua_bases.cc'
230--- src/scripting/lua_bases.cc 2018-12-13 07:24:01 +0000
231+++ src/scripting/lua_bases.cc 2018-12-17 02:15:24 +0000
232@@ -400,9 +400,9 @@
233 Saves information that can be read by other scenarios.
234
235 If an array is used, the data will be saved in the correct order. Arrays may not contain nil
236- values. If the table is not an array, all keys have to be strings. Tables may contain subtables
237- of any depth. Cyclic dependencies will cause Widelands to crash. Only tables/arrays, strings,
238- integer numbers and booleans may be used as values.
239+ values. If the table is not an array, all keys have to be strings. Tables may contain subtables
240+ of any depth. Cyclic dependencies will cause Widelands to crash. Only tables/arrays, strings,
241+ integer numbers and booleans may be used as values.
242 */
243 int LuaEditorGameBase::save_campaign_data(lua_State* L) {
244
245
246=== modified file 'src/scripting/lua_globals.cc'
247--- src/scripting/lua_globals.cc 2018-12-13 07:24:01 +0000
248+++ src/scripting/lua_globals.cc 2018-12-17 02:15:24 +0000
249@@ -198,7 +198,7 @@
250 .. function:: pgettext(msgctxt, msgid)
251
252 A wrapper for the pgettext() function, needed for allowing multiple translations of the same
253-string according to context.
254+ string according to context.
255
256 :arg msgctxt: a named context for this string for disambiguation
257 :type msgctxt: :class:`string`
258@@ -253,7 +253,7 @@
259 .. function:: ticks()
260
261 Returns an integer value representing the number of milliseconds since the SDL library
262-initialized.
263+ initialized.
264 */
265 static int L_ticks(lua_State* L) {
266 lua_pushinteger(L, SDL_GetTicks());
267
268=== modified file 'src/scripting/lua_map.cc'
269--- src/scripting/lua_map.cc 2018-12-13 07:24:01 +0000
270+++ src/scripting/lua_map.cc 2018-12-17 02:15:24 +0000
271@@ -1429,7 +1429,7 @@
272 .. attribute:: buildings
273
274 (RO) an array of :class:`LuaBuildingDescription` with all the buildings that the tribe can
275- use, casted to their appropriate subclasses.
276+ use, casted to their appropriate subclasses.
277 */
278 int LuaTribeDescription::get_buildings(lua_State* L) {
279 const TribeDescr& tribe = *get();
280@@ -1492,7 +1492,7 @@
281 .. attribute:: immovables
282
283 (RO) an array of :class:`LuaImmovableDescription` with all the immovables that the tribe can
284- use.
285+ use.
286 */
287 int LuaTribeDescription::get_immovables(lua_State* L) {
288 const TribeDescr& tribe = *get();
289@@ -1665,8 +1665,8 @@
290 This class contains the properties that are common to all map objects such as buildings or wares.
291
292 The dynamic MapObject class corresponding to this class is the base class for all Objects in
293-widelands, including immovables and Bobs. This class can't be instantiated directly, but provides
294-the base for all others.
295+ widelands, including immovables and Bobs. This class can't be instantiated directly, but provides
296+ the base for all others.
297 */
298 const char LuaMapObjectDescription::className[] = "MapObjectDescription";
299 const MethodType<LuaMapObjectDescription> LuaMapObjectDescription::Methods[] = {
300@@ -1820,7 +1820,7 @@
301 automatically placed next to each port building.
302
303 * **Abstract:** These types are abstract map objects that are used by the engine and are
304- not visible on the map.
305+ not visible on the map.
306
307 * :class:`battle <BattleDescription>`, holds information
308 about two soldiers in a fight,
309@@ -1841,8 +1841,8 @@
310 Child of: :class:`MapObjectDescription`
311
312 A static description of a :class:`base immovable <BaseImmovable>`, so it can be used in help
313-files without having to access an actual immovable on the map. See also
314-:class:`MapObjectDescription` for more properties.
315+ files without having to access an actual immovable on the map. See also
316+ :class:`MapObjectDescription` for more properties.
317 */
318 const char LuaImmovableDescription::className[] = "ImmovableDescription";
319 const MethodType<LuaImmovableDescription> LuaImmovableDescription::Methods[] = {
320@@ -1907,7 +1907,7 @@
321 the name and descname of the editor category of this immovable
322
323 (RO) a table with "name" and "descname" entries for the editor category, or nil if it has
324- none.
325+ none.
326 */
327 int LuaImmovableDescription::get_editor_category(lua_State* L) {
328 const EditorCategory* editor_category = get()->editor_category();
329@@ -2154,7 +2154,7 @@
330 .. attribute:: enhanced_from
331
332 (RO) returns the building that this was enhanced from, or nil if this isn't an enhanced
333- building.
334+ building.
335 */
336 int LuaBuildingDescription::get_enhanced_from(lua_State* L) {
337 if (get()->is_enhanced()) {
338@@ -2280,7 +2280,7 @@
339 .. class:: ConstructionSiteDescription
340
341 Child of: :class:`MapObjectDescription`, :class:`ImmovableDescription`,
342-:class:`BuildingDescription`
343+ :class:`BuildingDescription`
344
345 A static description of a tribe's constructionsite, so it can be used in help files
346 without having to access an actual building on the map.
347@@ -2301,7 +2301,7 @@
348 .. class:: DismantleSiteDescription
349
350 Child of: :class:`MapObjectDescription`, :class:`ImmovableDescription`,
351-:class:`BuildingDescription`
352+ :class:`BuildingDescription`
353
354 A static description of a tribe's dismantlesite, so it can be used in help files
355 without having to access an actual building on the map.
356@@ -2322,7 +2322,7 @@
357 .. class:: ProductionSiteDescription
358
359 Child of: :class:`MapObjectDescription`, :class:`ImmovableDescription`,
360-:class:`BuildingDescription`
361+ :class:`BuildingDescription`
362
363 A static description of a tribe's productionsite, so it can be used in help files
364 without having to access an actual building on the map.
365@@ -2451,10 +2451,10 @@
366 .. attribute:: consumed_wares_workers
367
368 :arg program_name: the name of the production program that we want to get the consumed wares
369- for :type tribename: :class:`string`
370+ for :type tribename: :class:`string`
371
372 (RO) Returns a table of {{ware name}, ware amount} for the wares consumed by this production
373- program. Multiple entries in {ware name} are alternatives (OR logic)).
374+ program. Multiple entries in {ware name} are alternatives (OR logic)).
375 */
376 int LuaProductionSiteDescription::consumed_wares_workers(lua_State* L) {
377 std::string program_name = luaL_checkstring(L, -1);
378@@ -2485,10 +2485,10 @@
379 .. attribute:: produced_wares
380
381 :arg program_name: the name of the production program that we want to get the produced wares
382- for :type tribename: :class:`string`
383+ for :type tribename: :class:`string`
384
385 (RO) Returns a table of {ware name, ware amount} for the wares produced by this production
386- program
387+ program
388 */
389 int LuaProductionSiteDescription::produced_wares(lua_State* L) {
390 std::string program_name = luaL_checkstring(L, -1);
391@@ -2504,7 +2504,7 @@
392 .. attribute:: recruited_workers
393
394 :arg program_name: the name of the production program that we want to get the recruited
395- workers for :type tribename: :class:`string`
396+ workers for :type tribename: :class:`string`
397
398 (RO) Returns a table of {worker name, worker amount} for the workers recruited
399 by this production program
400@@ -2526,7 +2526,7 @@
401 .. class:: MilitarySiteDescription
402
403 Child of: :class:`MapObjectDescription`, :class:`ImmovableDescription`,
404-:class:`BuildingDescription`
405+ :class:`BuildingDescription`
406
407 A static description of a tribe's militarysite, so it can be used in help files
408 without having to access an actual building on the map.
409@@ -2578,12 +2578,12 @@
410 .. class:: TrainingSiteDescription
411
412 Child of: :class:`MapObjectDescription`, :class:`ImmovableDescription`,
413-:class:`BuildingDescription`, :class:`ProductionSiteDescription`
414+ :class:`BuildingDescription`, :class:`ProductionSiteDescription`
415
416 A static description of a tribe's trainingsite, so it can be used in help files
417 without having to access an actual building on the map.
418 A training site can train some or all of a soldier's properties (Attack, Defense, Evade and
419-Health). See the parent classes for more properties.
420+ Health). See the parent classes for more properties.
421 */
422 const char LuaTrainingSiteDescription::className[] = "TrainingSiteDescription";
423 const MethodType<LuaTrainingSiteDescription> LuaTrainingSiteDescription::Methods[] = {
424@@ -2850,7 +2850,7 @@
425 .. class:: WarehouseDescription
426
427 Child of: :class:`MapObjectDescription`, :class:`ImmovableDescription`,
428-:class:`BuildingDescription`
429+ :class:`BuildingDescription`
430
431 A static description of a tribe's warehouse, so it can be used in help files
432 without having to access an actual building on the map.
433@@ -2891,7 +2891,7 @@
434 .. class:: MarketDescription
435
436 Child of: :class:`MapObjectDescription`, :class:`ImmovableDescription`,
437-:class:`BuildingDescription`
438+ :class:`BuildingDescription`
439
440 A static description of a tribe's market, so it can be used in help files
441 without having to access an actual building on the map. A Market is used for
442@@ -3401,7 +3401,7 @@
443 :arg amount: The amount of the resource what we want an overlay image for
444
445 (RO) the :class:`string` path to the image representing the specified amount of this
446- resource
447+ resource
448 */
449 int LuaResourceDescription::editor_image(lua_State* L) {
450 if (lua_gettop(L) != 2) {
451@@ -3480,7 +3480,7 @@
452 .. attribute:: get_default_resource
453
454 (RO) the :class:`wl.map.ResourceDescription` for the default resource provided by this
455- terrain, or nil if the terrain has no default resource.
456+ terrain, or nil if the terrain has no default resource.
457 */
458
459 int LuaTerrainDescription::get_default_resource(lua_State* L) {
460@@ -3510,7 +3510,7 @@
461 .. attribute:: the name and descname of the editor category of this terrain
462
463 (RO) a table with "name" and "descname" entries for the editor category, or nil if it has
464- none.
465+ none.
466 */
467 int LuaTerrainDescription::get_editor_category(lua_State* L) {
468 const EditorCategory* editor_category = get()->editor_category();
469@@ -3576,7 +3576,7 @@
470 .. attribute:: valid_resources
471
472 (RO) a list of :class:`wl.map.ResourceDescription` with all valid resources for this
473- terrain.
474+ terrain.
475 */
476
477 int LuaTerrainDescription::get_valid_resources(lua_State* L) {

Subscribers

People subscribed via source and target branches

to status/vote changes: