Merge lp:~widelands-dev/widelands/s2_map into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7537
Proposed branch: lp:~widelands-dev/widelands/s2_map
Merge into: lp:widelands
Diff against target: 19 lines (+2/-3)
1 file modified
src/map_io/s2map.cc (+2/-3)
To merge this branch: bzr merge lp:~widelands-dev/widelands/s2_map
Reviewer Review Type Date Requested Status
TiborB Approve
Review via email: mp+272877@code.launchpad.net

Description of the change

Changed string data types in S2MapDescrHeader to fixed char arrays to fix crash in map preload packet.

I just copied it over from Build 18 ;)

The crash was reported on the forum: https://wl.widelands.org/forum/topic/1471/

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

How is the name and author set? Is it typed by map creator? Can he enter more letters than the size of those arrays? (= 20 and 26)
These numbers are used in settlers maps?
Does it break map or savefiles compatibility?

Revision history for this message
GunChleoc (gunchleoc) wrote :

This is only for loading old Settlers 2 maps. When you save them, they will be saved as Widelands maps. So no, it won't break savefile compatibility, because there is no saving involved ;)

Revision history for this message
TiborB (tiborb95) wrote :

oh, ok then

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks for the review :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/map_io/s2map.cc'
2--- src/map_io/s2map.cc 2015-01-31 16:03:59 +0000
3+++ src/map_io/s2map.cc 2015-09-30 07:57:07 +0000
4@@ -48,14 +48,13 @@
5 namespace {
6
7 struct S2MapDescrHeader {
8-
9 char magic[10]; // "WORLD_V1.0"
10- std::string name;
11+ char name [20]; // We need fixed char arrays rather than strings here. Otherwise, this will segfault.
12 int16_t w;
13 int16_t h;
14 int8_t uses_world; // 0 = green, 1 =black, 2 = winter
15 int8_t nplayers;
16- std::string author;
17+ char author[26];
18 char bulk[2290]; // unknown
19 } /* size 2352 */;
20

Subscribers

People subscribed via source and target branches

to status/vote changes: