shithub: sce

Download patch

ref: fd0045a36dc8861749af84229b1fcbac49d8a59e
parent: ba13bc224be1dfd31711e500f66b51bca21188f4
author: qwx <qwx@sciops.net>
date: Mon Aug 24 07:17:39 EDT 2020

fs: allow comments in db files, comment sce.db

--- a/fs.c
+++ b/fs.c
@@ -418,7 +418,7 @@
 	/* parse twice to preallocate tables, otherwise cross-references will be
 	 * invalid */
 	while((s = Brdstr(bf, '\n', 1)) != nil){
-		if((p = strchr(s, ',')) == nil)
+		if(s[0] == 0 || s[0] == '#' || (p = strchr(s, ',')) == nil)
 			goto skip;
 		if(p == s || p[1] == 0)
 			goto skip;
@@ -435,7 +435,7 @@
 	}
 	Bseek(bf, 0, 0);
 	while((s = Brdstr(bf, '\n', 1)) != nil){
-		if((p = strchr(s, ',')) == nil)
+		if(s[0] == 0 || s[0] == '#' || (p = strchr(s, ',')) == nil)
 			goto next;
 		if(p == s || p[1] == 0)
 			goto next;
--- a/sce/sce.db
+++ b/sce/sce.db
@@ -1,13 +1,18 @@
+# resource: name, init
 resource,supply,200
 resource,minerals,50
 resource,vespene gas,0
+# attack: name, dmg, range, cool
 attack,fusion cutter,5,1,15
 attack,spines,5,1,22
+# obj: name, nrot, flags, w, h, hp, def, speed, vis, cost[3], time, attack[2]
 obj,scv,32,3,4,4,60,0,5,7,1,50,0,20,fusion cutter,
 obj,drone,32,1,4,4,40,0,5,7,1,50,0,20,spines,
 obj,control,1,8,16,12,1500,1,0,1,10,400,0,1800,,
 obj,hatchery,1,8,16,12,1250,1,0,1,10,300,0,1800,,
+# spawn: objname, [obj..]
 spawn,control,scv
+# spr: objname, flags (PF enum), [frame..]
 spr,scv,1,0
 spr,scv,0x8001,0
 spr,control,1,0