Changeset - r23379:f080157e5c08
[Not reviewed]
master
0 4 0
Eddi-z - 5 years ago 2019-03-02 17:33:16
43699911+Eddi-z@users.noreply.github.com
Fix #7307: Add WaterClass to MP_TREES, set when trees are on coast tiles (#7309)

This allows allows NewGRF object/industry placement rules to treat trees on coast tiles the same as regular bare coast.
4 files changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
docs/landscape.html
Show inline comments
 
@@ -759,6 +759,7 @@
 
   <td valign=top nowrap>&nbsp;</td>
 
   <td>
 
    <ul>
 
     <li>m1 bits 6..5: water class (sea or land)</li>
 
     <li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> (normally <tt>10</tt>)</li>
 
     <li>m2 bits 8..6: ground
 
      <table>
docs/landscape_grid.html
Show inline comments
 
@@ -194,7 +194,7 @@ the array so you can quickly see what is
 
      <td class="caption">trees</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="free">OOO</span><span class="option">~ ~~~~</span></td>
 
      <td class="bits"><span class="free">O</span>XX<span class="option">~ ~~~~</span></td>
 
      <td class="bits"><span class="free">OOOO OOO</span>X XXXX XXXX</td>
 
      <td class="bits"><span class="option">~~</span>XX XXXX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
src/tree_map.h
Show inline comments
 
@@ -13,6 +13,7 @@
 
#define TREE_MAP_H
 

	
 
#include "tile_map.h"
 
#include "water_map.h"
 

	
 
/**
 
 * List of tree types along all landscape types.
 
@@ -133,6 +134,7 @@ static inline void SetTreeGroundDensity(
 
	assert(IsTileType(t, MP_TREES)); // XXX incomplete
 
	SB(_m[t].m2, 4, 2, d);
 
	SB(_m[t].m2, 6, 3, g);
 
	SetWaterClass(t, g == TREE_GROUND_SHORE ? WATER_CLASS_SEA : WATER_CLASS_INVALID);
 
}
 

	
 
/**
src/water_map.h
Show inline comments
 
@@ -94,7 +94,7 @@ static inline WaterTileType GetWaterTile
 
 */
 
static inline bool HasTileWaterClass(TileIndex t)
 
{
 
	return IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT);
 
	return IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_TREES);
 
}
 

	
 
/**
 
@@ -204,7 +204,7 @@ static inline bool IsCoast(TileIndex t)
 
 */
 
static inline bool IsCoastTile(TileIndex t)
 
{
 
	return IsTileType(t, MP_WATER) && IsCoast(t);
 
	return (IsTileType(t, MP_WATER) && IsCoast(t)) || (IsTileType(t, MP_TREES) && GetWaterClass(t) != WATER_CLASS_INVALID);
 
}
 

	
 
/**
0 comments (0 inline, 0 general)