# HG changeset patch # User darkvater # Date 1100299140 0 # Node ID d0d895bd49722f647659b9109097b471d4c47ab8 # Parent 9d2630b8b4de9dabc8637396d9d48aa8ebb9b274 (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). diff -r 9d2630b8b4de -r d0d895bd4972 grfspecial.c --- a/grfspecial.c Fri Nov 12 22:28:19 2004 +0000 +++ b/grfspecial.c Fri Nov 12 22:39:00 2004 +0000 @@ -1230,7 +1230,26 @@ * * 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 @@ 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); }