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

2019-08-10 Thread Klaus Halfmann
Thanks for picking this up, as I am just teesting some new Mpa with
a lot of Ports, I can combine two things here. I dont have that much 
time the next weeks, though.
-- 
https://code.launchpad.net/~widelands-dev/widelands/new-shipping/+merge/371155
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/new-shipping 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/new-shipping into lp:widelands

2019-08-10 Thread bunnybot
Continuous integration builds have changed state:

Travis build 5309. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/570269198.
Appveyor build 5082. State: failed. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_new_shipping-5082.
-- 
https://code.launchpad.net/~widelands-dev/widelands/new-shipping/+merge/371155
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/new-shipping 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-website/pybb_attachments into lp:widelands-website

2019-08-10 Thread kaputtnik
> Other extensions that we're using for Widelands & that might be interesting:

> .wai - AI
Ok

> .wmf - Map

I forgot to mention: If the extension is wmf, an errormessage is shown: "This 
seems to be a widelands map file. Please upload it at our maps section."

> .wrpl - Replay - useless with the accompanying .wgf though.

I am planning to make a wikipage describing, beside other things, the usage of 
replays, e.g. they have to be zipped together before uploading and link that 
wikipage in the upload form. But i have to check for .wrpl.wgf.
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/pybb_attachments/+merge/370342
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands-website/pybb_attachments into lp:widelands-website.

___
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/toolbar-dropdown-scripting-review-only into lp:widelands

2019-08-10 Thread GunChleoc
I think it's just Launchpad or Bunnybot getting confused because of the 
unmerged prerequisite in their messages. The code in trunk is fine - the new UI 
test got added. which means that the correct branch was merged.

clang-format separated some translators' comments from their strings though, so 
I'll have to fix trunk for that.
-- 
https://code.launchpad.net/~widelands-dev/widelands/toolbar-dropdown-scripting-review-only/+merge/368228
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/toolbar-dropdown-scripting-review-only 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/toolbar-dropdown-scripting-review-only into lp:widelands

2019-08-10 Thread Klaus Halfmann
Gun: now this got merged, what kind of accident was this?
-- 
https://code.launchpad.net/~widelands-dev/widelands/toolbar-dropdown-scripting-review-only/+merge/368228
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/toolbar-dropdown-scripting-review-only 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/toolbar-dropdown-menus into lp:widelands

2019-08-10 Thread noreply
The proposal to merge lp:~widelands-dev/widelands/toolbar-dropdown-menus into 
lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/toolbar-dropdown-menus/+merge/368230
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/toolbar-dropdown-scripting-review-only.

___
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/toolbar-dropdown-scripting-review-only into lp:widelands

2019-08-10 Thread noreply
The proposal to merge 
lp:~widelands-dev/widelands/toolbar-dropdown-scripting-review-only into 
lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/toolbar-dropdown-scripting-review-only/+merge/368228
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/toolbar-dropdown-scripting-review-only 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/toolbar-dropdown-menus into lp:widelands

2019-08-10 Thread bunnybot
Continuous integration builds have changed state:

Travis build 5306. State: passed. Details: 
https://travis-ci.org/widelands/widelands/builds/570176875.
Appveyor build 5079. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_toolbar_dropdown_menus-5079.
-- 
https://code.launchpad.net/~widelands-dev/widelands/toolbar-dropdown-menus/+merge/368230
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/toolbar-dropdown-scripting-review-only.

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

2019-08-10 Thread GunChleoc
2. I have no opinion on this at this time. Maybe 10 or 20? We can easily change 
the value if it becomes a problem.

> Files without extension aren't allowed (can be problematic e.g. with the 
> campvis file)

campvis will be replaced by campaigns.conf for the next version, so don't worry 
about it - we can allow .conf

Other extensions that we're using for Widelands & that might be interesting:

.wai  - AI
.wmf  - Map
.wrpl - Replay - useless with the accompanying .wgf though.

> Do we need a check for each allowed extension?

Since attachments are marked for download anyway, I'd say that checking for 
those that are easily checked will do for now.
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/pybb_attachments/+merge/370342
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands-website/pybb_attachments into lp:widelands-website.

___
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/toolbar-dropdown-menus into lp:widelands

2019-08-10 Thread GunChleoc
The reason that the test failed was because there is a UI test that depends on 
"buildhelp" to be a button, which is a menu entry now. I have changed it to use 
"help" instead, which is the button for opening the Encyclopedia.

The second failure was that in debug builds, the main menu has 1 additional 
entry on top (the Lua console). So, I am now counting he entries in the test to 
decide which is the correct item index.
-- 
https://code.launchpad.net/~widelands-dev/widelands/toolbar-dropdown-menus/+merge/368230
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/toolbar-dropdown-scripting-review-only.

___
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/toolbar-dropdown-menus into lp:widelands

2019-08-10 Thread Klaus Halfmann
Review: Approve comile, regression test

Fine onn OSX now, too (release build)

> Ran 45 tests in 1128.847s
> OK

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/toolbar-dropdown-menus/+merge/368230
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/toolbar-dropdown-scripting-review-only.

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

2019-08-10 Thread kaputtnik
I am a bit lost here...

Some checks are made now, but i am unsure if we need them all. What is 
implemented:

1. Link of Attachment:
If a user clicks on a link of an attachment, he will be ever prompted for a 
download (or to open the file with an associated program), even if it is a file 
which the browser may can display, e.g. an image (png, jpg) or text file. This 
is not optimal, but i think it is more secure.

2. Restricting upload permission
A user has only permission to upload files, if he has had written 5 posts 
prior. The number of 5 derives from MAX_HIDDEN_POST at the moment, but i think 
it's better to have an own value for this. What number do we want?

3. Allowed extensions:
Added a list:
ALLOWED_EXTENSIONS = ['wgf', 'jpg', 'jpeg', 'gif', 'png', 'ogg', 'lua', 'ods', 
'zip', 'json', 'txt', 'csv']
I am unsure if this list will be ever complete. E.g. some may want to upload 
some other types of files (e.g. py, odg, doc, ...)

4. Extension handling:
- Files without extension aren't allowed (can be problematic e.g. with the 
campvis file)
- For 'wgf' files: Check if some base entries can be found (e.g. '/binary/' or 
'/minimap.png')
- For image files: Check if this is really an image using the Pillow library. 
This finds corrupted .png but not corrupted .jpg
Do we need a check for each allowed extension?

5. Comparing Mime-Types:
When uploading a file, a Mime-Type (content-type) is also submitted. The 
submitted mime-type is mostly derived from the extension of the file. E.g. if 
you rename a file from 'image.png' to 'image.txt' the OS (or browser) sends the 
Mime-type 'text/plain', which is obviously wrong. To prevent such mime-type 
mismatch, a check is made which compares the sent mime-type with the mime-type 
derived from python-magic. e.g. python magic will show for 'image.txt' the 
mime-type 'image/png'.

As said, i am a bit lost, not really knowing if we need all this checks, or if 
they are enough at all :-S Any opinions?
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/pybb_attachments/+merge/370342
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands-website/pybb_attachments into lp:widelands-website.

___
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/toolbar-dropdown-menus into lp:widelands

2019-08-10 Thread Klaus Halfmann
Review: Approve compile,  regression test

Ahh, now you confused me :-)

Just tried on Linux
> Linux iXubuntu 5.0.0-23-generic #24-Ubuntu SMP Mon Jul 29 15:36:44 UTC 2019 
> x86_64 x86_64 x86_64 GNU/Linux

and suprise: al Regreession tests pass on this branch and trunk with release 
and debug 

OK Ill go back to OSX and try again

-- 
https://code.launchpad.net/~widelands-dev/widelands/toolbar-dropdown-menus/+merge/368230
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/toolbar-dropdown-scripting-review-only.

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

2019-08-10 Thread Benedikt Straub
Benedikt Straub has proposed merging lp:~widelands-dev/widelands/new-shipping 
into lp:widelands.

Commit message:
New planning-ahead ship scheduling algorithm

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1827033 in widelands: "Bugs in new ShipScheduling algorithm"
  https://bugs.launchpad.net/widelands/+bug/1827033

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/new-shipping/+merge/371155

This algorithm uses a new approach. Each ship has a sorted list of the ports 
it´s planning to visit next. When new wares are loaded or some port requires a 
ship, the destinations may be reordered to accommodate for the importance of 
the several destinations (which depends on distance and number of wares). Ports 
whose visit is often postponed increase in priority so single wares won´t be 
sailing around forever if more important orders keep dropping in. Ports that 
can be visited on-the-fly (only a small detour) between two more important 
ports are also preferred. Ships may also be called back if a new ware arrives 
at the port immediately after the ship has left.

I hacked together some savegame compatibility; however, due to the linked bug, 
trunk savegames may show irrational behaviour.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/new-shipping into lp:widelands.
=== modified file 'src/economy/fleet.cc'
--- src/economy/fleet.cc	2019-04-24 15:11:23 +
+++ src/economy/fleet.cc	2019-08-10 09:34:44 +
@@ -336,7 +336,7 @@
 uint32_t Fleet::count_ships_heading_here(EditorGameBase& egbase, PortDock* port) const {
 	uint32_t ships_on_way = 0;
 	for (uint16_t s = 0; s < ships_.size(); s += 1) {
-		if (ships_[s]->get_destination(egbase) == port) {
+		if (ships_[s]->get_current_destination(egbase) == port) {
 			ships_on_way += 1;
 		}
 	}
@@ -400,8 +400,8 @@
 	if (upcast(Game, game, ))
 		ship->set_economy(*game, nullptr);
 
-	if (ship->get_destination(egbase)) {
-		ship->get_destination(egbase)->ship_coming(false);
+	if (ship->get_current_destination(egbase)) {
+		ship->get_current_destination(egbase)->ship_coming(*ship, false);
 		update(egbase);
 	}
 
@@ -665,13 +665,14 @@
 		bool waiting = true;
 
 		for (Ship* s : ships_) {
-			if (s->get_destination(game)) {
-if (s->get_destination(game) == p) {
+			bool fallback = false;
+			if (s->get_current_destination(game)) {
+if (s->has_destination(game, *p)) {
 	waiting = false;
 	--waiting_ports;
 	break;
 }
-continue;  // The ship already has a destination
+fallback = true;  // The ship already has a destination
 			}
 			if (s->get_ship_state() != Ship::ShipStates::kTransport) {
 continue;  // Ship is not available, e.g. in expedition
@@ -699,6 +700,46 @@
 			if (route_length == kRouteNotCalculated) {
 route_length = s->calculate_sea_route(game, *p);
 			}
+			if (fallback) {
+// This ship is employed transporting wares, lower its priority drastically
+const uint32_t real_length = route_length;
+uint32_t malus = 1;
+uint32_t index = 0;
+PortDock* iterator = nullptr;
+uint32_t shortest_detour = std::numeric_limits::max();
+uint32_t best_index;
+for (const auto& pair : s->destinations_) {
+	PortDock* pd = pair.first.get(game);
+	Path path;
+	uint32_t detour;
+	if (iterator == p) {
+		detour = 0;
+	} else if (iterator) {
+		get_path(*iterator, *p, path);
+		detour = path.get_nsteps();
+	} else {
+		s->calculate_sea_route(game, *p, );
+		detour = path.get_nsteps();
+	}
+	if (p != pd) {
+		get_path(*p, *pd, path);
+		detour += path.get_nsteps();
+	}
+	if (detour < shortest_detour) {
+		shortest_detour = detour;
+		best_index = index;
+	}
+	malus += pair.second;
+	iterator = pd;
+	++index;
+}
+route_length += shortest_detour * best_index;
+if (route_length + shortest_detour > real_length * malus) {
+	// Unreasonably long detour
+	continue;
+}
+route_length *= malus;
+			}
 
 			if (route_length < shortest_dist) {
 shortest_dist = route_length;
@@ -708,7 +749,7 @@
 
 		if (waiting && closest_ship) {
 			--waiting_ports;
-			closest_ship->set_destination(p);
+			closest_ship->push_destination(game, *p);
 			closest_ship->send_signal(game, "wakeup");
 		}
 	}
@@ -721,7 +762,7 @@
 
 	// Deal with edge-case of losing destination before reaching it
 	for (Ship* s : ships_) {
-		if (s->get_destination(game)) {
+		if (s->get_current_destination(game)) {
 			continue;  // The ship has a destination
 		}
 		if (s->get_ship_state() != Ship::ShipStates::kTransport) {
@@ -744,107 +785,93 @@
 		}
 
 		if (closest_port) {
-			s->set_destination(closest_port);
+			s->push_destination(game, *closest_port);
 			s->send_signal(game, "wakeup");
 		}
 	}
 }
 
 /**
- * For the given three consecutive ports, decide if their path is favourable or not.
- * \return true if the path 

Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/toolbar-dropdown-menus into lp:widelands

2019-08-10 Thread Klaus Halfmann
Running tests locally I get (on OSX):

FAIL: test_buttons_property: [string "scripting/ui.lua"]:26: 'nil' not expected!

FAIL: test_name: [string "scripting/ui.lua"]:113: attempt to index a nil value 
(field 'b')
stack traceback:
[string "scripting/ui.lua"]:113: in upvalue 'func'
[string "scripting/lunit.lua"]:425: in function <[string 
"scripting/lunit.lua"]:425>
[C]: in global 'xpcall'
[string "scripting/lunit.lua"]:425: in upvalue 'call'
[string "scripting/lunit.lua"]:450: in local 'run'
[string "scripting/lunit.lua"]:476: in global 'lunit_run_testcase'
[string "scripting/lunit.lua"]:382: in method 'run'
[string "scripting/init.lua"]:70: in main chunk

FAIL: test_click: [string "scripting/ui.lua"]:116: attempt to index a nil value 
(field 'b')
stack traceback:
[string "scripting/ui.lua"]:116: in upvalue 'func'
[string "scripting/lunit.lua"]:425: in function <[string 
"scripting/lunit.lua"]:425>
[C]: in global 'xpcall'
[string "scripting/lunit.lua"]:425: in upvalue 'call'
[string "scripting/lunit.lua"]:450: in local 'run'
[string "scripting/lunit.lua"]:476: in global 'lunit_run_testcase'
[string "scripting/lunit.lua"]:382: in method 'run'
[string "scripting/init.lua"]:70: in main chunk


FAIL: 
test/maps/ship_transportation.wmf/scripting/test_rip_ship_before_picking_up_transporting_ware.lua

...

Fatal exception: [../src/io/filesystem/layered_filesystem.cc:216] 
LayeredFileSystem: unable to create sub filesystem for existing directory: 
/var/folders/bx/q32c1w1965g5clyfbfdykcb4gp/T/widelands_regression_testfmUxCa/save/0_before_removing_ship.wgf
I have tried the following path(s):

/var/folders/bx/q32c1w1965g5clyfbfdykcb4gp/T/widelands_regression_testfmUxCa//var/folders/bx/q32c1w1965g5clyfbfdykcb4gp/T/widelands_regression_testfmUxCa/save/0_before_removing_ship.wgf

/Users/klaus/develop/widelands-repo/toolbar-dropdown-menus//var/folders/bx/q32c1w1965
FATAL ERROR - game crashed. Attempting emergency save.
lastserial: 0

Caught exception (of type '10WException') in outermost handler!
The exception said: [../src/io/filesystem/layered_filesystem.cc:216] 
LayeredFileSystem: unable to create sub filesystem for existing directory: 
/var/folders/bx/q32c1w1965g5clyfbfdykcb4gp/T/widelands_regression_testfmUxCa/save/0_before_removing_ship.wgf
I have tried the following path(s):

/var/folders/bx/q32c1w1965g5clyfbfdykcb4gp/T/widelands_regression_testfmUxCa//var/folders/bx/q32c1w1965g5clyfbfdykcb4gp/T/widelands_regression_testfmUxCa/save/0_before_removing_ship.wgf

/Users/klaus/develop/widelands-repo/toolbar-dropdown-menus//var/folders/bx/q32c1w1965

This should not happen. Please file a bug report on version 
bzr9123[toolbar-dropdown-menus](Release).
and remember to specify your operating system.



--
Ran 45 tests in 978.544s

FAILED (failures=2)

Gun: As you are "busy indexing nil values" you may have an idea what happend 
here ;-)

WIll it help if I:
a) Dig into the test and find what failed?
b) run these tests on linux?

I will no play a normala, single player game for a while and then try again 
with the debug build
-- 
https://code.launchpad.net/~widelands-dev/widelands/toolbar-dropdown-menus/+merge/368230
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/toolbar-dropdown-scripting-review-only.

___
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/toolbar-dropdown-menus into lp:widelands

2019-08-10 Thread Klaus Halfmann
Review: Needs Fixing

Mhh, some travis builds just time out,
The Realse Builds are all broekn with a testcase.

https://travis-ci.org/widelands/widelands/jobs/569957376

1383 Assertions checked. 405 Tests passed, 3 failed!
Trying to run: test/maps/lua_testsuite.wmf/scripting/test_lua_in_game.lua: done

this would indicate some asserts containing vital code which is now mssing
in the release build? I will try to do a release build but as I am on OSX
this should be ok. So we have an assertion with vital code that is still 
executed
on OSX, odd. So I will try a realse buid oon linux, too. That will take a 
little longer.

-- 
https://code.launchpad.net/~widelands-dev/widelands/toolbar-dropdown-menus/+merge/368230
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/toolbar-dropdown-scripting-review-only.

___
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