summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-11-12 22:39:00 +0000
committerdarkvater <darkvater@openttd.org>2004-11-12 22:39:00 +0000
commit2ab466925142222fa69062acaa36034453684bfb (patch)
tree0fe19b1850b752d302ccb9ffdde8fbbd47d97287
parent27b48faad23735c38fd4dcc6b85f5edcaf786cbb (diff)
downloadopenttd-2ab466925142222fa69062acaa36034453684bfb.tar.xz
(svn r555) -newgrf: Preliminary support for action 0xE. Inhibit another GRF file by ID. It won't really work until we get stages support (pasky & octo).
-rw-r--r--grfspecial.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/grfspecial.c b/grfspecial.c
index d0d948174..153c025bb 100644
--- a/grfspecial.c
+++ b/grfspecial.c
@@ -1230,7 +1230,26 @@ static void GRFInhibit(byte *buf, int len)
*
* B num Number of GRFIDs that follow
* D grfids GRFIDs of the files to deactivate */
- /* TODO */
+ /* XXX: Should we handle forward deactivations? */
+ /* XXX: Even so will fully work only with stages support. */
+
+ byte num;
+ int i;
+
+ check_length(len, 1, "GRFInhibit");
+ num = grf_load_byte(&buf); len--;
+ check_length(len, 4 * num, "GRFInhibit");
+
+ for (i = 0; i < num; i++) {
+ uint32 grfid = grf_load_dword(&buf);
+ struct GRFFile *file = GetFileByGRFID(grfid);
+
+ /* Unset activation flag */
+ if (file != NULL) {
+ grfmsg(GMS_NOTICE, "GRFInhibit: Deactivating file ``%s''", file->filename);
+ file->flags &= 0xFFFE;
+ }
+ }
}
@@ -1322,7 +1341,8 @@ void DecodeSpecialSprite(int num, int spriteid)
action = buf[0];
if (action < NUM_ACTIONS) {
- handlers[action](buf, num);
+ if (_cur_grffile->flags & 0x0001)
+ handlers[action](buf, num);
} else {
grfmsg(GMS_WARN, "Unknown special sprite action %x, skipping.", action);
}