This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| functions:newtid [2017/03/19 16:19] – korshun | functions:newtid [2017/04/15 14:29] (current) – korshun | ||
|---|---|---|---|
| Line 9: | Line 9: | ||
| [[zdoom> | [[zdoom> | ||
| - | For example, if you have decided that player tids will range from 1000 to 1063, an incorrect call to UniqueTid like '' | + | For example, if you have decided that player tids will range from 1000 to 1063, an incorrect call to UniqueTid like '' |
| **To correctly use UniqueTid, you need to use the same start value in the whole project.** | **To correctly use UniqueTid, you need to use the same start value in the whole project.** | ||
| - | ==== Zandronum ==== | + | There is also a Zandronum |
| - | + | ||
| - | There is also a Zandronum bug: tids over 32767 are not transmitted to clients. This means that you generally shouldn' | + | |
| ==== The solution ==== | ==== The solution ==== | ||
| - | NewTid is a function designed to solve both these problems. To use NewTid, you first specify the first tid it may allocate using a global #define in your project: | + | NewTid is a function designed to solve both these problems. To use NewTid, you first specify the first tid it may allocate using a global #define in your project, for example: |
| < | < | ||
| Line 28: | Line 26: | ||
| And NewTid() will return safe tids without any parameters required. NewTid() will prefer Zandronum-safe tids (below 32767) and only switch to Zandronum-unsafe tids if all safe tids are occupied, which can only happen if you have spawned an insane amount of actors with different tids. | And NewTid() will return safe tids without any parameters required. NewTid() will prefer Zandronum-safe tids (below 32767) and only switch to Zandronum-unsafe tids if all safe tids are occupied, which can only happen if you have spawned an insane amount of actors with different tids. | ||
| - | ==== NewTid | + | ===== Examples |
| + | Just use NewTid like UniqueTid without specifying any error-prone boundaries: | ||
| + | < | ||
| + | int tid = NewTid(); | ||
| + | Spawn(" | ||
| + | </ | ||
| - | Returns a new safe tid. | ||