[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1688655-suitability-mines into lp:widelands

2017-05-06 Thread bunnybot
Continuous integration builds have changed state:

Travis build 2153. State: passed. Details: 
https://travis-ci.org/widelands/widelands/builds/229520017.
Appveyor build 1988. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1688655_suitability_mines-1988.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1688655-suitability-mines/+merge/323716
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1688655-suitability-mines into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1688655-suitability-mines into lp:widelands

2017-05-06 Thread GunChleoc
GunChleoc has proposed merging 
lp:~widelands-dev/widelands/bug-1688655-suitability-mines into lp:widelands.

Commit message:
Fixed place_building_in_region to allow placing mines.
- Extended BuildingDescr::suitability to include mines.
- Changed return value to bool.
- Removed unused parameter 'req_suitability' from function 
place_building_in_region in infrastructure.lua.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1688655 in widelands: "lua func "place_building_in_region" not work for 
mines"
  https://bugs.launchpad.net/widelands/+bug/1688655

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1688655-suitability-mines/+merge/323716

Can be tested by hacking the Fortified Village starting condition like this:

=== modified file 
'data/tribes/scripting/starting_conditions/barbarians/fortified_village.lua'
--- data/tribes/scripting/starting_conditions/barbarians/fortified_village.lua  
2016-12-03 16:37:13 +
+++ data/tribes/scripting/starting_conditions/barbarians/fortified_village.lua  
2017-05-06 19:15:43 +
@@ -92,5 +92,8 @@
   place_building_in_region(plr, "barbarians_lime_kiln", sf:region(12), {
  inputs = { granite = 6, coal = 3 },
   })
+  place_building_in_region(plr, "barbarians_coalmine", sf:region(12), {
+ inputs = { ration = 3 },
+  })
end
 }

-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1688655-suitability-mines into lp:widelands.
=== modified file 'data/scripting/infrastructure.lua'
--- data/scripting/infrastructure.lua	2016-11-01 14:54:20 +
+++ data/scripting/infrastructure.lua	2017-05-06 19:26:51 +
@@ -132,24 +132,19 @@
 --:arg opts:  a table with prefill information (wares, soldiers, workers,
 --   see :func:`prefilled_buildings`) and the following options:
 --
---   req_suitability
---  The reguired suitability for this building. Default value is 1.
 --:type opts: :class:`table`
 --
 --:returns: the building created
-function place_building_in_region(
-   plr, building, fields, gargs
-)
+function place_building_in_region(plr, building, fields, gargs)
local idx
local f
local args = gargs or {}
-   local req_suitability = args.req_suitability or 1
 
while #fields > 0 do
   local idx = math.random(#fields)
   local f = fields[idx]
 
-  if plr:get_suitability(building, f) >= req_suitability then
+  if plr:get_suitability(building, f) then
  args[1] = building
  args[2] = f.x
  args[3] = f.y

=== modified file 'src/logic/map_objects/tribes/building.cc'
--- src/logic/map_objects/tribes/building.cc	2017-05-03 07:24:06 +
+++ src/logic/map_objects/tribes/building.cc	2017-05-06 19:26:51 +
@@ -184,8 +184,10 @@
 	return b;
 }
 
-int32_t BuildingDescr::suitability(const Map&, const FCoords& fc) const {
-	return size_ <= (fc.field->nodecaps() & Widelands::BUILDCAPS_SIZEMASK);
+bool BuildingDescr::suitability(const Map&, const FCoords& fc) const {
+	return mine_ ?
+		fc.field->nodecaps() & Widelands::BUILDCAPS_MINE :
+		size_ <= (fc.field->nodecaps() & Widelands::BUILDCAPS_SIZEMASK);
 }
 
 /**

=== modified file 'src/logic/map_objects/tribes/building.h'
--- src/logic/map_objects/tribes/building.h	2017-04-23 12:11:19 +
+++ src/logic/map_objects/tribes/building.h	2017-05-06 19:26:51 +
@@ -155,7 +155,7 @@
 
 	WorkareaInfo workarea_info_;
 
-	virtual int32_t suitability(const Map&, const FCoords&) const;
+	bool suitability(const Map&, const FCoords&) const;
 	const BuildingHints& hints() const {
 		return hints_;
 	}

=== modified file 'src/scripting/lua_game.cc'
--- src/scripting/lua_game.cc	2017-04-22 05:35:46 +
+++ src/scripting/lua_game.cc	2017-05-06 19:26:51 +
@@ -785,17 +785,17 @@
 /* RST
.. method:: get_suitability(building, field)
 
-  Returns the suitability that this building has for this field. This
-  is mainly useful in initialization where buildings must be placed
+  Returns whether this building type can be placed on this field. This
+  is mainly useful in initializations where buildings must be placed
   automatically.
 
-  :arg building: name of the building to check for
+  :arg building: name of the building description to check for
   :type building: :class:`string`
   :arg field: where the suitability should be checked
   :type field: :class:`wl.map.Field`
 
-  :returns: the suitability
-  :rtype: :class:`integer`
+  :returns: whether the field has a suitable building plot for this building type
+  :rtype: :class:`boolean`
 */
 // UNTESTED
 int LuaPlayer::get_suitability(lua_State* L) {
@@ -807,7 +807,7 @@
 	if (!tribes.building_exists(i))
 		report_error(L, "Unknown building type: <%s>", name);
 
-	lua_pushint32(L, tribes.get_building_descr(i)->suitability(
+	lua_pushboolean(L, tribes.get_building_descr(i)->suitability(
 	   

Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/savegame-menu into lp:widelands

2017-05-06 Thread GunChleoc
Review: Resubmit

I have implemented all your suggestions except for the colors, and it looks 
much better now :)

The color scheme is as follows:

Fullscreen menu text: Yellow, bold headers/variable names. Grey, bold 
paragraph-level texts. Due to the background images, all texts have to be bold 
in order to be legible (yuck).

In-game/in-editor text: Grey, bold header/variable names. Yellow 
paragraph-level texts.

Once the compiler finishes, I'll double-check that I haven't made any mistakes 
here.

If we change the color scheme in the savegame menu, then we also need to change 
it for all campaign, help and messages texts for consistency, and that's a 
clear -1 on my part.
-- 
https://code.launchpad.net/~widelands-dev/widelands/savegame-menu/+merge/322924
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/savegame-menu.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp