]> git.rm.cloudns.org Git - xonotic/xonotic.wiki.git/commitdiff
(Commit created by redmine exporter script from page "NewQC" version 15)
authorBlub <blub@speed.at>
Sun, 28 Mar 2010 04:47:00 +0000 (04:47 +0000)
committerRedmineExport <redmineexport@dev.xonotic.org>
Mon, 17 Nov 2014 17:53:33 +0000 (17:53 +0000)
NewQC.textile

index 07329ec7de34c5f36b13de5ce4ca8e9f2834730c..beef7e5c33b70511b0633a23fb2eaec8df88bdce 100644 (file)
@@ -48,3 +48,28 @@ From now on, the code
 does what the first instinct tells you: it creates a global with the initial value 3. Contrary to old QC, where it created a constant.
 To create a constant use:
 <pre>const float x = 3</pre>
+
+h2. Extendable functions:
+
+Since menuQC has some funny macro: ACCUMULATE_FUNCTIONS, it seemed like a nice syntactical sugar to allow the following:
+
+<pre>float myfunc() extendable
+{
+    float mylocal = 3;
+}
+
+/* other code */
+
+float myfunc()
+{
+    mylocal += 5;
+    if (mylocal > 20)
+        return mylocal;
+}
+
+/* optionally: */
+float myfunc() final
+{
+    return 3;
+}
+</pre>