Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
engine_common.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef SCRIPTS_INCLUDE__ENGINE_COMMON_H
13#define SCRIPTS_INCLUDE__ENGINE_COMMON_H
14
15// (float) is merely there to make sure that it uses the float overloads to send the version over network.
16// and to make sure we do not forget the f suffix on the version number.
17#define TT_VERSION_MAGIC '!TT!'
18#define TT_VERSION ((float)4.8f)
19
20#define SAFE_DELETE_ARRAY(p) { delete[] p; p = NULL; }
21#define SAFE_DELETE(p) { delete p; p = NULL; }
22
23template <typename T> TT_INLINE void SafeRelease(T& IUnk)
24{
25 if (IUnk)
26 {
27 IUnk->Release();
28 IUnk = 0;
29 }
30};
31
32template <typename T, typename T2> TT_INLINE void RefPtrSet(T& dest, T2& source)
33{
34 if (source) source->AddRef();
35 if (dest) dest->Release();
36 dest = source;
37};
38
39void SCRIPTS_API Console_Input(const char *Input); //triggers console input (i.e. passes the string in as though it was typed into the console)
40void SCRIPTS_API Console_Output(const char *Output,...); //prints stuff to the console, works like printf
41#endif