Merge lp:~widelands-dev/widelands/bug-1525706-artifacts into lp:widelands
- bug-1525706-artifacts
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 7869 |
Proposed branch: | lp:~widelands-dev/widelands/bug-1525706-artifacts |
Merge into: | lp:widelands |
Diff against target: |
49 lines (+10/-7) 3 files modified
src/editor/ui_menus/editor_main_menu_save_map.cc (+1/-1) src/logic/map.cc (+6/-5) src/logic/map.h (+3/-1) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands/bug-1525706-artifacts |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
TiborB | Approve | ||
kaputtnik (community) | testing | Approve | |
SirVer | Needs Fixing | ||
Review via email: mp+285566@code.launchpad.net |
Commit message
Fixed checking for artifacts on a map.
Description of the change
The old function was semantic nonsense...
kaputtnik (franku) wrote : | # |
GunChleoc (gunchleoc) wrote : | # |
This changed function is only called during saving, and it only adds a tag or not, so it's not related to the crash. Good idea of adding the map name to the output though; I will look into it.
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 656. State: passed. Details: https:/
Appveyor build 512. State: success. Details: https:/
kaputtnik (franku) wrote : | # |
> Good idea of adding the map name to the output though; I will look into it.
If possible please also add the current widelands version to the output. I am always searching for it and have to start widelands (or investigate the VERSION file) to get it.
SirVer (sirver) wrote : | # |
I suggest to simplify the code.
kaputtnik (franku) wrote : | # |
Another crash in menu load map when trying to select a map. First crash was when pointing on map "Ice wars", second time when trying select map "Sun of Fire":
<error: Cannot access memory at address 0x7473656767755300>
backtrace from first crash attached to bug report.
kaputtnik (franku) wrote : | # |
Oh i see now that this crash happens also in trunk r7816.
GunChleoc (gunchleoc) wrote : | # |
As I said before, there are no possible map loading crashes related to this branch. This code is only executed while saving a map, and then the only thing it does is write the "artifacts" tag.
I tried and failed to just iterate over the fields - seems like there is no way to safely get the size of a std::unique_
Why is it an array and not a vector anyway?
kaputtnik (franku) wrote : | # |
I have lost overview :-S "Lost in bugs" :-D Sorry
GunChleoc (gunchleoc) wrote : | # |
As long as I am not lost in translation, which would be bad for my job... :P
kaputtnik (franku) wrote : | # |
Merged with trunk an looks good.
GunChleoc (gunchleoc) wrote : | # |
I still need help with this before we can go ahead:
> I tried and failed to just iterate over the fields - seems like there is no
> way to safely get the size of a std::unique_
>
> Why is it an array and not a vector anyway?
GunChleoc (gunchleoc) wrote : | # |
I have found a safe upper limit for iterating over the fields now, so I'll be pushing something new as soon as I have compiled & tested it.
SirVer (sirver) wrote : | # |
Sorry, cannot keep up with email....
I think this can be a vector and that would probably be better.
> Am 16.02.2016 um 09:48 schrieb GunChleoc <email address hidden>:
>
> I still need help with this before we can go ahead:
>
>> I tried and failed to just iterate over the fields - seems like there is no
>> way to safely get the size of a std::unique_
>>
>> Why is it an array and not a vector anyway?
> --
> https:/
> Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1525706-artifacts.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
bunnybot (widelandsofficial) wrote : | # |
Bunnybot encountered an error while working on this merge proposal:
Running 'bzr pull --overwrite' failed. Output:
Permission denied (publickey).
ConnectionReset reading response for 'BzrDir.open_2.1', retrying
Permission denied (publickey).
bzr: ERROR: Connection closed: Unexpected end of message. Please check connectivity and permissions, and report a bug if problems persist.
Using saved parent location: bzr+ssh:
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 734. State: passed. Details: https:/
Appveyor build 581. State: success. Details: https:/
bunnybot (widelandsofficial) wrote : | # |
Bunnybot encountered an error while working on this merge proposal:
Running 'bzr pull --overwrite' failed. Output:
ssh_exchange_
ConnectionReset reading response for 'BzrDir.open_2.1', retrying
ssh_exchange_
bzr: ERROR: Connection closed: Unexpected end of message. Please check connectivity and permissions, and report a bug if problems persist.
Using saved parent location: bzr+ssh:
bunnybot (widelandsofficial) wrote : | # |
Bunnybot encountered an error while working on this merge proposal:
Running 'bzr pull --overwrite' failed. Output:
ssh_exchange_
ConnectionReset reading response for 'BzrDir.open_2.1', retrying
ssh_exchange_
bzr: ERROR: Connection closed: Unexpected end of message. Please check connectivity and permissions, and report a bug if problems persist.
Using saved parent location: bzr+ssh:
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 734. State: passed. Details: https:/
Appveyor build 581. State: success. Details: https:/
GunChleoc (gunchleoc) wrote : | # |
Changing this to a vector is complicated, so I'd like to get this branch in and leave that as a problem for another day.
> Sorry, cannot keep up with email....
>
> I think this can be a vector and that would probably be better.
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 768. State: failed. Details: https:/
Appveyor build 614. State: success. Details: https:/
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 768. State: failed. Details: https:/
Appveyor build 614. State: failed. Details: https:/
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 769. State: failed. Details: https:/
Appveyor build 615. State: success. Details: https:/
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 787. State: passed. Details: https:/
Appveyor build 633. State: success. Details: https:/
GunChleoc (gunchleoc) wrote : | # |
Thanks!
@bunnybot merge
bunnybot (widelandsofficial) wrote : | # |
Continuous integration builds have changed state:
Travis build 802. State: passed. Details: https:/
Appveyor build 648. State: failed. Details: https:/
Preview Diff
1 | === modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc' |
2 | --- src/editor/ui_menus/editor_main_menu_save_map.cc 2016-02-22 10:23:14 +0000 |
3 | +++ src/editor/ui_menus/editor_main_menu_save_map.cc 2016-03-02 17:09:33 +0000 |
4 | @@ -271,7 +271,7 @@ |
5 | map.delete_tag("seafaring"); |
6 | } |
7 | |
8 | - if (map.has_artifacts(egbase.world())) { |
9 | + if (map.has_artifacts()) { |
10 | map.add_tag("artifacts"); |
11 | } else { |
12 | map.delete_tag("artifacts"); |
13 | |
14 | === modified file 'src/logic/map.cc' |
15 | --- src/logic/map.cc 2016-03-02 10:04:54 +0000 |
16 | +++ src/logic/map.cc 2016-03-02 17:09:33 +0000 |
17 | @@ -2129,11 +2129,12 @@ |
18 | return false; |
19 | } |
20 | |
21 | -bool Map::has_artifacts(const World& world) { |
22 | - for (int32_t i = 0; i < world.get_nr_immovables(); ++i) { |
23 | - const ImmovableDescr& descr = *world.get_immovable_descr(i); |
24 | - if (descr.has_attribute(descr.get_attribute_id("artifact"))) { |
25 | - return true; |
26 | +bool Map::has_artifacts() { |
27 | + for (MapIndex i = 0; i < max_index(); ++i) { |
28 | + if (upcast(Immovable, immovable, fields_[i].get_immovable())) { |
29 | + if (immovable->descr().has_attribute(immovable->descr().get_attribute_id("artifact"))) { |
30 | + return true; |
31 | + } |
32 | } |
33 | } |
34 | return false; |
35 | |
36 | === modified file 'src/logic/map.h' |
37 | --- src/logic/map.h 2016-02-16 13:15:29 +0000 |
38 | +++ src/logic/map.h 2016-03-02 17:09:33 +0000 |
39 | @@ -433,7 +433,9 @@ |
40 | const PortSpacesSet& get_port_spaces() const {return port_spaces_;} |
41 | std::vector<Coords> find_portdock(const Widelands::Coords& c) const; |
42 | bool allows_seafaring(); |
43 | - bool has_artifacts(const World& world); |
44 | + |
45 | + /// Checks whether there are any artifacts on the map |
46 | + bool has_artifacts(); |
47 | |
48 | protected: /// These functions are needed in Testclasses |
49 | void set_size(uint32_t w, uint32_t h); |
Seems to work properly now :-)
I got one crash after several load/save actions in the editor, but i don't know if this is related to this branch or in general to bug 1543944. The crash happens after loading a map and the output says:
WidelandsMapLoa der::load_ map_complete( ) took 356ms /Quellcode/ widelands- repo/bug-1525706-artifacts/ src/logic/ map.h:510: static Widelands::MapIndex Widelands: :Map::get_ index(const Widelands::Coords&, int16_t): Assertion `c.x < width' failed.
widelands: /home/kaputtnik
Abgebrochen (Speicherabzug geschrieben)
It would be nice if MapLoader and MapSaver also writes the name of the map to the output. It is hard to remember which map was saved/loaded when one often loads and saves much maps.