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

Proposed by GunChleoc
Status: Merged
Merged at revision: 7412
Proposed branch: lp:~widelands-dev/widelands/terrain_doc
Merge into: lp:widelands
Diff against target: 402 lines (+86/-80)
9 files modified
src/ai/ai_help_structs.h (+2/-2)
src/editor/tools/editor_increase_resources_tool.cc (+1/-1)
src/editor/tools/editor_info_tool.cc (+6/-6)
src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc (+13/-13)
src/logic/map.cc (+30/-30)
src/logic/worker.cc (+4/-4)
src/logic/world/terrain_description.cc (+13/-15)
src/logic/world/terrain_description.h (+6/-6)
world/terrains/init.lua (+11/-3)
To merge this branch: bzr merge lp:~widelands-dev/widelands/terrain_doc
Reviewer Review Type Date Requested Status
kaputtnik (community) Approve
SirVer Approve
Review via email: mp+249747@code.launchpad.net

Description of the change

I have added some documentation for the terrains.

Am I correct in assuming that "acid" and "dead" do the exact same thing? If so, will it break compatibility with existing maps if I change all the "acid" ones to "dead"?

To post a comment you must log in.
Revision history for this message
SirVer (sirver) :
review: Approve
Revision history for this message
kaputtnik (franku) wrote :

@SirVer: Could you please explain, if the "is"-value has influence about growing of trees?

As an example: "dry" means currently "no buildings possible, but roads". "dry" associates also to something like desert, where trees do not grow good. But i assume the new terrain affinitie-values have only influence on growing trees?

Revision history for this message
SirVer (sirver) wrote :

> On 14.02.2015, at 16:27, kaputtnik <email address hidden> wrote:
>
> @SirVer: Could you please explain, if the "is"-value has influence about growing of trees?
>
> As an example: "dry" means currently "no buildings possible, but roads". "dry" associates also to something like desert, where trees do not grow good. But i assume the new terrain affinitie-values have only influence on growing trees?

Yes, but that is no change in behavior to before though - only terrain affinity decides how trees grow.

Revision history for this message
kaputtnik (franku) wrote :

> Yes, but that is no change in behavior to before though -

This wasn't my point. I don't want to get terrain developers on the wrong path with ambiguous words. :-) "green" associates with growing plants, "dry" not. But these values haven't anything to do with growing. This should be clear in the new descriptions.

> only terrain
> affinity decides how trees grow.

So there is no need to store information about growing in the new descriptions. Exception is maybe the "acid" value.

Or am i wrong?

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

I also have a question that needs answering before the merge this:

Am I correct in assuming that "acid" and "dead" do the exact same thing? If so, will it break compatibility with existing maps if I change all the "acid" ones to "dead"?

If we can get rid of the distinction, I could do some additional code cleanup to make things less confusing.

Revision history for this message
SirVer (sirver) wrote :

> Am I correct in assuming that "acid" and "dead" do the exact same thing? If so, will it break compatibility with existing maps if I change all the "acid" ones to "dead"?

afaik, "dead" is only used in the strings in the editor. It is not mentioned in the types:

http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/7403/src/logic/world/terrain_description.h#L45

It is also used here:

http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/7403/src/logic/world/terrain_description.cc#L40

but there, they are exactly the same.

So I think the answer is yes, they are the same.

Revision history for this message
GunChleoc (gunchleoc) wrote :

We have both "dead" and "acid" in the init.lua:

http://bazaar.launchpad.net/~widelands-dev/widelands/terrain_doc/view/head:/world/terrains/init.lua

Will it break maps if I change them all to "dead"?

Revision history for this message
SirVer (sirver) wrote :

Sorry, my comment was not clear.

> Will it break maps if I change them all to "dead"?

No, they are the same (see second link). But ACID is used in other places, while DEAD isn't. So you should either change ACID to DEAD everywhere or keep "acid" and remove "dead".

Revision history for this message
kaputtnik (franku) wrote :

Because "dead" is only applied to greenland "snow" terrain, see

http://bazaar.launchpad.net/~widelands-dev/widelands/terrain_doc/view/head:/world/terrains/init.lua#L265

i suggest to remove "dead".

Revision history for this message
GunChleoc (gunchleoc) wrote :

I decided to go for "dead", because it fits the current icon and the translations, and also makes more sense for snow.

Revision history for this message
kaputtnik (franku) wrote :

I am further unhappy about the descriptions in terrains/init.lua, see below.

If someone want to make more terrains, he should be able to choose the right "is" value. Call me scrupulously, sometimes i am ;)

Revision history for this message
GunChleoc (gunchleoc) wrote :

I don't know how the trees work exactly, so I'd rather be vague before I add something that isn't true. Maybe somebody who is familiar with the terrain affinty code can add some improvements?

Revision history for this message
SirVer (sirver) :
Revision history for this message
kaputtnik (franku) wrote :

As SirVer said in https://code.launchpad.net/~widelands-dev/widelands/terrain_doc/+merge/249747/comments/618862

"only terrain affinity decides how trees grow."

I think before the one-world merge, the is-values did have influence about the growing of trees. With the merge into one-world, this terrain affinities get lost and the new affinities (temparature, humidity fertility) are worked out.

So i read in the threads
https://bugs.launchpad.net/widelands/+bug/1328635
https://bugs.launchpad.net/widelands/+bug/1348800

It was a very complicated development, and i am not sure, if the last changes are done to this issue :-D

Beside this, the changes has to be reflected in the terrain menu so that map developers could take care about the new affinities. I try to get an overview about the affinities, but i am just at the beginning...

Revision history for this message
GunChleoc (gunchleoc) wrote :

Good luck - we will need to find an appropriate place for the documentation once you have gotten your head around this.

I have removed the comment about the affinities. Is this branch good to go now?

Revision history for this message
kaputtnik (franku) wrote :

Thanks,

> Is this branch good to go now?
I think so. Thanks for your work :-)

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

@SirVer: Do you want another look at the code?

The important changes are in src/logic/world/terrain_description.cc, and world/terrains/init.lua, the rest is just renaming of variables.

Revision history for this message
SirVer (sirver) wrote :

No, kaputtnik approved. one lgtm should be enough for any change :)

Revision history for this message
GunChleoc (gunchleoc) wrote :

OK, will merge then. Thanks :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ai/ai_help_structs.h'
2--- src/ai/ai_help_structs.h 2015-02-05 12:11:20 +0000
3+++ src/ai/ai_help_structs.h 2015-02-16 18:38:54 +0000
4@@ -147,8 +147,8 @@
5
6 bool accept(const Map& /* map */, const FCoords& coord) const {
7 return (world_.terrain_descr(coord.field->terrain_d()).get_is() &
8- TerrainDescription::WATER) ||
9- (world_.terrain_descr(coord.field->terrain_r()).get_is() & TerrainDescription::WATER);
10+ TerrainDescription::Type::kWater) ||
11+ (world_.terrain_descr(coord.field->terrain_r()).get_is() & TerrainDescription::Type::kWater);
12 }
13
14 private:
15
16=== modified file 'src/editor/tools/editor_increase_resources_tool.cc'
17--- src/editor/tools/editor_increase_resources_tool.cc 2014-12-01 21:47:22 +0000
18+++ src/editor/tools/editor_increase_resources_tool.cc 2015-02-16 18:38:54 +0000
19@@ -37,7 +37,7 @@
20 if (!terrain.is_resource_valid(resource)) {
21 return -1;
22 }
23- if (terrain.get_is() & Widelands::TerrainDescription::UNPASSABLE) {
24+ if (terrain.get_is() & Widelands::TerrainDescription::Type::kUnpassable) {
25 return 8;
26 }
27 return 1;
28
29=== modified file 'src/editor/tools/editor_info_tool.cc'
30--- src/editor/tools/editor_info_tool.cc 2015-01-30 23:10:35 +0000
31+++ src/editor/tools/editor_info_tool.cc 2015-02-16 18:38:54 +0000
32@@ -104,22 +104,22 @@
33 Widelands::TerrainDescription::Type terrain_is = ter.get_is();
34 std::vector<std::string> terrain_is_strings;
35
36- if (terrain_is == Widelands::TerrainDescription::Type::GREEN) {
37+ if (terrain_is == Widelands::TerrainDescription::Type::kGreen) {
38 terrain_is_strings.push_back(_("arable"));
39 }
40- if (terrain_is & Widelands::TerrainDescription::Type::DRY) {
41+ if (terrain_is & Widelands::TerrainDescription::Type::kDry) {
42 terrain_is_strings.push_back(_("treeless"));
43 }
44- if (terrain_is & Widelands::TerrainDescription::Type::WATER) {
45+ if (terrain_is & Widelands::TerrainDescription::Type::kWater) {
46 terrain_is_strings.push_back(_("aquatic"));
47 }
48- if (terrain_is & Widelands::TerrainDescription::Type::ACID) {
49+ if (terrain_is & Widelands::TerrainDescription::Type::kDead) {
50 terrain_is_strings.push_back(_("dead"));
51 }
52- if (terrain_is & Widelands::TerrainDescription::Type::MOUNTAIN) {
53+ if (terrain_is & Widelands::TerrainDescription::Type::kMountain) {
54 terrain_is_strings.push_back(_("mountainous"));
55 }
56- if (terrain_is & Widelands::TerrainDescription::Type::UNPASSABLE) {
57+ if (terrain_is & Widelands::TerrainDescription::Type::kUnpassable) {
58 terrain_is_strings.push_back(_("unpassable"));
59 }
60 buf += "• " + (boost::format(_("Category: %s"))
61
62=== modified file 'src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc'
63--- src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2015-01-30 23:10:35 +0000
64+++ src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2015-02-16 18:38:54 +0000
65@@ -43,13 +43,13 @@
66 using namespace Widelands;
67
68 static const int32_t check[] = {
69- TerrainDescription::GREEN, // "green"
70- TerrainDescription::DRY, // "dry"
71- TerrainDescription::DRY | TerrainDescription::MOUNTAIN, // "mountain"
72- TerrainDescription::DRY | TerrainDescription::UNPASSABLE, // "unpassable"
73- TerrainDescription::ACID | TerrainDescription::DRY |
74- TerrainDescription::UNPASSABLE, // "dead" or "acid"
75- TerrainDescription::UNPASSABLE | TerrainDescription::DRY | TerrainDescription::WATER,
76+ TerrainDescription::Type::kGreen, // "green"
77+ TerrainDescription::Type::kDry, // "dry"
78+ TerrainDescription::Type::kDry | TerrainDescription::Type::kMountain, // "mountain"
79+ TerrainDescription::Type::kDry | TerrainDescription::Type::kUnpassable, // "unpassable"
80+ TerrainDescription::Type::kDead | TerrainDescription::Type::kDry |
81+ TerrainDescription::Type::kUnpassable, // "dead"
82+ TerrainDescription::Type::kUnpassable | TerrainDescription::Type::kDry | TerrainDescription::Type::kWater,
83 -1, // end marker
84 };
85
86@@ -82,7 +82,7 @@
87 BlendMode::UseAlpha, texture);
88 Point pt(1, terrain_texture.height() - kSmallPicHeight - 1);
89
90- if (ter_is == TerrainDescription::GREEN) {
91+ if (ter_is == TerrainDescription::Type::kGreen) {
92 blit(Rect(pt.x, pt.y, green->width(), green->height()),
93 *green,
94 Rect(0, 0, green->width(), green->height()),
95@@ -93,7 +93,7 @@
96 /** TRANSLATORS: This is a terrain type tooltip in the editor */
97 tooltips.push_back(_("arable"));
98 } else {
99- if (ter_is & TerrainDescription::WATER) {
100+ if (ter_is & TerrainDescription::Type::kWater) {
101 blit(Rect(pt.x, pt.y, water->width(), water->height()),
102 *water,
103 Rect(0, 0, water->width(), water->height()),
104@@ -104,7 +104,7 @@
105 /** TRANSLATORS: This is a terrain type tooltip in the editor */
106 tooltips.push_back(_("aquatic"));
107 }
108- else if (ter_is & TerrainDescription::MOUNTAIN) {
109+ else if (ter_is & TerrainDescription::Type::kMountain) {
110 blit(Rect(pt.x, pt.y, mountain->width(), mountain->height()),
111 *mountain,
112 Rect(0, 0, mountain->width(), mountain->height()),
113@@ -115,7 +115,7 @@
114 /** TRANSLATORS: This is a terrain type tooltip in the editor */
115 tooltips.push_back(_("mountainous"));
116 }
117- if (ter_is & TerrainDescription::ACID) {
118+ if (ter_is & TerrainDescription::Type::kDead) {
119 blit(Rect(pt.x, pt.y, dead->width(), dead->height()),
120 *dead,
121 Rect(0, 0, dead->width(), dead->height()),
122@@ -126,7 +126,7 @@
123 /** TRANSLATORS: This is a terrain type tooltip in the editor */
124 tooltips.push_back(_("dead"));
125 }
126- if (ter_is & TerrainDescription::UNPASSABLE) {
127+ if (ter_is & TerrainDescription::Type::kUnpassable) {
128 blit(Rect(pt.x, pt.y, unpassable->width(), unpassable->height()),
129 *unpassable,
130 Rect(0, 0, unpassable->width(), unpassable->height()),
131@@ -137,7 +137,7 @@
132 /** TRANSLATORS: This is a terrain type tooltip in the editor */
133 tooltips.push_back(_("unpassable"));
134 }
135- if (ter_is & TerrainDescription::DRY) {
136+ if (ter_is & TerrainDescription::Type::kDry) {
137 blit(Rect(pt.x, pt.y, dry->width(), dry->height()),
138 *dry,
139 Rect(0, 0, dry->width(), dry->height()),
140
141=== modified file 'src/logic/map.cc'
142--- src/logic/map.cc 2015-02-12 07:55:25 +0000
143+++ src/logic/map.cc 2015-02-16 18:38:54 +0000
144@@ -215,7 +215,7 @@
145 const TerrainDescription& terr = world.terrain_descr(f1.field->terrain_r());
146 const int8_t resr = terr.get_default_resource();
147 const int default_amount = terr.get_default_resource_amount();
148- if ((terr.get_is() & TerrainDescription::UNPASSABLE) && default_amount > 0)
149+ if ((terr.get_is() & TerrainDescription::Type::kUnpassable) && default_amount > 0)
150 m[resr] += 3;
151 else
152 ++m[resr];
153@@ -225,7 +225,7 @@
154 const TerrainDescription& terd = world.terrain_descr(f1.field->terrain_d());
155 const int8_t resd = terd.get_default_resource();
156 const int default_amount = terd.get_default_resource_amount();
157- if ((terd.get_is() & TerrainDescription::UNPASSABLE) && default_amount > 0)
158+ if ((terd.get_is() & TerrainDescription::Type::kUnpassable) && default_amount > 0)
159 m[resd] += 3;
160 else
161 ++m[resd];
162@@ -238,7 +238,7 @@
163 const TerrainDescription& terd = world.terrain_descr(f1.field->terrain_d());
164 const int8_t resd = terd.get_default_resource();
165 const int default_amount = terd.get_default_resource_amount();
166- if ((terd.get_is() & TerrainDescription::UNPASSABLE) && default_amount > 0)
167+ if ((terd.get_is() & TerrainDescription::Type::kUnpassable) && default_amount > 0)
168 m[resd] += 3;
169 else
170 ++m[resd];
171@@ -251,7 +251,7 @@
172 const TerrainDescription& terr = world.terrain_descr(f1.field->terrain_r());
173 const int8_t resr = terr.get_default_resource();
174 const int default_amount = terr.get_default_resource_amount();
175- if ((terr.get_is() & TerrainDescription::UNPASSABLE) && default_amount > 0)
176+ if ((terr.get_is() & TerrainDescription::Type::kUnpassable) && default_amount > 0)
177 m[resr] += 3;
178 else
179 ++m[resr];
180@@ -1037,28 +1037,28 @@
181 // 1b) Collect some information about the neighbours
182 uint8_t cnt_unpassable = 0;
183 uint8_t cnt_water = 0;
184- uint8_t cnt_acid = 0;
185-
186- if (tr_d_terrain_is & TerrainDescription::UNPASSABLE) ++cnt_unpassable;
187- if (tl_r_terrain_is & TerrainDescription::UNPASSABLE) ++cnt_unpassable;
188- if (tl_d_terrain_is & TerrainDescription::UNPASSABLE) ++cnt_unpassable;
189- if (l_r_terrain_is & TerrainDescription::UNPASSABLE) ++cnt_unpassable;
190- if (f_d_terrain_is & TerrainDescription::UNPASSABLE) ++cnt_unpassable;
191- if (f_r_terrain_is & TerrainDescription::UNPASSABLE) ++cnt_unpassable;
192-
193- if (tr_d_terrain_is & TerrainDescription::WATER) ++cnt_water;
194- if (tl_r_terrain_is & TerrainDescription::WATER) ++cnt_water;
195- if (tl_d_terrain_is & TerrainDescription::WATER) ++cnt_water;
196- if (l_r_terrain_is & TerrainDescription::WATER) ++cnt_water;
197- if (f_d_terrain_is & TerrainDescription::WATER) ++cnt_water;
198- if (f_r_terrain_is & TerrainDescription::WATER) ++cnt_water;
199-
200- if (tr_d_terrain_is & TerrainDescription::ACID) ++cnt_acid;
201- if (tl_r_terrain_is & TerrainDescription::ACID) ++cnt_acid;
202- if (tl_d_terrain_is & TerrainDescription::ACID) ++cnt_acid;
203- if (l_r_terrain_is & TerrainDescription::ACID) ++cnt_acid;
204- if (f_d_terrain_is & TerrainDescription::ACID) ++cnt_acid;
205- if (f_r_terrain_is & TerrainDescription::ACID) ++cnt_acid;
206+ uint8_t cnt_dead = 0;
207+
208+ if (tr_d_terrain_is & TerrainDescription::Type::kUnpassable) ++cnt_unpassable;
209+ if (tl_r_terrain_is & TerrainDescription::Type::kUnpassable) ++cnt_unpassable;
210+ if (tl_d_terrain_is & TerrainDescription::Type::kUnpassable) ++cnt_unpassable;
211+ if (l_r_terrain_is & TerrainDescription::Type::kUnpassable) ++cnt_unpassable;
212+ if (f_d_terrain_is & TerrainDescription::Type::kUnpassable) ++cnt_unpassable;
213+ if (f_r_terrain_is & TerrainDescription::Type::kUnpassable) ++cnt_unpassable;
214+
215+ if (tr_d_terrain_is & TerrainDescription::Type::kWater) ++cnt_water;
216+ if (tl_r_terrain_is & TerrainDescription::Type::kWater) ++cnt_water;
217+ if (tl_d_terrain_is & TerrainDescription::Type::kWater) ++cnt_water;
218+ if (l_r_terrain_is & TerrainDescription::Type::kWater) ++cnt_water;
219+ if (f_d_terrain_is & TerrainDescription::Type::kWater) ++cnt_water;
220+ if (f_r_terrain_is & TerrainDescription::Type::kWater) ++cnt_water;
221+
222+ if (tr_d_terrain_is & TerrainDescription::Type::kDead) ++cnt_dead;
223+ if (tl_r_terrain_is & TerrainDescription::Type::kDead) ++cnt_dead;
224+ if (tl_d_terrain_is & TerrainDescription::Type::kDead) ++cnt_dead;
225+ if (l_r_terrain_is & TerrainDescription::Type::kDead) ++cnt_dead;
226+ if (f_d_terrain_is & TerrainDescription::Type::kDead) ++cnt_dead;
227+ if (f_r_terrain_is & TerrainDescription::Type::kDead) ++cnt_dead;
228
229
230 // 2) Passability
231@@ -1075,7 +1075,7 @@
232
233 // 2c) [OVERRIDE] If any of the neighbouring triangles is really "bad" (such
234 // as lava), we can neither walk nor swim to this node.
235- if (cnt_acid)
236+ if (cnt_dead)
237 caps &= ~(MOVECAPS_WALK | MOVECAPS_SWIM);
238
239 // === everything below is used to check buildability ===
240@@ -1265,10 +1265,10 @@
241 uint32_t cnt_mountain = 0;
242 uint32_t cnt_dry = 0;
243 for (uint32_t i = 0; i < 6; ++i) {
244- if (terrains[i] & TerrainDescription::WATER)
245+ if (terrains[i] & TerrainDescription::Type::kWater)
246 return BaseImmovable::NONE;
247- if (terrains[i] & TerrainDescription::MOUNTAIN) ++cnt_mountain;
248- if (terrains[i] & TerrainDescription::DRY) ++cnt_dry;
249+ if (terrains[i] & TerrainDescription::Type::kMountain) ++cnt_mountain;
250+ if (terrains[i] & TerrainDescription::Type::kDry) ++cnt_dry;
251 }
252
253 if (cnt_mountain == 6) {
254
255=== modified file 'src/logic/worker.cc'
256--- src/logic/worker.cc 2015-01-15 15:33:52 +0000
257+++ src/logic/worker.cc 2015-02-16 18:38:54 +0000
258@@ -2708,11 +2708,11 @@
259 bool is_center_mountain =
260 (world.terrain_descr(owner_area.field->terrain_d()).get_is()
261 &
262- TerrainDescription::MOUNTAIN)
263+ TerrainDescription::Type::kMountain)
264 |
265 (world.terrain_descr(owner_area.field->terrain_r()).get_is()
266 &
267- TerrainDescription::MOUNTAIN);
268+ TerrainDescription::Type::kMountain);
269 // Only run towards fields that are on a mountain (or not)
270 // depending on position of center
271 bool is_target_mountain;
272@@ -2725,11 +2725,11 @@
273 is_target_mountain =
274 (world.terrain_descr(target.field->terrain_d()).get_is()
275 &
276- TerrainDescription::MOUNTAIN)
277+ TerrainDescription::Type::kMountain)
278 |
279 (world.terrain_descr(target.field->terrain_r()).get_is()
280 &
281- TerrainDescription::MOUNTAIN);
282+ TerrainDescription::Type::kMountain);
283 if (i == 0)
284 i = list.size();
285 --i;
286
287=== modified file 'src/logic/world/terrain_description.cc'
288--- src/logic/world/terrain_description.cc 2015-01-31 16:03:59 +0000
289+++ src/logic/world/terrain_description.cc 2015-02-16 18:38:54 +0000
290@@ -39,30 +39,28 @@
291 // Parse a terrain type from the giving string.
292 TerrainDescription::Type terrain_type_from_string(const std::string& type) {
293 if (type == "green") {
294- return TerrainDescription::GREEN;
295+ return TerrainDescription::Type::kGreen;
296 }
297 if (type == "dry") {
298- return TerrainDescription::DRY;
299+ return TerrainDescription::Type::kDry;
300 }
301 if (type == "water") {
302- return static_cast<TerrainDescription::Type>(
303- TerrainDescription::WATER | TerrainDescription::DRY | TerrainDescription::UNPASSABLE);
304+ return static_cast<TerrainDescription::Type>(TerrainDescription::Type::kWater |
305+ TerrainDescription::Type::kDry |
306+ TerrainDescription::Type::kUnpassable);
307 }
308- if (type == "acid") {
309- return static_cast<TerrainDescription::Type>(
310- TerrainDescription::ACID | TerrainDescription::DRY | TerrainDescription::UNPASSABLE);
311+ if (type == "dead") {
312+ return static_cast<TerrainDescription::Type>(TerrainDescription::Type::kDead |
313+ TerrainDescription::Type::kDry |
314+ TerrainDescription::Type::kUnpassable);
315 }
316 if (type == "mountain") {
317- return static_cast<TerrainDescription::Type>(TerrainDescription::DRY |
318- TerrainDescription::MOUNTAIN);
319- }
320- if (type == "dead") {
321- return static_cast<TerrainDescription::Type>(
322- TerrainDescription::DRY | TerrainDescription::UNPASSABLE | TerrainDescription::ACID);
323+ return static_cast<TerrainDescription::Type>(TerrainDescription::Type::kDry |
324+ TerrainDescription::Type::kMountain);
325 }
326 if (type == "unpassable") {
327- return static_cast<TerrainDescription::Type>(TerrainDescription::DRY |
328- TerrainDescription::UNPASSABLE);
329+ return static_cast<TerrainDescription::Type>(TerrainDescription::Type::kDry |
330+ TerrainDescription::Type::kUnpassable);
331 }
332 throw LuaError((boost::format("invalid terrain type '%s'") % type).str());
333 }
334
335=== modified file 'src/logic/world/terrain_description.h'
336--- src/logic/world/terrain_description.h 2014-11-28 05:40:53 +0000
337+++ src/logic/world/terrain_description.h 2015-02-16 18:38:54 +0000
338@@ -43,12 +43,12 @@
339 class TerrainDescription {
340 public:
341 enum Type {
342- GREEN = 0,
343- DRY = 1,
344- WATER = 2,
345- ACID = 4,
346- MOUNTAIN = 8,
347- UNPASSABLE = 16,
348+ kGreen = 0,
349+ kDry = 1,
350+ kWater = 2,
351+ kDead = 4,
352+ kMountain = 8,
353+ kUnpassable = 16,
354 };
355
356 TerrainDescription(const LuaTable& table, const World&);
357
358=== modified file 'world/terrains/init.lua'
359--- world/terrains/init.lua 2015-01-30 10:16:22 +0000
360+++ world/terrains/init.lua 2015-02-16 18:38:54 +0000
361@@ -38,6 +38,14 @@
362 -- Type of terrain. Describes if the terrain is walkable, swimmable, if
363 -- mines or buildings can be build on it, if flags can be build on it and so
364 -- on.
365+ --
366+ -- The following properties are available:
367+ -- "green": Allows building of normal buildings and roads
368+ -- "mountain": Allows building of mines and roads
369+ -- "dry": Allows building of roads only. Trees don't like this terrain.
370+ -- "water": Nothing can be built here, but ships and aquatic animals can pass
371+ -- "dead": Nothing can be built here, and nothing can walk on it, and nothing will grow.
372+ -- "unpassable": Nothing can be built here, and nothing can walk on it
373 is = "green",
374
375 -- The list resources that can be found in this terrain.
376@@ -267,7 +275,7 @@
377 name = "lava",
378 descname = _ "Lava",
379 editor_category = "green",
380- is = "acid",
381+ is = "dead",
382 valid_resources = {},
383 default_resource = "",
384 default_resource_amount = 0,
385@@ -482,7 +490,7 @@
386 name = "lava-stone1",
387 descname = _ "Lava Rocks",
388 editor_category = "wasteland",
389- is = "acid",
390+ is = "dead",
391 valid_resources = {},
392 default_resource = "",
393 default_resource_amount = 0,
394@@ -498,7 +506,7 @@
395 name = "lava-stone2",
396 descname = _ "Lava Rocks",
397 editor_category = "wasteland",
398- is = "acid",
399+ is = "dead",
400 valid_resources = {},
401 default_resource = "",
402 default_resource_amount = 0,

Subscribers

People subscribed via source and target branches

to status/vote changes: