Free Hero Mesh

Check-in [a352027216]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Correct a mistake in the OBJECTS virtual table, and allow the class name to be used with the CVALUE function.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a3520272165de78b33aa9232541ddcc48fb10c52
User & Date: user on 2021-02-14 05:08:24.475
Other Links: manifest | tags
Context
2021-02-16
03:08
Add XY function check-in: 1bcf59e130 user: user tags: trunk
2021-02-14
05:08
Correct a mistake in the OBJECTS virtual table, and allow the class name to be used with the CVALUE function. check-in: a352027216 user: user tags: trunk
2021-02-13
04:46
Add Misc/Dir editing check-in: 94aad6dd1b user: user tags: trunk
Changes
88
89
90
91
92
93
94







95
96




97
98
99
100
101
102
103
88
89
90
91
92
93
94
95
96
97
98
99
100
101


102
103
104
105
106
107
108
109
110
111
112







+
+
+
+
+
+
+
-
-
+
+
+
+







    case 132: sqlite3_result_int(cxt,cl->cflags&CF_COMPATIBLE?1:0); break;
  }
}

static void fn_cvalue(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
  int a;
  if(sqlite3_value_type(*argv)==SQLITE_NULL) return;
  if(sqlite3_value_type(*argv)==SQLITE_TEXT || sqlite3_value_type(*argv)==SQLITE_BLOB) {
    const char*s=sqlite3_value_text(*argv);
    for(a=1;a<0x4000;a++) {
      if(classes[a] && !(classes[a]->cflags&CF_NOCLASS2) && !strcmp(s,classes[a]->name)) goto found;;
    }
    return;
  } else {
  a=sqlite3_value_int(*argv)&0xFFFF;
  sqlite3_result_int64(cxt,a|((sqlite3_int64)TY_CLASS<<32));
    a=sqlite3_value_int(*argv)&0xFFFF;
    if(!a || (a&~0x3FFF) || !classes[a] || (classes[a]->cflags&CF_NOCLASS2)) return;
  }
  found: sqlite3_result_int64(cxt,a|((sqlite3_int64)TY_CLASS<<32));
}

static void fn_heromesh_escape(sqlite3_context*cxt,int argc,sqlite3_value**argv) {
  const unsigned char*u=sqlite3_value_blob(*argv);
  int un=sqlite3_value_bytes(*argv);
  char*e;
  int en=0;
877
878
879
880
881
882
883
884

885
886
887
888
889
890
891
886
887
888
889
890
891
892

893
894
895
896
897
898
899
900







-
+







    if(sqlite3_value_type(argv[3])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL;
    if(sqlite3_value_type(argv[7])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL;
    if(sqlite3_value_type(argv[11])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;
    if(sqlite3_value_type(argv[12])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;
    x=sqlite3_value_int(argv[9]);
    y=sqlite3_value_int(argv[10]);
    if(x<1 || x>pfwidth || y<1 || y>pfheight) return SQLITE_CONSTRAINT_CHECK;
    z=sqlite3_value_type(argv[3]);
    z=sqlite3_value_int(argv[3]);
    if(z<=0 || z>=0x4000 || !classes[z]) return SQLITE_CONSTRAINT_FOREIGNKEY;
    if(sqlite3_value_int(argv[7])<0 || sqlite3_value_int(argv[7])>=classes[z]->nimages) return SQLITE_CONSTRAINT_CHECK;
    id=objalloc(z);
    if(id==VOIDLINK) return SQLITE_CONSTRAINT_VTAB;
    goto update;
  } else {
    // UPDATE
Modified sql.doc from [e12587dc57] to [b92214eca8].
11
12
13
14
15
16
17
18


19
20
21
22
23
24
25
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26







-
+
+







  The base name, which is a copy of the first command-line argument (not
  counting the switches or the program name).

CLASS_DATA(id,info)
  Returns data about a class.

CVALUE(number)
  Makes a game value of type 'class', given the class number.
  Makes a game value of type 'class', given the class number. You can also
  specify the class name instead of the number.

HEROMESH_ESCAPE(blob)
  Converts blob representation of a game string into escaped format.

HEROMESH_TYPE(value)
  The type of a game value, given as a 64-bit integer. The types are
  'class', 'number', 'string', 'object', and 'sound'.