diff options
author | frosch <frosch@openttd.org> | 2013-10-12 16:35:50 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2013-10-12 16:35:50 +0000 |
commit | 69a0c91d63df017f99137c4d70d69fa32d3822f9 (patch) | |
tree | 4c640ba170bc085cc70013259b62ce4447689463 | |
parent | 29f5eab56cac833ee0c4c6377c74c1c7f17174bf (diff) | |
download | openttd-69a0c91d63df017f99137c4d70d69fa32d3822f9.tar.xz |
(svn r25844) -Change: Increase maximum number of object instances on the map from 64k to about 16M.
-rw-r--r-- | docs/landscape.html | 9 | ||||
-rw-r--r-- | docs/landscape_grid.html | 2 | ||||
-rw-r--r-- | src/object_base.h | 2 | ||||
-rw-r--r-- | src/object_map.h | 4 | ||||
-rw-r--r-- | src/object_type.h | 4 | ||||
-rw-r--r-- | src/saveload/afterload.cpp | 4 |
6 files changed, 13 insertions, 12 deletions
diff --git a/docs/landscape.html b/docs/landscape.html index 0a38b90e4..abf01c9d8 100644 --- a/docs/landscape.html +++ b/docs/landscape.html @@ -1593,13 +1593,14 @@ <td valign=top nowrap> </td> <td> <ul> - <li>m1 bits 6..5 : Water class (sea, canal, river or land) + <li>m1 bits 6..5 : Water class (sea, canal, river or land)</li> <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>m2: index into the array of objects, bits 0 to 15 (upper bits in m5)</li> + <li>m3: random bits</li> + <li>m5: index into the array of objects, bits 16 to 23 (lower bits in m2)</li> <li>m6 bits 7..6 : Possibility of a bridge above, in the <a href="#bridge_direction">direction specified</a></li> <li>m6 bits 1..0 : <a href="#tropic_zone">Tropic zone definition</a></li> - <li>m7: animation counter + <li>m7: animation counter</li> </ul> </td> </tr> diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html index b7603c72d..e2f3c1f97 100644 --- a/docs/landscape_grid.html +++ b/docs/landscape_grid.html @@ -332,7 +332,7 @@ the array so you can quickly see what is used and what is not. <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"><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">XXXX XXXX</td> </tr> diff --git a/src/object_base.h b/src/object_base.h index 676fc9c9c..47e5a7f94 100644 --- a/src/object_base.h +++ b/src/object_base.h @@ -18,7 +18,7 @@ #include "town_type.h" #include "date_type.h" -typedef Pool<Object, ObjectID, 64, 64000> ObjectPool; +typedef Pool<Object, ObjectID, 64, 0xFF0000> ObjectPool; extern ObjectPool _object_pool; /** An object, such as transmitter, on the map. */ diff --git a/src/object_map.h b/src/object_map.h index 3c185b14b..85faf4444 100644 --- a/src/object_map.h +++ b/src/object_map.h @@ -49,7 +49,7 @@ static inline bool IsObjectTypeTile(TileIndex t, ObjectType type) static inline ObjectID GetObjectIndex(TileIndex t) { assert(IsTileType(t, MP_OBJECT)); - return _m[t].m2; + return _m[t].m2 | _m[t].m5 << 16; } /** @@ -81,7 +81,7 @@ static inline void MakeObject(TileIndex t, Owner o, ObjectID index, WaterClass w _m[t].m2 = index; _m[t].m3 = random; _m[t].m4 = 0; - _m[t].m5 = 0; + _m[t].m5 = index >> 16; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } diff --git a/src/object_type.h b/src/object_type.h index 1ebb24d53..4ead576f3 100644 --- a/src/object_type.h +++ b/src/object_type.h @@ -28,11 +28,11 @@ static const ObjectType NUM_OBJECTS = 64000; ///< Number of supported o static const ObjectType INVALID_OBJECT_TYPE = 0xFFFF; ///< An invalid object /** Unique identifier for an object. */ -typedef uint16 ObjectID; +typedef uint32 ObjectID; struct Object; struct ObjectSpec; -static const ObjectID INVALID_OBJECT = 0xFFFF; ///< An invalid object +static const ObjectID INVALID_OBJECT = 0xFFFFFFFF; ///< An invalid object #endif /* OBJECT_TYPE_H */ diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 5f56b0a08..96b568b82 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -2819,9 +2819,9 @@ bool AfterLoadGame() /* Move ObjectType from map to pool */ for (TileIndex t = 0; t < map_size; t++) { if (IsTileType(t, MP_OBJECT)) { - Object *o = Object::GetByTile(t); + Object *o = Object::Get(_m[t].m2); o->type = _m[t].m5; - _m[t].m5 = 0; // cleanup for next usage + _m[t].m5 = 0; // zero upper bits of (now bigger) ObjectID } } } |