[Widelands-dev] [Merge] lp:~widelands-dev/widelands/economy-target-profiles into lp:widelands

2019-05-14 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4972. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/532432343.
Appveyor build 4753. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_economy_target_profiles-4753.
-- 
https://code.launchpad.net/~widelands-dev/widelands/economy-target-profiles/+merge/366987
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/economy-target-profiles.

___
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/constructionsite_options into lp:widelands

2019-05-14 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4971. State: errored. Details: 
https://travis-ci.org/widelands/widelands/builds/532431388.
Appveyor build 4752. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_constructionsite_options-4752.
-- 
https://code.launchpad.net/~widelands-dev/widelands/constructionsite_options/+merge/367428
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/constructionsite_options 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


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-14 Thread Toni Förster
I made the "show login dialog" button a proper button. kaputtnik has second 
thoughts, though.

here is a screenshot:

https://i.ibb.co/b3W3x3W/internetgame.png
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
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


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-14 Thread Toni Förster
Carets are also fixed.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
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


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/economy-target-profiles into lp:widelands

2019-05-14 Thread Benedikt Straub
Hmm... it seems like the dropdown´s entries and selection are not updated 
correctly for some reason which is beyond my understanding. The "Not Selected" 
message is only the consequence of an upstream failure which I suspect in 
update_profiles(). I have rewritten it, can you try if the problem still exists?
-- 
https://code.launchpad.net/~widelands-dev/widelands/economy-target-profiles/+merge/366987
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/economy-target-profiles.

___
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/constructionsite_options into lp:widelands

2019-05-14 Thread Benedikt Straub
Benedikt Straub has proposed merging 
lp:~widelands-dev/widelands/constructionsite_options into lp:widelands.

Commit message:
Allow players to define settings for and to enhance buildings under construction

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1597310 in widelands: "Possibility to set building options when building 
is under construction"
  https://bugs.launchpad.net/widelands/+bug/1597310

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/constructionsite_options/+merge/367428
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/constructionsite_options into lp:widelands.
=== modified file 'src/ai/defaultai_seafaring.cc'
--- src/ai/defaultai_seafaring.cc	2019-02-23 11:00:49 +
+++ src/ai/defaultai_seafaring.cc	2019-05-14 17:38:23 +
@@ -346,7 +346,7 @@
 if (site->bo->is(BuildingAttribute::kShipyard)) {
 	for (uint32_t k = 0; k < site->bo->inputs.size(); ++k) {
 		game().send_player_set_ware_priority(
-		   *site->site, wwWARE, site->bo->inputs.at(k), HIGH_PRIORITY);
+		   *site->site, wwWARE, site->bo->inputs.at(k), kPriorityHigh);
 	}
 }
 			}

=== modified file 'src/economy/economy.cc'
--- src/economy/economy.cc	2019-04-09 16:43:49 +
+++ src/economy/economy.cc	2019-05-14 17:38:23 +
@@ -971,7 +971,7 @@
 static bool accept_warehouse_if_policy(Warehouse& wh,
WareWorker type,
DescriptionIndex ware,
-   Warehouse::StockPolicy policy) {
+   StockPolicy policy) {
 	return wh.get_stock_policy(type, ware) == policy;
 }
 
@@ -1005,8 +1005,8 @@
 
 		for (uint32_t nwh = 0; nwh < warehouses_.size(); ++nwh) {
 			Warehouse* wh = warehouses_[nwh];
-			Warehouse::StockPolicy policy = wh->get_stock_policy(type, ware);
-			if (policy == Warehouse::StockPolicy::kPrefer) {
+			StockPolicy policy = wh->get_stock_policy(type, ware);
+			if (policy == StockPolicy::kPrefer) {
 haveprefer = true;
 
 // Getting count of worker/ware
@@ -1022,7 +1022,7 @@
 	preferred_wh_stock = current_stock;
 }
 			}
-			if (policy == Warehouse::StockPolicy::kNormal)
+			if (policy == StockPolicy::kNormal)
 havenormal = true;
 		}
 		if (!havenormal && !haveprefer && type == wwWARE)
@@ -1037,7 +1037,7 @@
 			(!havenormal) ?
 			   WarehouseAcceptFn() :
 			   boost::bind(_warehouse_if_policy, _1, type, ware,
-			   Warehouse::StockPolicy::kNormal));
+			   StockPolicy::kNormal));
 		}
 		if (!wh) {
 			log("Warning: Economy::handle_active_supplies "

=== modified file 'src/economy/request.cc'
--- src/economy/request.cc	2019-02-23 11:00:49 +
+++ src/economy/request.cc	2019-05-14 17:38:23 +
@@ -262,7 +262,7 @@
 int32_t Request::get_priority(int32_t cost) const {
 	int MAX_IDLE_PRIORITY = 100;
 	bool is_construction_site = false;
-	int32_t modifier = DEFAULT_PRIORITY;
+	int32_t modifier = kPriorityNormal;
 
 	if (target_building_) {
 		modifier = target_building_->get_priority(get_type(), get_index());

=== modified file 'src/logic/editor_game_base.cc'
--- src/logic/editor_game_base.cc	2019-04-26 05:52:49 +
+++ src/logic/editor_game_base.cc	2019-05-14 17:38:23 +
@@ -38,6 +38,7 @@
 #include "logic/map_objects/map_object.h"
 #include "logic/map_objects/tribes/battle.h"
 #include "logic/map_objects/tribes/building.h"
+#include "logic/map_objects/tribes/constructionsite.h"
 #include "logic/map_objects/tribes/dismantlesite.h"
 #include "logic/map_objects/tribes/tribe_descr.h"
 #include "logic/map_objects/tribes/tribes.h"
@@ -349,10 +350,15 @@
 PlayerNumber const owner,
 DescriptionIndex idx,
 bool loading,
-Building::FormerBuildings former_buildings) {
+Building::FormerBuildings former_buildings,
+const BuildingSettings* settings) {
 	Player* plr = get_player(owner);
 	const TribeDescr& tribe = plr->tribe();
-	return tribe.get_building_descr(idx)->create(*this, plr, c, true, loading, former_buildings);
+	Building& b = tribe.get_building_descr(idx)->create(*this, plr, c, true, loading, former_buildings);
+	if (settings) {
+		dynamic_cast(b).apply_settings(*settings);
+	}
+	return b;
 }
 
 /**

=== modified file 'src/logic/editor_game_base.h'
--- src/logic/editor_game_base.h	2019-02-27 19:00:36 +
+++ src/logic/editor_game_base.h	2019-05-14 17:38:23 +
@@ -56,6 +56,7 @@
 class TribeDescr;
 struct Flag;
 struct AttackController;
+struct BuildingSettings;
 
 

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

2019-05-14 Thread Benedikt Straub
This one function with this one assert yet again... yes, please provide a 
savegame
-- 
https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ferry.

___
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


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/economy-target-profiles into lp:widelands

2019-05-14 Thread Toni Förster



Diff comments:

> 
> === modified file 'src/wui/economy_options_window.cc'
> --- src/wui/economy_options_window.cc 2019-02-23 11:00:49 +
> +++ src/wui/economy_options_window.cc 2019-05-11 13:37:58 +
> @@ -186,35 +281,399 @@
>   const Widelands::Economy::TargetQuantity& tq = is_wares 
> ?
> 
> economy->ware_target_quantity(index) :
> 
> economy->worker_target_quantity(index);
> - // Don't allow negative new amount.
> - if (amount >= 0 || -amount <= 
> static_cast(tq.permanent)) {
> - if (is_wares) {
> - game.send_player_command(*new 
> Widelands::CmdSetWareTargetQuantity(
> -game.get_gametime(), 
> player_->player_number(), serial_, index,
> -tq.permanent + amount));
> + // Don't allow negative new amount
> + const int old_amount = static_cast(tq.permanent);
> + const int new_amount = std::max(0, old_amount + delta);
> + if (new_amount == old_amount) {
> + continue;
> + }
> + if (is_wares) {
> + game.send_player_command(*new 
> Widelands::CmdSetWareTargetQuantity(
> +game.get_gametime(), 
> player_->player_number(), serial_, index, new_amount));
> + } else {
> + game.send_player_command(*new 
> Widelands::CmdSetWorkerTargetQuantity(
> +game.get_gametime(), 
> player_->player_number(), serial_, index, new_amount));
> + }
> + }
> + }
> +}
> +
> +void EconomyOptionsWindow::EconomyOptionsPanel::reset_target() {
> + Widelands::Game& game = 
> dynamic_cast(player_->egbase());
> + const bool is_wares = type_ == Widelands::wwWARE;
> + const auto& items = is_wares ? player_->tribe().wares() : 
> player_->tribe().workers();
> + const PredefinedTargets settings = 
> economy_options_window_->get_selected_target();
> +
> + bool anything_selected = false;
> + bool second_phase = false;
> +
> +run_second_phase:
> + for (const Widelands::DescriptionIndex& index : items) {
> + if (display_.ware_selected(index) || (second_phase && 
> !display_.is_ware_hidden(index))) {
> + anything_selected = true;
> + if (is_wares) {
> + game.send_player_command(*new 
> Widelands::CmdSetWareTargetQuantity(
> + game.get_gametime(), 
> player_->player_number(), serial_, index, settings.wares.at(index)));
> + } else {
> + game.send_player_command(*new 
> Widelands::CmdSetWorkerTargetQuantity(
> + game.get_gametime(), 
> player_->player_number(), serial_, index, settings.workers.at(index)));
> + }
> + }
> + }
> +
> + if (!second_phase && !anything_selected) {
> + // Nothing was selected, now go through the loop again and 
> change everything
> + second_phase = true;
> + goto run_second_phase;
> + }
> +}
> +
> +constexpr unsigned kThinkInterval = 200;
> +
> +void EconomyOptionsWindow::think() {
> + const uint32_t time = player_->egbase().get_gametime();
> + if (time - time_last_thought_ < kThinkInterval || 
> !player_->get_economy(serial_)) {
> + // If our economy has been deleted, die() was already called, 
> no need to do anything
> + return;
> + }
> + time_last_thought_ = time;
> + update_profiles();
> +}
> +
> +std::string EconomyOptionsWindow::applicable_target() {
> + const Widelands::Economy* eco = player_->get_economy(serial_);
> + for (const auto& pair : predefined_targets_) {
> + bool matches = true;
> + if (tabpanel_.active() == 0) {
> + for (const Widelands::DescriptionIndex& index : 
> player_->tribe().wares()) {
> + const auto it = pair.second.wares.find(index);
> + if (it != pair.second.wares.end() && 
> eco->ware_target_quantity(index).permanent != it->second) {
> + matches = false;
> + break;
> + }
> + }
> + } else {
> + for (const Widelands::DescriptionIndex& index : 
> player_->tribe().workers()) {
> + const auto it = pair.second.workers.find(index);
> + if (it != 

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

2019-05-14 Thread Klaus Halfmann
Review: Needs Fixing

Played Calvission a #1 with a Barbarian at #2 , Imperial at #3 and Frisisan at 
#4

Got an assert aftree trying to build two woodcutters:

Forcing flag at (70, 164)
Message: adding warehouse for player 1 at (69, 163)
Forcing flag at (73, 163)
Forcing flag at (66, 165)
Forcing flag at (65, 169)
Forcing flag at (157, 27)
Message: adding warehouse for player 2 at (157, 26)
Forcing flag at (168, 141)
Message: adding warehouse for player 3 at (168, 140)
Forcing flag at (56, 45)
Message: adding warehouse for player 4 at (56, 44)
InternetGaming: Received a client list update with 18 items.
InternetGaming: Received a game list update with 1 items.
Assertion failed: (wh), function get_next_step, file 
../src/economy/transfer.cc, line 186.
Abort trap: 6



4   widelands   0x0001049b4f48 
Widelands::Transfer::get_next_step(Widelands::PlayerImmovable*, bool&) + 3320 
(transfer.cc:186)
5   widelands   0x0001049bc711 
Widelands::WareInstance::update(Widelands::Game&) + 1841 (ware_instance.cc:330)
6   widelands   0x0001048f73f4 
Widelands::Flag::add_ware(Widelands::EditorGameBase&, Widelands::WareInstance&) 
+ 1524 (flag.cc:462)
7   widelands   0x000102f0cbfd 
Widelands::Worker::dropoff_update(Widelands::Game&, Widelands::Bob::State&) + 
2381 (worker.cc:2123)
8   widelands   0x000102abc710 
Widelands::Bob::do_act(Widelands::Game&) + 704 (bob.cc:195)

Do you need a savegame?
-- 
https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ferry.

___
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/unlock-all-campaigns into lp:widelands

2019-05-14 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4968. State: errored. Details: 
https://travis-ci.org/widelands/widelands/builds/531939662.
Appveyor build 4749. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_unlock_all_campaigns-4749.
-- 
https://code.launchpad.net/~widelands-dev/widelands/unlock-all-campaigns/+merge/367371
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/unlock-all-campaigns.

___
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


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-14 Thread Toni Förster
Please test again it should address all issues. The only problem is that the 
caret does not move properly. Help is appreciated. :)

@Gun have a look at the diff comment, please.

Diff comments:

> 
> === modified file 'src/ui_fsmenu/multiplayer.cc'
> --- src/ui_fsmenu/multiplayer.cc  2019-05-11 18:50:30 +
> +++ src/ui_fsmenu/multiplayer.cc  2019-05-14 13:16:07 +
> @@ -90,37 +107,17 @@
>   */
>  void FullscreenMenuMultiPlayer::internet_login() {
>   Section& s = g_options.pull_section("global");
> - if (auto_log_) {
> - nickname_ = s.get_string("nickname", _("nobody"));
> - password_ = s.get_string("password_sha1", "nobody");
> - register_ = s.get_bool("registered", false);
> - } else {
> - LoginBox lb(*this);
> - if (lb.run() == 
> UI::Panel::Returncodes::kOk) {
> - nickname_ = lb.get_nickname();
> - /// NOTE: The password is only stored (in memory and on 
> disk) and transmitted (over the
> - /// network
> - /// to the metaserver) as cryptographic hash. This does 
> NOT mean that the password is
> - /// stored
> - /// securely on the local disk. While the password 
> should be secure while transmitted to
> - /// the
> - /// metaserver (no-one can use the transmitted data to 
> log in as the user) this is not the
> - /// case
> - /// for local storage. The stored hash of the password 
> makes it hard to look at the
> - /// configuration
> - /// file and figure out the plaintext password to, 
> e.g., log in on the forum. However, the
> - /// stored hash can be copied to another system and 
> used to log in as the user on the
> - /// metaserver.
> - // Further note: SHA-1 is considered broken and 
> shouldn't be used anymore. But since the
> - // passwords on the server are protected by SHA-1 we 
> have to use it here, too
> - password_ = crypto::sha1(lb.get_password());
> - register_ = lb.registered();
> -
> - s.set_bool("registered", lb.registered());
> - s.set_bool("auto_log", lb.set_automaticlog());
> - } else {
> - return;
> - }
> +
> + nickname_ = s.get_string("nickname", "");
> + password_ = s.get_string("password_sha1", "nobody");
> + register_ = s.get_bool("registered", false);
> +
> + // Checks can be done directly in editbox' by using valid_username().
> + // This is just to be on the safe side, in case the user changed the 
> password in the config file.
> + if (nickname_.empty() || 
> nickname_.find_first_not_of("abcdefghijklmnopqrstuvwxyz"
> + "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@.+-_") <= 
> nickname_.size()) {

As the comment says, this is just to make sure that the name is valid in case 
the user did a change the name directly in the config file. For all other 
username related checks I use valid_username(). Can this stay in?

> + show_internet_login();
> + return;
>   }
>  
>   // Try to connect to the metaserver


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start/+merge/367320
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1825932-open-games-clean-start.

___
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


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1797702-spaces-in-names-clean-start into lp:widelands

2019-05-14 Thread Toni Förster
Solved :)
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1797702-spaces-in-names-clean-start/+merge/367314
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start.

___
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


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/economy-target-profiles into lp:widelands

2019-05-14 Thread Benedikt Straub
Updated video: 
https://bugs.launchpad.net/widelands/+bug/1827696/+attachment/5263625/+files/vokoscreen-2019-05-14_14-29-18.mkv
I still get a different result by the same steps and have no idea why :(
-- 
https://code.launchpad.net/~widelands-dev/widelands/economy-target-profiles/+merge/366987
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/economy-target-profiles.

___
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/per-level-soldier-anims into lp:widelands

2019-05-14 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4966. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/531659623.
Appveyor build 4747. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_per_level_soldier_anims-4747.
-- 
https://code.launchpad.net/~widelands-dev/widelands/per-level-soldier-anims/+merge/354929
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/per-level-soldier-anims 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