]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Provide default implementation
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 25 Aug 2015 01:20:55 +0000 (11:20 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 25 Aug 2015 01:20:55 +0000 (11:20 +1000)
qcsrc/menu/xonotic/datasource.qc

index db3b77a016cf6abaf3d7d1a86d16653051d97afb..49cc571761885e394686651985b548d98af1f7c7 100644 (file)
@@ -1,23 +1,23 @@
 #ifndef DATASOURCE_H
 #define DATASOURCE_H
 CLASS(DataSource, Object)
+    entity DataSource_true;
+    entity DataSource_false;
+    INIT_STATIC(DataSource) {
+        DataSource_true = NEW(Object);
+        DataSource_false = NULL;
+    }
     /**
      * get entry `i` passing `name` and `icon` through `returns` if it is not null
      * returns `DataSource_false` if out of bounds
      * otherwise returns an entity or `DataSource_true`
      */
-    METHOD(DataSource, getEntry, entity(int i, void(string name, string icon) returns));
+    METHOD(DataSource, getEntry, entity(int i, void(string name, string icon) returns)) { return DataSource_false; }
     /** return the index of the first match for `find`. optional */
-    METHOD(DataSource, indexOf, int(string find));
+    METHOD(DataSource, indexOf, int(string find)) { return -1; }
     /** reload all entries matching `filter` returning how many matches were found */
-    METHOD(DataSource, reload, int(string filter));
+    METHOD(DataSource, reload, int(string filter)) { return 0; }
     /** cleanup on shutdown. optional */
-    METHOD(DataSource, destroy, void(entity));
-    entity DataSource_true;
-    entity DataSource_false;
-    INIT_STATIC(DataSource) {
-        DataSource_true = NEW(Object);
-        DataSource_false = NULL;
-    }
+    METHOD(DataSource, destroy, void(entity)) { }
 ENDCLASS(DataSource)
 #endif