Merge lp:~widelands-dev/widelands/bug-1526903 into lp:widelands

Proposed by TiborB
Status: Merged
Merged at revision: 7690
Proposed branch: lp:~widelands-dev/widelands/bug-1526903
Merge into: lp:widelands
Diff against target: 37 lines (+15/-11)
1 file modified
src/map_io/map_saver.cc (+15/-11)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1526903
Reviewer Review Type Date Requested Status
kaputtnik (community) Approve
Review via email: mp+281410@code.launchpad.net

Description of the change

This is very simple change - prohibiting save of allowed_building_types in editor (=creating particular file). Should not cause problems, but must be tested

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

The diff looks bit complex, but really only thing that was added is:
if (is_a(Game, &m_egbase)) { .... }

Revision history for this message
GunChleoc (gunchleoc) wrote :

Could you go through the map saver and have a look at other packets that we don't need?

Revision history for this message
kaputtnik (franku) wrote :

We should check the player directory... but i am unsure if it is needed for scritping. Maybe wl_zocker could tell us.

I will test this branch...

Revision history for this message
kaputtnik (franku) wrote :

I couldn't trigger any of the errors described in the related bug reports anymore :-)

The file "allowed_building_types" is never been created. So for this it seems to be fixed and i give approve for testing.

But there is another issue with the number of players: Open editor, open "set players", set number of players to two but place only one player to the map. Save the map and after reload the map the "set player" window will always show two players. If you try to start a game with this map, a error occurs:

Fatal exception: Widelands could not start the game, because player 2 has no starting position.
You can manually add a starting position with the Widelands Editor to fix this problem.

I will make another bug report for this issue.

review: Approve
Revision history for this message
TiborB (tiborb95) wrote :

> Could you go through the map saver and have a look at other packets that we don't need?

There is couple of sections we can discuss, or perhaps can be ommited for saving in editor:

log("Writing Flag Data ... ");
log("Writing Road Data ... ");
log("Writing Map Objects ... "); - this is probably needed in editor, or isn't it?
// DATA PACKETS 3 sections here
log("Writing Node Ownership Data ... ");
log("Writing Exploration Data ... ");
log("Writing Players Unseen Data ... ");
log("Writing Scripting Data ... ");
log("Writing Objective Data ... ");

What is your opinion? Or is here somebody willing to test what can be skipped?

I see kaputtnik approved this. So can I merge to trunk or will we go on with discussion what can be ommited as well?

Revision history for this message
TiborB (tiborb95) wrote :

>Fatal exception: Widelands could not start the game, because player 2 has no starting position.
You can manually add a starting position with the Widelands Editor to fix this problem.

For me this is "unfinished map" not a "bug".

Revision history for this message
bunnybot (widelandsofficial) wrote :

Hi, I am bunnybot (https://github.com/widelands/bunnybot).

I am keeping the source branch lp:~widelands-dev/widelands/bug-1526903 mirrored to
  https://github.com/widelands/widelands/tree/_widelands_dev_widelands_bug_1526903

The latest continuous integration build can always be found here:
  https://travis-ci.org/widelands/widelands/branches
Please do not merge without making sure that it passes.

You can give me commands by starting a line with @bunnybot <command>. I understand:
 merge: Merges the source branch into the target branch, closing the pull request.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Travis build 101 has changed state to: passed. Details: https://travis-ci.org/widelands/widelands/builds/99640935.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Travis build 101 has changed state to: passed. Details: https://travis-ci.org/widelands/widelands/builds/99640935.

Revision history for this message
GunChleoc (gunchleoc) wrote :

> But there is another issue with the number of players: Open editor, open "set
> players", set number of players to two but place only one player to the map.
> Save the map and after reload the map the "set player" window will always show
> two players. If you try to start a game with this map, a error occurs:
>
> Fatal exception: Widelands could not start the game, because player 2 has no
> starting position.
> You can manually add a starting position with the Widelands Editor to fix this
> problem.
>
> I will make another bug report for this issue.

Yes, this is unrelated.

> There is couple of sections we can discuss, or perhaps can be ommited for saving in editor:

I think maybe we should discuss this in a new bug, so it won't get lost after this branch is merged?

Revision history for this message
TiborB (tiborb95) wrote :

I believe that I can merge it

@bunnybot merge

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have created a bug for the packages that we should look at: https://bugs.launchpad.net/widelands/+bug/1531463

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/map_io/map_saver.cc'
2--- src/map_io/map_saver.cc 2015-11-11 09:53:54 +0000
3+++ src/map_io/map_saver.cc 2015-12-29 22:26:03 +0000
4@@ -139,18 +139,22 @@
5 {MapAllowedWorkerTypesPacket p; p.write(m_fs, m_egbase, *m_mos);}
6 log("took %ums\n ", timer.ms_since_last_query());
7
8- // allowed building types
9- iterate_players_existing_const(plnum, nr_players, m_egbase, player) {
10- for (DescriptionIndex i = 0; i < m_egbase.tribes().nrbuildings(); ++i) {
11- if (!player->is_building_type_allowed(i)) {
12- log("Writing Allowed Building Types Data ... ");
13- MapAllowedBuildingTypesPacket p;
14- p .write(m_fs, m_egbase, *m_mos);
15- log("took %ums\n ", timer.ms_since_last_query());
16- goto end_find_a_forbidden_building_type_loop;
17+ // allowed building types
18+ // Not saving this when in editor - it causes issues when changing tribe
19+ // after next load in editor
20+ if (is_a(Game, &m_egbase)) {
21+ iterate_players_existing_const(plnum, nr_players, m_egbase, player) {
22+ for (DescriptionIndex i = 0; i < m_egbase.tribes().nrbuildings(); ++i) {
23+ if (!player->is_building_type_allowed(i)) {
24+ log("Writing Allowed Building Types Data ... ");
25+ MapAllowedBuildingTypesPacket p;
26+ p .write(m_fs, m_egbase, *m_mos);
27+ log("took %ums\n ", timer.ms_since_last_query());
28+ goto end_find_a_forbidden_building_type_loop;
29+ }
30 }
31- }
32- } end_find_a_forbidden_building_type_loop:;
33+ } end_find_a_forbidden_building_type_loop:;
34+ }
35
36 // !!!!!!!!!! NOTE
37 // This packet must be before any building or road packet. So do not

Subscribers

People subscribed via source and target branches

to status/vote changes: