Changeset - r15941:6fe2ebbf99a4
[Not reviewed]
master
0 4 0
rubidium - 14 years ago 2010-08-27 22:26:21
rubidium@openttd.org
(svn r20639) -Add: random bits to object tiles
4 files changed with 19 insertions and 4 deletions:
0 comments (0 inline, 0 general)
docs/landscape.html
Show inline comments
 
@@ -1596,6 +1596,7 @@
 
     <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: index into the array of objects
 
     <li>m3: random bits
 
     <li>m5: tile type:
 
      <table>
 
       <tr>
docs/landscape_grid.html
Show inline comments
 
@@ -330,7 +330,7 @@ the array so you can quickly see what is
 
      <td class="bits">XXXX XXXX</td>
 
      <td class="bits"><span class="free">O</span>XXX XXXX</td>
 
      <td class="bits">XXXX XXXX XXXX XXXX</td>
 
      <td class="bits"><span class="free">OOOO OOOO</span></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">XX<span class="free">OO OO</span>XX</td>
src/object_cmd.cpp
Show inline comments
 
@@ -63,7 +63,8 @@ void BuildObject(ObjectType type, TileIn
 
	assert(o->town != NULL);
 

	
 
	TILE_AREA_LOOP(t, ta) {
 
		MakeObject(t, type, owner, o->index, WATER_CLASS_INVALID);
 
		WaterClass wc = (IsWaterTile(t) ? GetWaterClass(t) : WATER_CLASS_INVALID);
 
		MakeObject(t, type, owner, o->index, wc, Random());
 
		MarkTileDirtyByTile(t);
 
	}
 
}
src/object_map.h
Show inline comments
 
@@ -105,6 +105,18 @@ static inline bool IsStatueTile(TileInde
 
	return IsTileType(t, MP_OBJECT) && IsStatue(t);
 
}
 

	
 
/**
 
 * Get the random bits of this tile.
 
 * @param t The tile to get the bits for.
 
 * @pre IsTileType(t, MP_OBJECT)
 
 * @return The random bits.
 
 */
 
static inline byte GetObjectRandomBits(TileIndex t)
 
{
 
	assert(IsTileType(t, MP_OBJECT));
 
	return _m[t].m3;
 
}
 

	
 

	
 
/**
 
 * Make an Object tile.
 
@@ -114,14 +126,15 @@ static inline bool IsStatueTile(TileInde
 
 * @param o      The new owner of the tile.
 
 * @param index  Index to the object.
 
 * @param wc     Water class for this obect.
 
 * @param random Random data to store on the tile
 
 */
 
static inline void MakeObject(TileIndex t, ObjectType u, Owner o, ObjectID index, WaterClass wc)
 
static inline void MakeObject(TileIndex t, ObjectType u, Owner o, ObjectID index, WaterClass wc, byte random)
 
{
 
	SetTileType(t, MP_OBJECT);
 
	SetTileOwner(t, o);
 
	SetWaterClass(t, wc);
 
	_m[t].m2 = index;
 
	_m[t].m3 = 0;
 
	_m[t].m3 = random;
 
	_m[t].m4 = 0;
 
	_m[t].m5 = u;
 
	SB(_m[t].m6, 2, 4, 0);
0 comments (0 inline, 0 general)