diff options
author | frosch <frosch@openttd.org> | 2013-10-12 16:31:31 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2013-10-12 16:31:31 +0000 |
commit | 60f483822f07e6b3e0b680ebe9353ccefa9c2c52 (patch) | |
tree | a7828e0cc7f9defde4c0557e02ca0169461fe44b /src/newgrf.cpp | |
parent | 35d7e8bca4e24bc211ed24d07fba62193d5f5f31 (diff) | |
download | openttd-60f483822f07e6b3e0b680ebe9353ccefa9c2c52.tar.xz |
(svn r25834) -Codechange: Use NUM_OBJECTS_PER_GRF instead of NUM_OBJECTS to properly distinguish limits per NewGRF and limits of the pool.
-Change: [NewGRF] Lower the limit of object types per NewGRF from 256 to 255 to prevent usage of ID 0xFF in Action3, and thus allowing it to become an extended byte somewhen.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r-- | src/newgrf.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index e32ba1a15..6a5e41330 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -3773,14 +3773,14 @@ static ChangeInfoResult ObjectChangeInfo(uint id, int numinfo, int prop, ByteRea { ChangeInfoResult ret = CIR_SUCCESS; - if (id + numinfo > NUM_OBJECTS) { - grfmsg(1, "ObjectChangeInfo: Too many objects loaded (%u), max (%u). Ignoring.", id + numinfo, NUM_OBJECTS); + if (id + numinfo > NUM_OBJECTS_PER_GRF) { + grfmsg(1, "ObjectChangeInfo: Too many objects loaded (%u), max (%u). Ignoring.", id + numinfo, NUM_OBJECTS_PER_GRF); return CIR_INVALID_ID; } /* Allocate object specs if they haven't been allocated already. */ if (_cur.grffile->objectspec == NULL) { - _cur.grffile->objectspec = CallocT<ObjectSpec*>(NUM_OBJECTS); + _cur.grffile->objectspec = CallocT<ObjectSpec*>(NUM_OBJECTS_PER_GRF); } for (int i = 0; i < numinfo; i++) { @@ -7882,7 +7882,7 @@ static void ResetCustomObjects() for (GRFFile **file = _grf_files.Begin(); file != end; file++) { ObjectSpec **&objectspec = (*file)->objectspec; if (objectspec == NULL) continue; - for (uint i = 0; i < NUM_OBJECTS; i++) { + for (uint i = 0; i < NUM_OBJECTS_PER_GRF; i++) { free(objectspec[i]); } @@ -8552,7 +8552,7 @@ static void FinaliseObjectsArray() for (GRFFile **file = _grf_files.Begin(); file != end; file++) { ObjectSpec **&objectspec = (*file)->objectspec; if (objectspec != NULL) { - for (int i = 0; i < NUM_OBJECTS; i++) { + for (int i = 0; i < NUM_OBJECTS_PER_GRF; i++) { if (objectspec[i] != NULL && objectspec[i]->grf_prop.grffile != NULL && objectspec[i]->enabled) { _object_mngr.SetEntitySpec(objectspec[i]); } |