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
=== modified file 'src/map_io/map_saver.cc'
--- src/map_io/map_saver.cc 2015-11-11 09:53:54 +0000
+++ src/map_io/map_saver.cc 2015-12-29 22:26:03 +0000
@@ -139,18 +139,22 @@
139 {MapAllowedWorkerTypesPacket p; p.write(m_fs, m_egbase, *m_mos);}139 {MapAllowedWorkerTypesPacket p; p.write(m_fs, m_egbase, *m_mos);}
140 log("took %ums\n ", timer.ms_since_last_query());140 log("took %ums\n ", timer.ms_since_last_query());
141141
142 // allowed building types142 // allowed building types
143 iterate_players_existing_const(plnum, nr_players, m_egbase, player) {143 // Not saving this when in editor - it causes issues when changing tribe
144 for (DescriptionIndex i = 0; i < m_egbase.tribes().nrbuildings(); ++i) {144 // after next load in editor
145 if (!player->is_building_type_allowed(i)) {145 if (is_a(Game, &m_egbase)) {
146 log("Writing Allowed Building Types Data ... ");146 iterate_players_existing_const(plnum, nr_players, m_egbase, player) {
147 MapAllowedBuildingTypesPacket p;147 for (DescriptionIndex i = 0; i < m_egbase.tribes().nrbuildings(); ++i) {
148 p .write(m_fs, m_egbase, *m_mos);148 if (!player->is_building_type_allowed(i)) {
149 log("took %ums\n ", timer.ms_since_last_query());149 log("Writing Allowed Building Types Data ... ");
150 goto end_find_a_forbidden_building_type_loop;150 MapAllowedBuildingTypesPacket p;
151 p .write(m_fs, m_egbase, *m_mos);
152 log("took %ums\n ", timer.ms_since_last_query());
153 goto end_find_a_forbidden_building_type_loop;
154 }
151 }155 }
152 }156 } end_find_a_forbidden_building_type_loop:;
153 } end_find_a_forbidden_building_type_loop:;157 }
154158
155 // !!!!!!!!!! NOTE159 // !!!!!!!!!! NOTE
156 // This packet must be before any building or road packet. So do not160 // 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: