SpriteErrors

From GRFSpecs
Jump to: navigation, search

Introduction

This page explains the error messages that may be generated due to incorrect pseudo-sprite data. It does not include the messages that are only generated by an action B.

All information on this page only applies to TTDPatch. OpenTTD has different error messages which are shown as plain text without numeric error codes.

List of sprite error messages

Message Meaning
More sprites than specified The file contains more sprites than the first pseudo-sprite specifies
Out of memory TTDPatch could not read the sprite data because it ran out of memory
Wrong .grf version Either the action 8 requires a different grf version, the file had no action 8, or the sprite uses an action that is not valid before action 8
Cannot load more sprites The limit of active sprites has been exceeded
File file not found The file was listed in newgrf(w).cfg but could not be opened
File file has invalid sprite #nr (code code/pos) The pseudo-sprite data of the given sprite is invalid; see below for explanation of code and pos
File file is not a TTDPatch graphics file The first sprite is not a pseudo-sprite, or it does not specify a valid number of sprites

Invalid sprites

A pseudo-sprite has invalid data, if it does not follow the specifications of each action correctly. In this error message (starting with TTDPatch 2.0.1 alpha 46), the code defines what kind of error occured, and the position pos in most cases (i.e. whenever possible) points to the byte in the sprite that follows the one which triggered the error.

Code Meaning
1 A real graphics sprite was encountered where a pseudo sprite was expected
2 The sprite uses an unknown action type, or this action is not valid before an action 8
3 The sprite uses an unknown feature
4 The sprite refers to an invalid vehicle/text/town part ID
5 The sprite has fewer bytes than expected
6 The given property number in action 0 is invalid
7 The sprite block following action 1/5/A/11/12 would go beyond the end of the file
8 The feature types of action 1, 2 and 3 don't agree
9 Action 2 refers to an action 1 sprite block that is beyond the size of the most recent action 1 sprite block
10 Action 2 (var./random) or action 3 refers to an action 2 cargo-id that hasn't been defined yet
11 Action 7, 9 or D refers to an invalid variable number
12 The grf file has multiple action 8 entries
13 Action A refers to an invalid TTD sprite
14 The message severity in action B is invalid
15 The message type in action B is invalid
16 The operation type in action D is invalid
17 Action E is trying to deactivate an already-active file
18 The number of parts in action F is zero when it must not be zero
19 The bit number or count in action F is invalid
20 Invalid label number in action 10
21 Resource not valid for action D (ID out of range, or invalid for this resource type)
22 Multiple action 11 present in GRF file, there may only be one
23 A sprite that is part of action 11 is not a binary include file
24 Attempt to modify ID not reserved with GRM (only with experimentalfeatures.mandatorygrm on)
25 Invalid font number in action 12
26 Range crosses 128-character block, must be split
27 Invalid property value in action 0
28 Invalid condition type in action 7/9
29 Invalid industry tile ID in industry layout
30 Inconsistent industry layout size
31 Invalid subid in action3

Note, if you do not see the code or the position, you need to edit your ttdpttxt.txt file, and change the "invalidsprite" line into the following format (and then rerun mkpttxt.exe):

invalidsprite="\94File \"\80\" has invalid sprite #\7c (code \7c/\7c).\00"

Resource conflicts

If a GRF file attempts to allocate a resource that is not available, it will be deactivated and the following message will be shown: "GRF conflict with <other-grf> (resource <r-id> at sprite <num>)".

The following resources can cause conflicts. Numbers 0 and above are allocated by a GRM action D, negative numbers are automatically allocated by an action 0 (IDs), action 4 (persistent GRF texts) or actions 1/5/D/12 (sprites).

r-id(s) Resource
-12 Duplicate GRFID
-11 Persistent GRF texts
-10 New industries
-9 New industry tiles
-8 New houses
-7 New stations
-6 House sprites
-5 Plane sprites
-4 Ship sprites
-3 Road vehicle sprites
-2 Train sprites
-1 "Other" sprites
0..255 Vehicle IDs
256..287 Cargo IDs
288..319 Cargo bits