Skip to content

Instantly share code, notes, and snippets.

@DDuarte
Created July 6, 2013 15:23
Show Gist options
  • Select an option

  • Save DDuarte/5940214 to your computer and use it in GitHub Desktop.

Select an option

Save DDuarte/5940214 to your computer and use it in GitHub Desktop.
TC override support example
From 637b254485b0768a2c74afedc8329b05883c8ba8 Mon Sep 17 00:00:00 2001
From: Nay <dnpd.dd@gmail.com>
Date: Sat, 6 Jul 2013 16:22:32 +0100
Subject: [PATCH] TC override support example
---
src/server/scripts/Examples/example_spell.cpp | 2 +-
src/server/shared/CompilerDefs.h | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp
index c3a56e7..25cfdab 100644
--- a/src/server/scripts/Examples/example_spell.cpp
+++ b/src/server/scripts/Examples/example_spell.cpp
@@ -60,7 +60,7 @@ class spell_ex_5581 : public SpellScriptLoader
// function called just after script is added to spell
// we initialize local variables if needed
- bool Load()
+ bool Load() TC_OVERRIDE
{
localVariable = "we're using local variable";
localVariable2 = new char();
diff --git a/src/server/shared/CompilerDefs.h b/src/server/shared/CompilerDefs.h
index 10cdaf4..d8c05a1 100644
--- a/src/server/shared/CompilerDefs.h
+++ b/src/server/shared/CompilerDefs.h
@@ -66,4 +66,12 @@
# define COMPILER_HAS_CPP11_SUPPORT 0
#endif
+#if COMPILER_HAS_CPP11_SUPPORT
+# define TC_OVERRIDE override
+# define TC_FINAL final
+#else
+# define TC_OVERRIDE
+# define TC_FINAL
+#endif
+
#endif
--
1.8.3.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment