Changeset - r15762:7fbf9fe78040
[Not reviewed]
master
0 10 0
rubidium - 14 years ago 2010-08-11 14:14:06
rubidium@openttd.org
(svn r20446) -Codechange: unify the location of the water class
10 files changed with 91 insertions and 59 deletions:
0 comments (0 inline, 0 general)
docs/landscape.html
Show inline comments
 
@@ -49,13 +49,13 @@
 
 </ul>
 
 <p>
 
  For a graphical representation of the tile-layout have a look at
 
  <a href="landscape_grid.html">Landscape grid</a> page.
 
 </p>
 

	
 
  The <a name="OwnershipInfo">owner of a tile</a>, as frequently associated with attribute m1,
 
  The <a name="OwnershipInfo">owner of a tile</a>, as frequently associated with attribute m1 bits 4..0,
 
  can be either companies (human or AI) or "Game entities".
 
  They are identified using:
 
  <table border="1">
 
   <tr><td><tt>00..0E</tt>&nbsp; </td><td align=left>Normal companies</td></tr>
 
   <tr><td><tt>0F</tt>&nbsp; </td><td align=left>a town owns the tile</td></tr>
 
   <tr><td><tt>10</tt>&nbsp; </td><td align=left>nobody owns the tile</td></tr>
 
@@ -75,13 +75,13 @@
 
   <td align=left>&nbsp;<strong>Ground </strong></td>
 
  </tr>
 
  <tr>
 
   <td valign=top nowrap>&nbsp;</td>
 
   <td>
 
    <ul>
 
     <li>m1: <a href="#OwnershipInfo">owner</a> of the tile (normally <tt>10</tt>)</li>
 
     <li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the tile (normally <tt>10</tt>)</li>
 
     <li>m2: see fields</li>
 
     <li>m3 bits 3..0: see fields</li>
 
     <li>m3 bit 4: set if the tile is covered with snow</li>
 
     <li>m4 bits 7..5: type of hedge on the SW border of the tile (1 through 6, or 0=none)</li>
 
     <li>m4 bits 4..2: same as 7..5, but for the SE border</li>
 
     <li>m5 bits 7..5: update counter, incremented on every periodic processing for tile types,
 
@@ -180,13 +180,13 @@
 
   <td><strong>Railway tracks</strong></td>
 
  </tr>
 
  <tr>
 
   <td valign=top nowrap>&nbsp;</td>
 
   <td>
 
    <ul>
 
     <li>m1: <a href="#OwnershipInfo">owner</a> of the tile</li>
 
     <li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the tile</li>
 
     <li>m2: see signals</li>
 
     <li>m3 bits 7..4: see signals</li>
 
     <li>m3 bits 3..0 = <a name="TrackType">track type</a>:
 
      <table>
 
       <tr>
 
        <td><tt>0</tt>&nbsp; </td>
 
@@ -545,13 +545,13 @@
 
         </tr>
 
        </table>
 
       </li>
 
       <li>m3 bits 7..4: <a href="#OwnershipInfo">owner</a> of road type 1 (tram); OWNER_NONE (<tt>10</tt>) is stored as OWNER_TOWN (<tt>0F</tt>)
 
       <li>m5 bit 6 clear: road
 
        <ul>
 
         <li>m1: <a href="#OwnershipInfo">owner</a> of the road type 0 (normal road)</li>
 
         <li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the road type 0 (normal road)</li>
 
         <li>m7 bits 3..0: counter for the roadworks</li>
 
         <li>m5 bits 3..0: road layout road type 0 (normal road): bit set = road piece present:
 
          <table>
 
           <tr>
 
            <td align=left>bit 0: </td>
 
            <td>NW piece</td>
 
@@ -584,13 +584,13 @@
 
          </table>
 
         </li>
 
        </ul>
 
       </li>
 
       <li>m5 bit 6 set: level crossing
 
        <ul>
 
         <li>m1: <a href="#OwnershipInfo">owner</a> of the railway track</li>
 
         <li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the railway track</li>
 
         <li>m3 bits 3..0: <a href="#TrackType">railway track type</a></li>
 
         <li>m5 bit 0: direction
 
          <table>
 
           <tr>
 
            <td align=left><tt>0</tt>&nbsp; </td>
 
            <td align=left>road in the X direction, rail in Y</td>
 
@@ -607,13 +607,13 @@
 
        </ul>
 
       </li>
 
      </ul>
 
     </li>
 
     <li>m5 bit 7 set, bit 6 clear: road depot
 
      <ul>
 
       <li>m1: <a href="#OwnershipInfo">owner</a> of the depot</li>
 
       <li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the depot</li>
 
       <li>m2: Depot index</li>
 
       <li>m5 bits 3..0: exit towards:
 
        <table>
 
         <tr>
 
          <td><tt>0</tt>&nbsp; </td>
 
          <td>NE</td>
 
@@ -720,13 +720,13 @@
 
   <td><strong>Trees </strong></td>
 
  </tr>
 
  <tr>
 
   <td valign=top nowrap>&nbsp;</td>
 
   <td>
 
    <ul>
 
     <li>m1: <a href="#OwnershipInfo">owner</a> (normally <tt>10</tt>)</li>
 
     <li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> (normally <tt>10</tt>)</li>
 
     <li>m2 bits 8..6: ground
 
      <table>
 

	
 
       <tr>
 
        <td align=left><tt>0</tt>&nbsp; </td>
 
        <td>on grass</td>
 
@@ -819,18 +819,18 @@
 
   <td><strong>Station tiles</strong></td>
 
  </tr>
 
  <tr>
 
   <td valign=top nowrap>&nbsp;</td>
 
   <td>
 
    <ul>
 
     <li>m1: <a href="#OwnershipInfo">owner</a> of the station</li>
 
     <li>m1 bits 6..5: water class for buoys, water part of docks and for airport tiles</li>
 
     <li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the station</li>
 
     <li>m2: index into the array of stations</li>
 
     <li>m3 bits 7..4: persistent random data for railway stations/waypoints and airports)</li>
 
     <li>m3 bits 7..4: <a href="#OwnershipInfo">owner</a> of tram tracks (road stop)</li>
 
     <li>m3 bits 3..0: <a href="#TrackType">track type</a> for railway stations/waypoints</li>
 
     <li>m3 bits 1..0: water class for buoys, water part of docks and for airport tiles</li>
 
     <li>m4: custom station id; 0 means standard graphics</li>
 
     <li>m5: graphics index (range from 0..255 for each station type):
 
      <table>
 
       <tr>
 
        <td nowrap valign=top><tt>00</tt>..<tt>07</tt>&nbsp; </td>
 
        <td align=left>railway station
 
@@ -956,15 +956,15 @@
 
   <td><strong>Water</strong></td>
 
  </tr>
 
  <tr>
 
   <td valign=top nowrap>&nbsp;</td>
 
   <td>
 
    <ul>
 
     <li>m1: <a href="#OwnershipInfo">owner</a> (for sea, rivers, and coasts normally <tt>11</tt>)</li>
 
     <li>m1 bits 6..5 : Water class (sea, canal or river)
 
     <li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> (for sea, rivers, and coasts normally <tt>11</tt>)</li>
 
     <li>m2: Depot index (for depots only)</li>
 
     <li>m3 bits 1..0 : Water class (sea, canal or river)
 
     <li>m4: Random data for canal or river tiles</li>
 
     <li>m5: tile type:
 
      <table>
 
       <tr>
 
        <td nowrap valign=top><tt>00</tt>&nbsp; </td>
 
        <td align=left>water, canal or river</td>
 
@@ -1410,13 +1410,13 @@
 
   <td><strong>Tunnel / bridge</strong></td>
 
  </tr>
 
  <tr>
 
   <td valign=top nowrap>&nbsp;</td>
 
   <td>
 
    <ul>
 
     <li>m1: <a href="#OwnershipInfo">owner</a></li>
 
     <li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a></li>
 
     <li>m3 bits 7..4: <a href="#OwnershipInfo">owner</a> of tram</li>
 
     <li>m3 bits 3..0: <a href="#TrackType">track type</a> for railway</li>
 
     <li>m5 bit 4: pbs reservation state for railway</li>
 
     <li>m5 bits 7 clear: tunnel entrance/exit</li>
 
     <li>m5 bit 7 set: bridge ramp
 
      <ul>
 
@@ -1563,13 +1563,14 @@
 
   <td><strong><tt>Objects</tt></strong></td>
 
  </tr>
 
  <tr>
 
   <td valign=top nowrap>&nbsp;</td>
 
   <td>
 
    <ul>
 
     <li>m1: <a href="#OwnershipInfo">owner</a> of the object (for lighthouses and transmitters normally <tt>10</tt>)</li>
 
     <li>m1 bits 6..5 : Water class (sea, canal, river or land)
 
     <li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the object (for lighthouses and transmitters normally <tt>10</tt>)</li>
 
     <li>m2: see company statue
 
     <li>m3: offset to northern most tile
 
     <li>m5: tile type:
 
      <table>
 
       <tr>
 
        <td nowrap valign=top><tt>00</tt>&nbsp; </td>
docs/landscape_grid.html
Show inline comments
 
@@ -63,36 +63,36 @@ the array so you can quickly see what is
 
      <td class="bits">7654 3210</td>
 
    </tr>
 
    <tr>
 
      <td rowspan="2">0</td>
 
      <td class="caption">ground</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="option">~~~~ ~~~~</span></td>
 
      <td class="bits"><span class="free">OOO</span><span class="option">~ ~~~~</span></td>
 
      <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
 
      <td class="bits"><span class="free">OOO</span>X <span class="free">OOOO</span></td>
 
      <td class="bits">XXXX XX<span class="free">OO</span></td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits">XX<span class="free">OO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
    </tr>
 
    <tr>
 
      <td class="caption">farmland</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits"><span class="option">~~~~ ~~~~</span></td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">XXXX XXXX XXXX XXXX</td>
 
      <td class="bits"><span class="free">OOO</span>X XXXX</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">XX<span class="free">OO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
    </tr>
 
    <tr>
 
      <td rowspan=3>1</td>
 
      <td class="caption">rail</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="option">~~~</span>X XXXX</td>
 
      <td class="bits"><span class="free">OOO</span>X XXXX</td>
 
      <td class="bits"><span class="free">OOOO</span> XXXX <span class="free">OOOO OOOO</span></td>
 
      <td class="bits"><span class="free">OOOO</span> XXXX</td>
 
      <td class="bits"><span class="free">OOOO</span> XXXX</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits">XX<span class="free">OO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
@@ -120,13 +120,13 @@ the array so you can quickly see what is
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
    </tr>
 
    <tr>
 
      <td rowspan=3>2</td>
 
      <td class="caption">road</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="option">~~~</span>X XXXX</td>
 
      <td class="bits"><span class="free">OOO</span>X XXXX</td>
 
      <td class="bits">XXXX XXXX XXXX XXXX</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits">XXXX X<span class="free">O</span>XX</td>
 
      <td class="bits">XXX<span class="free">O</span> XXXX</td>
 
@@ -166,25 +166,25 @@ the array so you can quickly see what is
 
      <td class="bits">XXXX <span class="abuse">XXXX</span></td>
 
    </tr>
 
    <tr>
 
      <td>4</td>
 
      <td class="caption">trees</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="option">~~~~ ~~~~</span></td>
 
      <td class="bits"><span class="free">OOO</span><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">XXXX XX<span class="free">OO</span></td>
 
      <td class="bits">XX<span class="free">OO O</span>XXX</td>
 
      <td class="bits"><span class="free">OOOO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
    </tr>
 
    <tr>
 
      <td rowspan=7>5</td>
 
      <td class="caption">rail station</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="option">~~~</span>X XXXX</td>
 
      <td class="bits"><span class="free">O</span>XXX XXXX</td>
 
      <td class="bits">XXXX XXXX XXXX XXXX</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="free">OO</span>XX XXXX</td>
 
      <td class="bits">XXXX XXXX</td>
 
@@ -213,35 +213,35 @@ the array so you can quickly see what is
 
    </tr>
 
    <tr>
 
      <td class="caption">dock</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits"><span class="free">OOOO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits"><span class="option">~~~~ ~</span>XXX</td>
 
      <td class="bits"><span class="free">OO</span>XX X<span class="free">O</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
    </tr>
 
    <tr>
 
      <td class="caption">airport</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">XXXX <span class="free">OO</span>XX</td>
 
      <td class="bits">XXXX <span class="free">OOOO</span></td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="free">OO</span>XX X<span class="free">O</span>XX</td>
 
      <td class="bits">XXXX XXXX</td>
 
    </tr>
 
    <tr>
 
      <td class="caption">buoy</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits"><span class="free">OOOO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits"><span class="option">~~~~ ~~~~</span></td>
 
      <td class="bits"><span class="free">OO</span>XX X<span class="free">O</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
    </tr>
 
    <tr>
 
@@ -256,37 +256,37 @@ the array so you can quickly see what is
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
    </tr>
 
    <tr>
 
      <td rowspan=3>6</td>
 
      <td class="caption">sea, shore</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="option">~~~</span>X XXXX</td>
 
      <td class="bits"><span class="free">O</span>XXX XXXX</td>
 
      <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
 
      <td class="bits"><span class="free">OOOO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits">X<span class="option">~~</span>X XXXX</td>
 
      <td class="bits">XX<span class="free">OO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
    </tr>
 
    <tr>
 
      <td class="caption">canal, river</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
 
      <td class="bits"><span class="free">OOOO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">XX<span class="free">OO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
    </tr>
 
    <tr>
 
      <td class="caption">shipdepot</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">XXXX XXXX XXXX XXXX</td>
 
      <td class="bits"><span class="free">OOOO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits">-inherit-</td>
 
      <td class="bits">XX<span class="free">OO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
    </tr>
 
    <tr>
 
@@ -303,13 +303,13 @@ the array so you can quickly see what is
 
      <td class="bits">XXXX XXXX</td>
 
    </tr>
 
    <tr>
 
      <td rowspan=2>9</td>
 
      <td class="caption">tunnel entrance</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="option">~~~</span>X XXXX</td>
 
      <td class="bits"><span class="free">OOO</span>X XXXX</td>
 
      <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits">X<span class="free">OO</span>X XXXX</td>
 
      <td class="bits">XX<span class="free">OO OO</span>XX</td>
 
      <td class="bits">XXXX X<span class="free">O</span>XX</td>
 
@@ -326,13 +326,13 @@ the array so you can quickly see what is
 
      <td class="bits">-inherit-</td>
 
    </tr>
 
    <tr>
 
      <td rowspan=2>A</td>
 
      <td class="caption">objects</td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="option">~~~</span>X XXXX</td>
 
      <td class="bits"><span class="free">O</span>XXX XXXX</td>
 
      <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
 
      <td class="bits"><span class="free">OOO</span>X XXXX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits">XX<span class="free">OO OO</span>XX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></td>
src/clear_map.h
Show inline comments
 
@@ -274,12 +274,13 @@ static inline void MakeClear(TileIndex t
 
{
 
	/* If this is a non-bridgeable tile, clear the bridge bits while the rest
 
	 * of the tile information is still here. */
 
	if (!MayHaveBridgeAbove(t)) SB(_m[t].m6, 6, 2, 0);
 

	
 
	SetTileType(t, MP_CLEAR);
 
	_m[t].m1 = 0;
 
	SetTileOwner(t, OWNER_NONE);
 
	_m[t].m2 = 0;
 
	_m[t].m3 = 0;
 
	_m[t].m4 = 0 << 5 | 0 << 2;
 
	SetClearGroundDensity(t, g, density); // Sets m5
 
	SB(_m[t].m6, 2, 4, 0); // Other bits are "tropic zone" and "bridge above"
 
@@ -293,12 +294,13 @@ static inline void MakeClear(TileIndex t
 
 * @param field_type the 'growth' level of the field
 
 * @param industry   the industry this tile belongs to
 
 */
 
static inline void MakeField(TileIndex t, uint field_type, IndustryID industry)
 
{
 
	SetTileType(t, MP_CLEAR);
 
	_m[t].m1 = 0;
 
	SetTileOwner(t, OWNER_NONE);
 
	_m[t].m2 = industry;
 
	_m[t].m3 = field_type;
 
	_m[t].m4 = 0 << 5 | 0 << 2;
 
	SetClearGroundDensity(t, CLEAR_FIELDS, 3);
 
	SB(_m[t].m6, 2, 4, 0);
src/object_cmd.cpp
Show inline comments
 
@@ -50,13 +50,13 @@ void BuildObject(ObjectType type, TileIn
 
{
 
	const ObjectSpec *spec = ObjectSpec::Get(type);
 

	
 
	TileArea ta(tile, GB(spec->size, 0, 4), GB(spec->size, 4, 4));
 
	TILE_AREA_LOOP(t, ta) {
 
		TileIndex offset = t - tile;
 
		MakeObject(t, type, owner, TileY(offset) << 4 | TileX(offset), index);
 
		MakeObject(t, type, owner, TileY(offset) << 4 | TileX(offset), index, WATER_CLASS_INVALID);
 
		MarkTileDirtyByTile(t);
 
	}
 
}
 

	
 
/**
 
 * Increase the animation stage of a whole structure.
src/object_map.h
Show inline comments
 
@@ -10,12 +10,13 @@
 
/** @file object_map.h Map accessors for object tiles. */
 

	
 
#ifndef OBJECT_MAP_H
 
#define OBJECT_MAP_H
 

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

	
 
/**
 
 * Gets the ObjectType of the given object tile
 
 * @param t the tile to get the type from.
 
 * @pre IsTileType(t, MP_OBJECT)
 
@@ -159,17 +160,19 @@ static inline void SetObjectOffset(TileI
 
 * @note do not use this function directly. Use one of the other Make* functions.
 
 * @param t      The tile to make and object tile.
 
 * @param u      The object type of the tile.
 
 * @param o      The new owner of the tile.
 
 * @param offset The offset to the northern tile of this object.
 
 * @param index  Generic index associated with the object type.
 
 * @param wc     Water class for this obect.
 
 */
 
static inline void MakeObject(TileIndex t, ObjectType u, Owner o, uint8 offset, uint index)
 
static inline void MakeObject(TileIndex t, ObjectType u, Owner o, uint8 offset, uint index, WaterClass wc)
 
{
 
	SetTileType(t, MP_OBJECT);
 
	SetTileOwner(t, o);
 
	SetWaterClass(t, wc);
 
	_m[t].m2 = index;
 
	_m[t].m3 = offset;
 
	_m[t].m4 = 0;
 
	_m[t].m5 = u;
 
	SB(_m[t].m6, 2, 4, 0);
 
	_me[t].m7 = 0;
src/saveload/afterload.cpp
Show inline comments
 
@@ -1540,12 +1540,47 @@ bool AfterLoadGame()
 
				if (company == INVALID_COMPANY) continue;
 
				if (!Company::IsValidID(company) || company == c->index) c->share_owners[i] = INVALID_COMPANY;
 
			}
 
		}
 
	}
 

	
 
	/* The water class was moved/unified. */
 
	if (CheckSavegameVersion(146)) {
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			switch (GetTileType(t)) {
 
				case MP_STATION:
 
					switch (GetStationType(t)) {
 
						case STATION_OILRIG:
 
						case STATION_DOCK:
 
						case STATION_BUOY:
 
							SetWaterClass(t, (WaterClass)GB(_m[t].m3, 0, 2));
 
							SB(_m[t].m3, 0, 2, 0);
 
							break;
 

	
 
						default:
 
							SetWaterClass(t, WATER_CLASS_INVALID);
 
							break;
 
					}
 
					break;
 

	
 
				case MP_WATER:
 
					SetWaterClass(t, (WaterClass)GB(_m[t].m3, 0, 2));
 
					SB(_m[t].m3, 0, 2, 0);
 
					break;
 

	
 
				case MP_OBJECT:
 
					SetWaterClass(t, WATER_CLASS_INVALID);
 
					break;
 

	
 
				default:
 
					/* No water class. */
 
					break;
 
			}
 
		}
 
	}
 

	
 
	if (CheckSavegameVersion(86)) {
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			/* Move river flag and update canals to use water class */
 
			if (IsTileType(t, MP_WATER)) {
 
				if (GetWaterClass(t) != WATER_CLASS_RIVER) {
 
					if (IsWater(t)) {
 
@@ -2150,18 +2185,12 @@ bool AfterLoadGame()
 

	
 
	if (CheckSavegameVersion(142)) {
 
		Depot *d;
 
		FOR_ALL_DEPOTS(d) d->build_date = _date;
 
	}
 

	
 
	if (CheckSavegameVersion(145)) {
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			if (IsAirportTile(t)) SetWaterClass(t, WATER_CLASS_INVALID);
 
		}
 
	}
 

	
 
	/* Road stops is 'only' updating some caches */
 
	AfterLoadRoadStops();
 
	AfterLoadLabelMaps();
 

	
 
	GamelogPrintDebug(1);
 

	
src/saveload/saveload.cpp
Show inline comments
 
@@ -206,14 +206,15 @@
 
 *  140   19382
 
 *  141   19799
 
 *  142   20003
 
 *  143   20048
 
 *  144   20334
 
 *  145   20376
 
 *  146   20446
 
 */
 
extern const uint16 SAVEGAME_VERSION = 145; ///< current savegame version of OpenTTD
 
extern const uint16 SAVEGAME_VERSION = 146; ///< current savegame version of OpenTTD
 

	
 
SavegameType _savegame_type; ///< type of savegame we are loading
 

	
 
uint32 _ttdp_version;     ///< version of TTDP savegame (if applicable)
 
uint16 _sl_version;       ///< the major savegame version identifier
 
byte   _sl_minor_version; ///< the minor savegame version, DO NOT USE!
src/station_map.h
Show inline comments
 
@@ -550,13 +550,13 @@ static inline byte GetStationTileRandomB
 
 * @param t the tile to make a station tile
 
 * @param o the owner of the station
 
 * @param sid the station to which this tile belongs
 
 * @param st the type this station tile
 
 * @param section the StationGfx to be used for this tile
 
 */
 
static inline void MakeStation(TileIndex t, Owner o, StationID sid, StationType st, byte section)
 
static inline void MakeStation(TileIndex t, Owner o, StationID sid, StationType st, byte section, WaterClass wc = WATER_CLASS_INVALID)
 
{
 
	SetTileType(t, MP_STATION);
 
	SetTileOwner(t, o);
 
	_m[t].m2 = sid;
 
	_m[t].m3 = 0;
 
	_m[t].m4 = 0;
 
@@ -641,14 +641,13 @@ static inline void MakeDriveThroughRoadS
 
 * @param sid the station to which this tile belongs
 
 * @param section the StationGfx to be used for this tile
 
 * @param wc the type of water on this tile
 
 */
 
static inline void MakeAirport(TileIndex t, Owner o, StationID sid, byte section, WaterClass wc)
 
{
 
	MakeStation(t, o, sid, STATION_AIRPORT, section);
 
	SetWaterClass(t, wc);
 
	MakeStation(t, o, sid, STATION_AIRPORT, section, wc);
 
}
 

	
 
/**
 
 * Make the given tile a buoy tile.
 
 * @param t the tile to make a buoy
 
 * @param sid the station to which this tile belongs
 
@@ -656,14 +655,13 @@ static inline void MakeAirport(TileIndex
 
 */
 
static inline void MakeBuoy(TileIndex t, StationID sid, WaterClass wc)
 
{
 
	/* Make the owner of the buoy tile the same as the current owner of the
 
	 * water tile. In this way, we can reset the owner of the water to its
 
	 * original state when the buoy gets removed. */
 
	MakeStation(t, GetTileOwner(t), sid, STATION_BUOY, 0);
 
	SetWaterClass(t, wc);
 
	MakeStation(t, GetTileOwner(t), sid, STATION_BUOY, 0, wc);
 
}
 

	
 
/**
 
 * Make the given tile a dock tile.
 
 * @param t the tile to make a dock
 
 * @param o the owner of the dock
 
@@ -671,23 +669,21 @@ static inline void MakeBuoy(TileIndex t,
 
 * @param d the direction of the dock
 
 * @param wc the type of water on this tile
 
 */
 
static inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
 
{
 
	MakeStation(t, o, sid, STATION_DOCK, d);
 
	MakeStation(t + TileOffsByDiagDir(d), o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d));
 
	SetWaterClass(t + TileOffsByDiagDir(d), wc);
 
	MakeStation(t + TileOffsByDiagDir(d), o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc);
 
}
 

	
 
/**
 
 * Make the given tile an oilrig tile.
 
 * @param t the tile to make an oilrig
 
 * @param sid the station to which this tile belongs
 
 * @param wc the type of water on this tile
 
 */
 
static inline void MakeOilrig(TileIndex t, StationID sid, WaterClass wc)
 
{
 
	MakeStation(t, OWNER_NONE, sid, STATION_OILRIG, 0);
 
	SetWaterClass(t, wc);
 
	MakeStation(t, OWNER_NONE, sid, STATION_OILRIG, 0, wc);
 
}
 

	
 
#endif /* STATION_MAP_H */
src/tile_map.h
Show inline comments
 
@@ -139,13 +139,13 @@ static inline bool IsValidTile(TileIndex
 
static inline Owner GetTileOwner(TileIndex tile)
 
{
 
	assert(IsValidTile(tile));
 
	assert(!IsTileType(tile, MP_HOUSE));
 
	assert(!IsTileType(tile, MP_INDUSTRY));
 

	
 
	return (Owner)_m[tile].m1;
 
	return (Owner)GB(_m[tile].m1, 0, 5);
 
}
 

	
 
/**
 
 * Sets the owner of a tile
 
 *
 
 * This function sets the owner status of a tile. Note that you cannot
 
@@ -159,13 +159,13 @@ static inline Owner GetTileOwner(TileInd
 
static inline void SetTileOwner(TileIndex tile, Owner owner)
 
{
 
	assert(IsValidTile(tile));
 
	assert(!IsTileType(tile, MP_HOUSE));
 
	assert(!IsTileType(tile, MP_INDUSTRY));
 

	
 
	_m[tile].m1 = owner;
 
	SB(_m[tile].m1, 0, 5, owner);
 
}
 

	
 
/**
 
 * Checks if a tile belongs to the given owner
 
 *
 
 * @param tile The tile to check
src/water_map.h
Show inline comments
 
@@ -69,29 +69,25 @@ static inline WaterTileType GetWaterTile
 
 * Get the water class at a tile.
 
 * @param t Water tile to query.
 
 * @return Water class at the tile.
 
 */
 
static inline WaterClass GetWaterClass(TileIndex t)
 
{
 
	assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY));
 
	return (WaterClass)(IsTileType(t, MP_INDUSTRY) ? GB(_m[t].m1, 5, 2) : GB(_m[t].m3, 0, 2));
 
	assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT));
 
	return (WaterClass)GB(_m[t].m1, 5, 2);
 
}
 

	
 
/**
 
 * Set the water class at a tile.
 
 * @param t  Water tile to change.
 
 * @param wc New water class.
 
 */
 
static inline void SetWaterClass(TileIndex t, WaterClass wc)
 
{
 
	assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY));
 
	if (IsTileType(t, MP_INDUSTRY)) {
 
		SB(_m[t].m1, 5, 2, wc);
 
	} else {
 
		SB(_m[t].m3, 0, 2, wc);
 
	}
 
	assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT));
 
	SB(_m[t].m1, 5, 2, wc);
 
}
 

	
 
/**
 
 * Is it a plain water tile?
 
 * @param t Water tile to query.
 
 * @return \c true if any type of clear water like ocean, river, or canal.
 
@@ -248,12 +244,13 @@ static inline byte GetWaterTileRandomBit
 
 * @param t The tile to change into water
 
 */
 
static inline void MakeShore(TileIndex t)
 
{
 
	SetTileType(t, MP_WATER);
 
	SetTileOwner(t, OWNER_WATER);
 
	SetWaterClass(t, WATER_CLASS_SEA);
 
	_m[t].m2 = 0;
 
	_m[t].m3 = 0;
 
	_m[t].m4 = 0;
 
	_m[t].m5 = 1;
 
	SB(_m[t].m6, 2, 4, 0);
 
	_me[t].m7 = 0;
 
@@ -267,14 +264,15 @@ static inline void MakeShore(TileIndex t
 
 * @param random_bits Eventual random bits to be set for this tile
 
 */
 
static inline void MakeWater(TileIndex t, Owner o, WaterClass wc, uint8 random_bits)
 
{
 
	SetTileType(t, MP_WATER);
 
	SetTileOwner(t, o);
 
	SetWaterClass(t, wc);
 
	_m[t].m2 = 0;
 
	_m[t].m3 = wc;
 
	_m[t].m3 = 0;
 
	_m[t].m4 = random_bits;
 
	_m[t].m5 = 0;
 
	SB(_m[t].m6, 2, 4, 0);
 
	_me[t].m7 = 0;
 
}
 

	
 
@@ -319,14 +317,15 @@ static inline void MakeCanal(TileIndex t
 
 * @param original_water_class Original water class.
 
 */
 
static inline void MakeShipDepot(TileIndex t, Owner o, DepotID did, DepotPart base, Axis a, WaterClass original_water_class)
 
{
 
	SetTileType(t, MP_WATER);
 
	SetTileOwner(t, o);
 
	SetWaterClass(t, original_water_class);
 
	_m[t].m2 = did;
 
	_m[t].m3 = original_water_class;
 
	_m[t].m3 = 0;
 
	_m[t].m4 = 0;
 
	_m[t].m5 = base + a * 2;
 
	SB(_m[t].m6, 2, 4, 0);
 
	_me[t].m7 = 0;
 
}
 

	
 
@@ -339,14 +338,15 @@ static inline void MakeShipDepot(TileInd
 
 * @see MakeLock
 
 */
 
static inline void MakeLockTile(TileIndex t, Owner o, byte section, WaterClass original_water_class)
 
{
 
	SetTileType(t, MP_WATER);
 
	SetTileOwner(t, o);
 
	SetWaterClass(t, original_water_class);
 
	_m[t].m2 = 0;
 
	_m[t].m3 = original_water_class;
 
	_m[t].m3 = 0;
 
	_m[t].m4 = 0;
 
	_m[t].m5 = section;
 
	SB(_m[t].m6, 2, 4, 0);
 
	_me[t].m7 = 0;
 
}
 

	
0 comments (0 inline, 0 general)