[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1829623-assert_is_present into lp:widelands

2019-05-25 Thread noreply
The proposal to merge lp:~widelands-dev/widelands/bug-1829623-assert_is_present 
into lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1829623-assert_is_present/+merge/367912
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1829623-assert_is_present.

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

2019-05-25 Thread GunChleoc
GunChleoc has proposed merging lp:~widelands-dev/widelands/reed-compatibility 
into lp:widelands.

Commit message:
Fix savegame compatibility for reed, buildings, players view and economy 
requests.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/reed-compatibility/+merge/367935
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/reed-compatibility into lp:widelands.
=== modified file 'src/economy/expedition_bootstrap.cc'
--- src/economy/expedition_bootstrap.cc	2019-02-23 11:00:49 +
+++ src/economy/expedition_bootstrap.cc	2019-05-26 03:34:22 +
@@ -203,7 +203,7 @@
 }
 
 void ExpeditionBootstrap::load(
-   Warehouse& warehouse, FileRead& fr, Game& game, MapObjectLoader& mol, uint16_t packet_version) {
+   Warehouse& warehouse, FileRead& fr, Game& game, MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table, uint16_t packet_version) {
 
 	static const uint16_t kCurrentPacketVersion = 7;
 	assert(queues_.empty());
@@ -214,7 +214,7 @@
 			uint8_t num_queues = fr.unsigned_8();
 			for (uint8_t i = 0; i < num_queues; ++i) {
 WorkersQueue* wq = new WorkersQueue(warehouse, INVALID_INDEX, 0);
-wq->read(fr, game, mol);
+wq->read(fr, game, mol, tribes_lookup_table);
 wq->set_callback(input_callback, this);
 
 if (wq->get_index() == INVALID_INDEX) {
@@ -232,7 +232,7 @@
 		uint8_t num_queues = fr.unsigned_8();
 		for (uint8_t i = 0; i < num_queues; ++i) {
 			WaresQueue* wq = new WaresQueue(warehouse, INVALID_INDEX, 0);
-			wq->read(fr, game, mol);
+			wq->read(fr, game, mol, tribes_lookup_table);
 			wq->set_callback(input_callback, this);
 
 			if (wq->get_index() == INVALID_INDEX) {

=== modified file 'src/economy/expedition_bootstrap.h'
--- src/economy/expedition_bootstrap.h	2019-02-23 11:00:49 +
+++ src/economy/expedition_bootstrap.h	2019-05-26 03:34:22 +
@@ -88,7 +88,7 @@
 	 * packet, and there in the warehouse data packet.
 	 */
 	void
-	load(Warehouse& warehouse, FileRead& fr, Game& game, MapObjectLoader& mol, uint16_t version);
+	load(Warehouse& warehouse, FileRead& fr, Game& game, MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table, uint16_t version);
 
 	/** Save this into a file.
 	 *

=== modified file 'src/economy/input_queue.cc'
--- src/economy/input_queue.cc	2019-02-23 11:00:49 +
+++ src/economy/input_queue.cc	2019-05-26 03:34:22 +
@@ -130,7 +130,7 @@
 
 constexpr uint16_t kCurrentPacketVersion = 3;
 
-void InputQueue::read(FileRead& fr, Game& game, MapObjectLoader& mol) {
+void InputQueue::read(FileRead& fr, Game& game, MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table) {
 
 	uint16_t const packet_version = fr.unsigned_16();
 	try {
@@ -140,25 +140,26 @@
 		if (packet_version == 1 || packet_version == kCurrentPacketVersion) {
 			if (fr.unsigned_8() == 0) {
 assert(type_ == wwWARE);
-index_ = owner().tribe().ware_index(fr.c_string());
+index_ = owner().tribe().ware_index(tribes_lookup_table.lookup_ware(fr.c_string()));
 			} else {
 assert(type_ == wwWORKER);
-index_ = owner().tribe().worker_index(fr.c_string());
+index_ = owner().tribe().worker_index(tribes_lookup_table.lookup_worker(fr.c_string()));
 			}
 			max_size_ = fr.unsigned_32();
 			max_fill_ = fr.signed_32();
 			consume_interval_ = fr.unsigned_32();
 			if (fr.unsigned_8()) {
 request_.reset(new Request(owner_, 0, InputQueue::request_callback, type_));
-request_->read(fr, game, mol);
+request_->read(fr, game, mol, tribes_lookup_table);
 			} else {
 request_.reset();
 			}
 
 			read_child(fr, game, mol);
 		} else if (packet_version == 2) {
+			// TODO(GunChleoc): Savegame compatibility, get rid after Build 21
 			assert(type_ == wwWARE);
-			index_ = owner().tribe().ware_index(fr.c_string());
+			index_ = owner().tribe().ware_index(tribes_lookup_table.lookup_ware(fr.c_string()));
 			max_size_ = fr.unsigned_32();
 			max_fill_ = fr.signed_32();
 			// No read_child() call here, doing it manually since there is no child-version number
@@ -166,7 +167,7 @@
 			consume_interval_ = fr.unsigned_32();
 			if (fr.unsigned_8()) {
 request_.reset(new Request(owner_, 0, InputQueue::request_callback, type_));
-request_->read(fr, game, mol);
+request_->read(fr, game, mol, tribes_lookup_table);
 			} else {
 request_.reset();
 			}

=== modified file 'src/economy/input_queue.h'
--- src/economy/input_queue.h	2019-02-27 19:00:36 +
+++ src/economy/input_queue.h	2019-05-26 03:34:22 +
@@ -184,7 +184,7 @@
 	 * @param game The game this queue will be part of.
 	 * @param mol The game/map loader that handles the lading. Required to pass to Request::read().
 	 */
-	void read(FileRead& f, Game& g, MapObjectLoader& mol);
+	void read(FileRead& f, Game& g, MapObjectLoader& mol, const TribesLegacyLookupTable& tribes_lookup_table);
 
 	/**
 	 * Writes the 

[Widelands-dev] [Merge] lp:~widelands-dev/widelands/ai-rename-bo-outputs into lp:widelands

2019-05-25 Thread noreply
The proposal to merge lp:~widelands-dev/widelands/ai-rename-bo-outputs into 
lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/ai-rename-bo-outputs/+merge/367928
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ai-rename-bo-outputs.

___
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/ai-rename-bo-outputs into lp:widelands

2019-05-25 Thread GunChleoc
The input queues again

@bunnybot merge force
-- 
https://code.launchpad.net/~widelands-dev/widelands/ai-rename-bo-outputs/+merge/367928
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ai-rename-bo-outputs.

___
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-25 Thread GunChleoc
That was the BaseDropdown. The Dropdown template looks like this:

template  class Dropdown : public BaseDropdown {

...

/// Add an element to the list
/// \param name the display name of the entry
/// \param valuethe value for the entry
/// \param pic  an image to illustrate the entry. Can be 
nullptr in textual dropdowns
/// only.
/// \param select_this  whether this element should be selected
/// \param tooltip_text a tooltip for this entry
void add(const std::string& name,
 Entry value,
 const Image* pic = nullptr,
 const bool select_this = false,
 const std::string& tooltip_text = std::string()) {

"Entry value" can be any data type you like, "const std::string& name" is the 
translatable name.
-- 
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


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

2019-05-25 Thread GunChleoc
> Since Entry is the descname (right?), 

Wrong. The dropdown also comes with documentation:

/// Add an element to the list
/// \param name the display name of the entry
/// \param valuethe index of the entry
/// \param pic  an image to illustrate the entry. Can be 
nullptr for textual dropdowns.
/// \param select_this  whether this element should be selected
/// \param tooltip_text a tooltip for this entry
///
/// Text conventions: Title Case for the 'name', Sentence case for the 
'tooltip_text'
void add(const std::string& name,
 uint32_t value,
 const Image* pic = nullptr,
 const bool select_this = false,
 const std::string& tooltip_text = std::string());

So, the translatable element is:

/// \param name the display name of the entry

-- 
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/list-directories-in-cpp into lp:widelands

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

Travis build 5043. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/537115107.
Appveyor build 4823. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_list_directories_in_cpp-4823.
-- 
https://code.launchpad.net/~widelands-dev/widelands/list-directories-in-cpp/+merge/366614
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/list-directories-in-cpp.

___
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/list-directories-in-cpp into lp:widelands

2019-05-25 Thread bunnybot
Refusing to merge, since Travis is not green. Use @bunnybot merge force for 
merging anyways.

Travis build 5043. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/537115107.
-- 
https://code.launchpad.net/~widelands-dev/widelands/list-directories-in-cpp/+merge/366614
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/list-directories-in-cpp.

___
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/choose-attack-soldiers into lp:widelands

2019-05-25 Thread noreply
The proposal to merge lp:~widelands-dev/widelands/choose-attack-soldiers into 
lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/choose-attack-soldiers/+merge/367471
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/choose-attack-soldiers.

___
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/choose-attack-soldiers into lp:widelands

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

Travis build 5041. State: passed. Details: 
https://travis-ci.org/widelands/widelands/builds/537114220.
Appveyor build 4821. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_choose_attack_soldiers-4821.
-- 
https://code.launchpad.net/~widelands-dev/widelands/choose-attack-soldiers/+merge/367471
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/choose-attack-soldiers.

___
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-25 Thread Benedikt Straub
Ware stats menu fixed. It is already too large in trunk, but I made it shorter 
now.

We still need knowledge of the phase we´re in during the loop so we can know 
whether to change the target for all wares or only for the selected. Since 
anything_selected may change during the loop, we need two variables here.

The Dropdown implementation specifies:

template  class Dropdown : public BaseDropdown {
  void add(const std::string& name,
   Entry value, …);
  void select(const Entry& entry);
  const Entry& get_selected() const;
  …
}

(With Entry = std::string here.) Since Entry is the descname (right?), this 
looks as if the selection is handled by descname rather than internal name…
-- 
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/ai-rename-bo-outputs into lp:widelands

2019-05-25 Thread bunnybot
Refusing to merge, since Travis is not green. Use @bunnybot merge force for 
merging anyways.

Travis build 5040. State: errored. Details: 
https://travis-ci.org/widelands/widelands/builds/537114075.
-- 
https://code.launchpad.net/~widelands-dev/widelands/ai-rename-bo-outputs/+merge/367928
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ai-rename-bo-outputs.

___
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/ai-rename-bo-outputs into lp:widelands

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

Travis build 5040. State: errored. Details: 
https://travis-ci.org/widelands/widelands/builds/537114075.
Appveyor build 4820. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_ai_rename_bo_outputs-4820.
-- 
https://code.launchpad.net/~widelands-dev/widelands/ai-rename-bo-outputs/+merge/367928
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ai-rename-bo-outputs.

___
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-25 Thread GunChleoc
You can now get rid of the second_phase variable entirely. Just check for 
!anything_selected at the end of the loop, then you can also get rid of

if (anything_selected) {
return;
}


Confirmed that the layouting is fixed. The ware statistics doesn't fit yet at 
800x600 resolution, can you give it 1 less row for that?

Also added 1 comment.

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-16 17:28:26 +
> @@ -186,35 +281,402 @@
>   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) {
> + 

Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ai-rename-bo-outputs into lp:widelands

2019-05-25 Thread GunChleoc
Thanks!

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/ai-rename-bo-outputs/+merge/367928
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ai-rename-bo-outputs.

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

2019-05-25 Thread GunChleoc
Review: Approve

I have done some testing and it seems to work fine. I am not getting the double 
free you mentioned.

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/refactor_gameclient/+merge/366743
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/refactor_gameclient.

___
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/wrong-password-message into lp:widelands

2019-05-25 Thread noreply
The proposal to merge lp:~widelands-dev/widelands/wrong-password-message into 
lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/wrong-password-message/+merge/367929
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/wrong-password-message.

___
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/wrong-password-message into lp:widelands

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

Travis build 5039. State: passed. Details: 
https://travis-ci.org/widelands/widelands/builds/537113797.
Appveyor build 4819. State: failed. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_wrong_password_message-4819.
-- 
https://code.launchpad.net/~widelands-dev/widelands/wrong-password-message/+merge/367929
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/wrong-password-message.

___
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-25 Thread Benedikt Straub
Layouting fixed. Ware statistics now sets a hgap as well
-- 
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


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ai-rename-bo-outputs into lp:widelands

2019-05-25 Thread hessenfarmer
Review: Approve

checked if all instances are caught. 
LGTM ;-)


-- 
https://code.launchpad.net/~widelands-dev/widelands/ai-rename-bo-outputs/+merge/367928
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ai-rename-bo-outputs.

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

2019-05-25 Thread GunChleoc
OK, let's leave the design as it is :)

This doesn't compile:

ow.cc.o -c ../src/wui/dismantlesitewindow.cc
In file included from ../src/wui/dismantlesitewindow.h:25:0,
 from ../src/wui/dismantlesitewindow.cc:20:
../src/wui/buildingwindow.h: In member function ‘void 
BuildingWindow::set_building_descr_for_help(const Widelands::BuildingDescr&)’:
../src/wui/buildingwindow.h:99:30: error: ‘void 
Widelands::BuildingDescr::operator=(const Widelands::BuildingDescr&)’ is 
private within this context
   building_descr_for_help_ = d;
  ^

Once that has been fixed, we still need to look at the code.
-- 
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-1829623-assert_is_present into lp:widelands

2019-05-25 Thread GunChleoc
Review: Approve

This fixed it, thanks!

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1829623-assert_is_present/+merge/367912
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1829623-assert_is_present.

___
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-25 Thread Benedikt Straub
Implemented or replied to the diff comments.

The ASan error is in trunk and can happen everywhere there are dropdowns. For 
example, when I´m thrown back to the main menu by an error from a fsmenu screen 
that has one I already got this crash. It can appear whenever destroying a 
window that contains a dropdown on a lower level. Happens very rarely though, 
so I did not report it…

> In the ware statistics, the bottom slider and text are cut off.
> In the economy window, we get wide gaps between the columns and some extra 
> space on the left and right of the button rows.
They probably do not layout properly yet… will look into it

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-16 17:28:26 +
> @@ -186,35 +281,402 @@
>   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()) {
> + 

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

2019-05-25 Thread Benedikt Straub
> "Launch expedition" should be "Start an expedition" like on the button for 
> the finished port.
> The target of the help button does not get updated when enhancing, e.g. 
> construction site for deeper coal mine will show the coal mine instead.
> ASan

Should all be fixed now

> It would be nice if the tab was remembered after using the "enhance" button.

This is exactly the same as bug 1818857 so it should be fixed independent from 
this branch. There will likely be one catch-all fix for both flavours of the 
bug.

> It would be nice if the extra options like "Start an expedition" or "Stop" 
> would have the same UI buttons as the finished sites. I can live with the 
> checkboxes though.

What I could do is to render the appropriate icon next to the checkbox if you 
like. But unless we change the other UI elements in such a way that they show 
clearly what the current state is, there is no alternative to the checkboxes 
IMHO, since the current icons are only acceptable because one can see the 
active state elsewhere (stats string / expedition tab), which can not happen 
here.
-- 
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-1829623-assert_is_present into lp:widelands

2019-05-25 Thread Benedikt Straub
Review: Resubmit

Found and fixed another potential source of asserts and/or segfaults. And it 
appears the the assert cannot be guaranteed in certain cornercases.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1829623-assert_is_present/+merge/367912
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1829623-assert_is_present.

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

2019-05-25 Thread GunChleoc
We are merging a lot of branches today, so maybe do the merging tomorrow and 
ping me so I'll take over and have a look?
-- 
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/refactor_gameclient into lp:widelands

2019-05-25 Thread GunChleoc
Sorry, your recent changes slipped me by. Thanks for the reminder, I will do 
another review & testing.
-- 
https://code.launchpad.net/~widelands-dev/widelands/refactor_gameclient/+merge/366743
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/refactor_gameclient.

___
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/list-directories-in-cpp into lp:widelands

2019-05-25 Thread GunChleoc
Thanks a lot for the review and testing :)

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/list-directories-in-cpp/+merge/366614
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/list-directories-in-cpp.

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

2019-05-25 Thread GunChleoc
Also, this:

=
==6265==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2744 byte(s) in 49 object(s) allocated from:
#0 0x7ff86f576458 in operator new(unsigned long) 
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
#1 0x55643637edfd in Widelands::MilitarySite::create_building_settings() 
const ../src/logic/map_objects/tribes/militarysite.cc:978
#2 0x556435cb4c9b in 
Widelands::Player::enhance_or_dismantle(Widelands::Building*, unsigned char) 
../src/logic/player.cc:763
#3 0x556435cb47a3 in 
Widelands::Player::dismantle_building(Widelands::Building*) 
../src/logic/player.cc:743
#4 0x5564366afc07 in 
Widelands::CmdDismantleBuilding::execute(Widelands::Game&) 
../src/logic/playercommand.cc:701
#5 0x5564366a690e in Widelands::CmdQueue::run_queue(int, unsigned int&) 
../src/logic/cmd_queue.cc:122
#6 0x556435c8be44 in Widelands::Game::think() ../src/logic/game.cc:599
#7 0x55643605fe76 in InteractiveBase::think() 
../src/wui/interactive_base.cc:475
#8 0x5564360b3bde in InteractivePlayer::think() 
../src/wui/interactive_player.cc:228
#9 0x556435eec265 in UI::Panel::do_think() ../src/ui_basic/panel.cc:483
#10 0x556435ee95ca in UI::Panel::do_run() ../src/ui_basic/panel.cc:184
#11 0x556435983b5d in UI::Panel::Returncodes 
UI::Panel::run() ../src/ui_basic/panel.h:104
#12 0x556435c8b669 in Widelands::Game::run(UI::ProgressWindow*, 
Widelands::Game::StartGameType, std::__cxx11::basic_string, std::allocator > const&, bool, 
std::__cxx11::basic_string, std::allocator > 
const&) ../src/logic/game.cc:569
#13 0x55643596f976 in WLApplication::new_game() ../src/wlapplication.cc:1354
#14 0x55643596da4a in WLApplication::mainmenu_singleplayer() 
../src/wlapplication.cc:1208
#15 0x55643596cb95 in WLApplication::mainmenu() ../src/wlapplication.cc:1114
#16 0x556435963b7b in WLApplication::run() ../src/wlapplication.cc:470
#17 0x55643595f8ce in main ../src/main.cc:44
#18 0x7ff86c9a9b96 in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

-- 
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


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

2019-05-25 Thread noreply
The proposal to merge 
lp:~widelands-dev/widelands/bug-1797702-spaces-in-names-clean-start into 
lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
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/constructionsite_options into lp:widelands

2019-05-25 Thread GunChleoc
It would be nice if the tab was remembered after using the "enhance" button.

The target of the help button does not get updated when enhancing, e.g. 
construction site for deeper coal mine will show the coal mine instead.

"Launch expedition" should be "Start an expedition" like on the button for the 
finished port.

It would be nice if the extra options like "Start an expedition" or "Stop" 
would have the same UI buttons as the finished sites. I can live with the 
checkboxes though.
-- 
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


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/tribe-immovable-file-structure into lp:widelands

2019-05-25 Thread noreply
The proposal to merge 
lp:~widelands-dev/widelands/tribe-immovable-file-structure into lp:widelands 
has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/tribe-immovable-file-structure/+merge/367611
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/tribe-immovable-file-structure.

___
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-25 Thread GunChleoc
Also:


==6158==ERROR: AddressSanitizer: heap-use-after-free on address 0x6183eda0 
at pc 0x55fbbb8f1299 bp 0x7ffc346f2020 sp 0x7ffc346f2010
READ of size 8 at 0x6183eda0 thread T0
#0 0x55fbbb8f1298 in std::_Deque_iterator::_Deque_iterator(std::_Deque_iterator const&) 
/usr/include/c++/7/bits/stl_deque.h:152
#1 0x55fbbb8f1232 in std::deque >::begin() 
/usr/include/c++/7/bits/stl_deque.h:1167
#2 0x55fbbb8ea1a3 in UI::BaseListselect::clear() 
../src/ui_basic/listselect.cc:95
#3 0x55fbbb8cf6fc in UI::BaseDropdown::~BaseDropdown() 
../src/ui_basic/dropdown.cc:151
#4 0x55fbbb52cb26 in UI::Dropdown, std::allocator > >::~Dropdown() 
../src/ui_basic/dropdown.h:224
#5 0x55fbbc30e0ec in EconomyOptionsWindow::~EconomyOptionsWindow() 
../src/wui/economy_options_window.cc:126
#6 0x55fbbc30e17f in EconomyOptionsWindow::~EconomyOptionsWindow() 
../src/wui/economy_options_window.cc:134
#7 0x55fbbb910d1d in UI::Panel::free_children() ../src/ui_basic/panel.cc:128
#8 0x55fbbb9108ce in UI::Panel::~Panel() ../src/ui_basic/panel.cc:100
#9 0x55fbbba82826 in InteractiveBase::~InteractiveBase() 
../src/wui/interactive_base.cc:189
#10 0x55fbbbae54c1 in InteractiveGameBase::~InteractiveGameBase() 
../src/wui/interactive_gamebase.h:58
#11 0x55fbbbaea715 in InteractivePlayer::~InteractivePlayer() 
../src/wui/interactive_player.h:38
#12 0x55fbbbaea73d in InteractivePlayer::~InteractivePlayer() 
../src/wui/interactive_player.h:38
#13 0x55fbbb6a9884 in 
std::default_delete::operator()(InteractiveBase*) const 
(economy-target-profiles/widelands+0x1150884)
#14 0x55fbbb6a817e in std::unique_ptr >::reset(InteractiveBase*) 
/usr/include/c++/7/bits/unique_ptr.h:376
#15 0x55fbbb69d8f8 in 
Widelands::EditorGameBase::set_ibase(InteractiveBase*) 
../src/logic/editor_game_base.cc:222
#16 0x55fbbb6b7242 in Widelands::Game::run(UI::ProgressWindow*, 
Widelands::Game::StartGameType, std::__cxx11::basic_string, std::allocator > const&, bool, 
std::__cxx11::basic_string, std::allocator > 
const&) ../src/logic/game.cc:576
#17 0x55fbbb39b1a0 in WLApplication::new_game() ../src/wlapplication.cc:1350
#18 0x55fbbb399280 in WLApplication::mainmenu_singleplayer() 
../src/wlapplication.cc:1204
#19 0x55fbbb3983cb in WLApplication::mainmenu() ../src/wlapplication.cc:1110
#20 0x55fbbb38f3b1 in WLApplication::run() ../src/wlapplication.cc:466
#21 0x55fbbb38b14e in main ../src/main.cc:44
#22 0x7f3374bb0b96 in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#23 0x55fbbb38afc9 in _start (economy-target-profiles/widelands+0xe31fc9)

-- 
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


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

2019-05-25 Thread GunChleoc
I have just tested the relayouting when fullscreen switching. It works well for 
warehouses and the stock statistics.

In the ware statistics, the bottom slider and text are cut off.
In the economy window, we get wide gaps between the columns and some extra 
space on the left and right of the button rows.
-- 
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


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/list-directories-in-cpp into lp:widelands

2019-05-25 Thread Toni Förster
Review: Approve

LGTM :)
-- 
https://code.launchpad.net/~widelands-dev/widelands/list-directories-in-cpp/+merge/366614
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/list-directories-in-cpp.

___
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-25 Thread GunChleoc
Review: Needs Fixing

This will break once translations come in.

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-16 17:28:26 +
> @@ -186,35 +281,402 @@
>   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;

You can use a do... while instead and get rid of the goto.

https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf

> + }
> +}
> +
> +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 

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

2019-05-25 Thread Toni Förster
Since the parent branch has been merged, this can go in as well.

@bunnybot merge
-- 
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/choose-attack-soldiers into lp:widelands

2019-05-25 Thread GunChleoc
Review: Approve

Perfect :)

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/choose-attack-soldiers/+merge/367471
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/choose-attack-soldiers.

___
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/tribe-immovable-file-structure into lp:widelands

2019-05-25 Thread GunChleoc
Thanks for the review :)

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/tribe-immovable-file-structure/+merge/367611
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/tribe-immovable-file-structure.

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

2019-05-25 Thread GunChleoc
Thanks a lot for the review!

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/font_size-lua/+merge/366938
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/font_size-lua.

___
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/choose-attack-soldiers into lp:widelands

2019-05-25 Thread Benedikt Straub
Review: Resubmit

A tooltip it is :)
-- 
https://code.launchpad.net/~widelands-dev/widelands/choose-attack-soldiers/+merge/367471
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/choose-attack-soldiers.

___
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/wrong-password-message into lp:widelands

2019-05-25 Thread GunChleoc
Thanks!

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/wrong-password-message/+merge/367929
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/wrong-password-message.

___
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/list-directories-in-cpp into lp:widelands

2019-05-25 Thread GunChleoc
> the output stops for a while. On each load of the save game the stop-time is 
> different, one time the stop lasts longer, the other time it lasts shorter 
> (but noticeable).

It stops because Widelands is loading more stuff for starting the game that 
isn't producing log outputs. This has nothing to do with this branch.

The ALSA error also has nothing to do with Widelands code, but we could try 
reencoding the affected sound file(s). I have removed the extra log output from 
this branch though, so this needs to be tested and fixed in a separate branch 
by somebody who can reproduce it. I have opened a new bug report for this:

https://bugs.launchpad.net/widelands/+bug/1830467

> The merge conflict needs fixing.

Of course it does - done :)

> Also this is not part of this branch but maybe can be foxed here.

Done.
-- 
https://code.launchpad.net/~widelands-dev/widelands/list-directories-in-cpp/+merge/366614
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/list-directories-in-cpp.

___
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/wrong-password-message into lp:widelands

2019-05-25 Thread Toni Förster
Review: Approve


-- 
https://code.launchpad.net/~widelands-dev/widelands/wrong-password-message/+merge/367929
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/wrong-password-message.

___
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/wrong-password-message into lp:widelands

2019-05-25 Thread GunChleoc
GunChleoc has proposed merging 
lp:~widelands-dev/widelands/wrong-password-message into lp:widelands.

Commit message:
Improved message for "wrong password"

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/wrong-password-message/+merge/367929

The player does not care about the technical detail that it has been "sent", 
and the new phrasing that I chose is more common.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/wrong-password-message into lp:widelands.
=== modified file 'src/network/internet_gaming_messages.cc'
--- src/network/internet_gaming_messages.cc	2019-02-23 11:00:49 +
+++ src/network/internet_gaming_messages.cc	2019-05-25 08:30:43 +
@@ -42,7 +42,7 @@
 	// clients.
 	igmessages["NO_SUCH_USER"] = _("There is no user with this name logged in.");
 	igmessages["NO_SUCH_GAME"] = _("The game no longer exists, maybe it has just been closed.");
-	igmessages["WRONG_PASSWORD"] = _("The sent password was incorrect!");
+	igmessages["WRONG_PASSWORD"] = _("Wrong password, please try again.");
 	igmessages["UNSUPPORTED_PROTOCOL"] = _("The protocol version you are using is not supported!");
 	igmessages["ALREADY_LOGGED_IN"] = _("You are already logged in!");
 	igmessages["DEFICIENT_PERMISSION"] =

___
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/ai-rename-bo-outputs into lp:widelands

2019-05-25 Thread GunChleoc
GunChleoc has proposed merging lp:~widelands-dev/widelands/ai-rename-bo-outputs 
into lp:widelands.

Commit message:
Rename BuildingObserver::outputs to BuildingObserver::ware_outputs

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/ai-rename-bo-outputs/+merge/367928

The variable name has already confused at least 2 people, so I decided to 
change it.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/ai-rename-bo-outputs into lp:widelands.
=== modified file 'src/ai/ai_help_structs.h'
--- src/ai/ai_help_structs.h	2019-05-18 13:04:13 +
+++ src/ai/ai_help_structs.h	2019-05-25 08:29:16 +
@@ -462,7 +462,7 @@
 	uint32_t basic_amount;  // basic amount for basic economy as defined in init.lua
 
 	std::vector inputs;
-	std::vector outputs;
+	std::vector ware_outputs;
 	std::vector positions;
 	std::vector critical_building_material;
 

=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc	2019-05-22 11:23:14 +
+++ src/ai/defaultai.cc	2019-05-25 08:29:16 +
@@ -681,7 +681,7 @@
 bo.inputs.push_back(temp_input.first);
 			}
 			for (const DescriptionIndex& temp_output : prod.output_ware_types()) {
-bo.outputs.push_back(temp_output);
+bo.ware_outputs.push_back(temp_output);
 			}
 
 			// Read information about worker outputs
@@ -698,7 +698,7 @@
 		}
 	}
 }
-if (!bo.is(BuildingAttribute::kBarracks) && bo.outputs.empty()) {
+if (!bo.is(BuildingAttribute::kBarracks) && bo.ware_outputs.empty()) {
 	bo.set_is(BuildingAttribute::kRecruitment);
 }
 			}
@@ -708,7 +708,7 @@
 			}
 
 			// If this is a producer, does it act also as supporter?
-			if (!bo.outputs.empty() && !bo.production_hints.empty()) {
+			if (!bo.ware_outputs.empty() && !bo.production_hints.empty()) {
 bo.set_is(BuildingAttribute::kSupportingProducer);
 			}
 
@@ -728,7 +728,7 @@
 	mines_per_type[bo.mines] = MineTypesObserver();
 }
 // Identify iron mines based on output
-if (bo.outputs[0] == tribe_->ironore()) {
+if (bo.ware_outputs[0] == tribe_->ironore()) {
 	bo.set_is(BuildingAttribute::kIronMine);
 	mines_per_type[bo.mines].is_critical = true;
 	mine_fields_stat.add_critical_ore(bo.mines);
@@ -739,7 +739,7 @@
 bo.set_is(BuildingAttribute::kShipyard);
 			}
 			// Identify refined log producer
-			if (bo.outputs.size() == 1 && bo.outputs[0] == tribe_->refinedlog()) {
+			if (bo.ware_outputs.size() == 1 && bo.ware_outputs[0] == tribe_->refinedlog()) {
 bo.set_is(BuildingAttribute::kLogRefiner);
 			}
 
@@ -758,7 +758,7 @@
 // now testing outputs of current building
 // and comparing
 bo.set_is(BuildingAttribute::kUpgradeSubstitutes);
-for (DescriptionIndex ware : bo.outputs) {
+for (DescriptionIndex ware : bo.ware_outputs) {
 	if (enh_outputs.count(ware) == 0) {
 		bo.unset_is(BuildingAttribute::kUpgradeSubstitutes);
 		break;
@@ -767,7 +767,7 @@
 
 std::unordered_set cur_outputs;
 // collecting wares that are produced in enhanced building
-for (const DescriptionIndex& ware : bo.outputs) {
+for (const DescriptionIndex& ware : bo.ware_outputs) {
 	cur_outputs.insert(ware);
 }
 // Does upgraded building produce any different outputs?
@@ -780,7 +780,7 @@
 			}
 
 			// now we identify producers of critical build materials
-			for (DescriptionIndex ware : bo.outputs) {
+			for (DescriptionIndex ware : bo.ware_outputs) {
 // building material except for trivial material
 if (tribe_->is_construction_material(ware) &&
 !(ware == tribe_->rawlog() || ware == tribe_->granite())) {
@@ -2512,7 +2512,7 @@
 			bo.new_building == BuildingNecessity::kForced ||
 			bo.new_building == BuildingNecessity::kAllowed ||
 			bo.new_building == BuildingNecessity::kNeededPending) &&
-			   (!bo.outputs.empty() ||
+			   (!bo.ware_outputs.empty() ||
 			bo.initial_preciousness >
 			   0)) {  // bo.initial_preciousness signals that we have a worker output
 bo.max_needed_preciousness =
@@ -2672,7 +2672,7 @@
 // Some productionsites strictly require supporting sites nearby
 if (bo.requires_supporters) {
 	uint16_t supporters_nearby = 0;
-	for (auto output : bo.outputs) {
+	for (auto output : bo.ware_outputs) {
 		supporters_nearby += bf->supporters_nearby.at(output);
 	}
 	if (supporters_nearby == 0) {
@@ -3067,7 +3067,7 @@
 		   (40 - current_stocklevel) / 2, kAbsValue);
 	}
 	// This considers supporters nearby
-	for (auto ph : bo.outputs) {
+	for (auto ph : bo.ware_outputs) {
 		prio += management_data.neuron_pool[52].get_result_safe(
 		   bf->supporters_nearby.at(ph) * 5, kAbsValue) /
 		2;
@@ -3089,8 +3089,8 @@
 	// +1 if any consumers_ are nearby
 	consumers_nearby_count = 

[Widelands-dev] [Merge] lp:~widelands-dev/widelands/ai-rename-bo-outputs into lp:widelands

2019-05-25 Thread GunChleoc
The proposal to merge lp:~widelands-dev/widelands/ai-rename-bo-outputs into 
lp:widelands has been updated.

Description changed to:

The variable name has already confused at least 2 people, so I decided to 
change it.

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/ai-rename-bo-outputs/+merge/367928
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/ai-rename-bo-outputs 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-1827786-metaserver-login-box-clean-start into lp:widelands

2019-05-25 Thread noreply
The proposal to merge 
lp:~widelands-dev/widelands/bug-1827786-metaserver-login-box-clean-start into 
lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
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/choose-attack-soldiers into lp:widelands

2019-05-25 Thread GunChleoc
I think the last idea is the best one :)
-- 
https://code.launchpad.net/~widelands-dev/widelands/choose-attack-soldiers/+merge/367471
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/choose-attack-soldiers.

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

2019-05-25 Thread Klaus Halfmann
Now why can we nort merge this one?
-- 
https://code.launchpad.net/~widelands-dev/widelands/refactor_gameclient/+merge/366743
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/refactor_gameclient.

___
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-25 Thread GunChleoc
Review: Approve

@bunnybot merge
-- 
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-25 Thread GunChleoc
Code LGTM.

One tweak I'd like to see after testing:

Error message "The sent password was incorrect!" - call it "Wrong password" or 
"Wrong password, please try again." The user doesn't care about the technical 
detail that it was sent. This is coming from the metaserver, so I have opened a 
but over there. https://github.com/widelands/widelands_metaserver/issues/53


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

2019-05-25 Thread GunChleoc
Review: Approve

I agree that we should go through the formal process here, just to make sure 
that no extra changes have been accidentally committed and to have bunnybot 
build it.
-- 
https://code.launchpad.net/~widelands-dev/widelands/ai_new_wai_files_21052019/+merge/367709
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ai_new_wai_files_21052019.

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

2019-05-25 Thread GunChleoc
I think skipped should be ignored in the UI, but the AI should be able to know 
whether a program has been skipped a lot recently, because that means that a 
new building is not needed.
-- 
https://code.launchpad.net/~widelands-dev/widelands/ai_productionsites_statistics/+merge/367613
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/ai_productionsites_statistics.

___
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-1829623-assert_is_present into lp:widelands

2019-05-25 Thread GunChleoc
Review: Needs Fixing

I retested with the savegame attached to the bug and this does not fix the 
problem
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1829623-assert_is_present/+merge/367912
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1829623-assert_is_present.

___
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-1829623-assert_is_present into lp:widelands

2019-05-25 Thread GunChleoc
Review: Approve

Code LTGM.

I think we should replace "deserted" with "has left the building", because he 
has not fled the tribe.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1829623-assert_is_present/+merge/367912
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1829623-assert_is_present.

___
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