Overview
Comment: | Implement the "CL" SQL function as a useful shortcut to get class numbers from class names. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c9044f59eddc282e4f076c5833d12269 |
User & Date: | user on 2021-05-15 06:15:36 |
Other Links: | manifest | tags |
Context
2021-05-16
| ||
05:32 | Fix some mistakes with counting the number of picture lumps in the picture editor. check-in: 1ce408e53f user: user tags: trunk | |
2021-05-15
| ||
06:15 | Implement the "CL" SQL function as a useful shortcut to get class numbers from class names. check-in: c9044f59ed user: user tags: trunk | |
2021-05-14
| ||
22:57 | Implement F7 (copy) and F12 (SQL) in the main menu of the picture editor. check-in: d90f0ae800 user: user tags: trunk | |
Changes
Modified TODO from [a04c3e1979] to [c4c8e86a65].
︙ | ︙ | |||
29 30 31 32 33 34 35 | * Bugs * Figure out why the $SeekerCloser class doesn't seem to work properly * Level 232 of SUPERHRO puzzle set (the Lava shouldn't expand? why?) * Display solution comments/timestamp * VCR mode * Portable mode, not needing installing files in home directory * Command-line switch for batch import/export levels | > > | 29 30 31 32 33 34 35 36 37 | * Bugs * Figure out why the $SeekerCloser class doesn't seem to work properly * Level 232 of SUPERHRO puzzle set (the Lava shouldn't expand? why?) * Display solution comments/timestamp * VCR mode * Portable mode, not needing installing files in home directory * Command-line switch for batch import/export levels * SQL * Implement the GROUP column in the CLASSES table |
Modified function.c from [24e9a6e2da] to [9e56554eb9].
︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 | static void fn_basename(sqlite3_context*cxt,int argc,sqlite3_value**argv) { sqlite3_result_text(cxt,basefilename,-1,SQLITE_STATIC); } static void fn_cacheid(sqlite3_context*cxt,int argc,sqlite3_value**argv) { sqlite3_result_int64(cxt,*(sqlite3_int64*)sqlite3_user_data(cxt)); } static void fn_class_data(sqlite3_context*cxt,int argc,sqlite3_value**argv) { int id=sqlite3_value_int(argv[0]); Class*cl; if(id<0 || id>=0x4000 || !classes[id]) return; cl=classes[id]; switch(sqlite3_value_int(argv[1])&255) { | > > > > > > > > > > > | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | static void fn_basename(sqlite3_context*cxt,int argc,sqlite3_value**argv) { sqlite3_result_text(cxt,basefilename,-1,SQLITE_STATIC); } static void fn_cacheid(sqlite3_context*cxt,int argc,sqlite3_value**argv) { sqlite3_result_int64(cxt,*(sqlite3_int64*)sqlite3_user_data(cxt)); } static void fn_cl(sqlite3_context*cxt,int argc,sqlite3_value**argv) { int a; const char*s=sqlite3_value_text(*argv); if(!s) return; for(a=1;a<0x4000;a++) { if(classes[a] && !(classes[a]->cflags&CF_NOCLASS2) && !strcmp(s,classes[a]->name)) goto found; } return; found: sqlite3_result_int(cxt,a); } static void fn_class_data(sqlite3_context*cxt,int argc,sqlite3_value**argv) { int id=sqlite3_value_int(argv[0]); Class*cl; if(id<0 || id>=0x4000 || !classes[id]) return; cl=classes[id]; switch(sqlite3_value_int(argv[1])&255) { |
︙ | ︙ | |||
948 949 950 951 952 953 954 955 956 957 958 959 960 961 | .xFilter=vt1_objects_filter, .xNext=vt1_objects_next, .xUpdate=vt1_objects_update, ); void init_sql_functions(sqlite3_int64*ptr0,sqlite3_int64*ptr1) { sqlite3_create_function(userdb,"BASENAME",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_basename,0,0); sqlite3_create_function(userdb,"CLASS_DATA",2,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_class_data,0,0); sqlite3_create_function(userdb,"CVALUE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_cvalue,0,0); sqlite3_create_function(userdb,"HEROMESH_ESCAPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_escape,0,0); sqlite3_create_function(userdb,"HEROMESH_TYPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_type,0,0); sqlite3_create_function(userdb,"HEROMESH_UNESCAPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_unescape,0,0); sqlite3_create_function(userdb,"LEVEL",0,SQLITE_UTF8,&level_ord,fn_level,0,0); sqlite3_create_function(userdb,"LEVEL_CACHEID",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,ptr0,fn_cacheid,0,0); | > | 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | .xFilter=vt1_objects_filter, .xNext=vt1_objects_next, .xUpdate=vt1_objects_update, ); void init_sql_functions(sqlite3_int64*ptr0,sqlite3_int64*ptr1) { sqlite3_create_function(userdb,"BASENAME",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_basename,0,0); sqlite3_create_function(userdb,"CL",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_cl,0,0); sqlite3_create_function(userdb,"CLASS_DATA",2,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_class_data,0,0); sqlite3_create_function(userdb,"CVALUE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_cvalue,0,0); sqlite3_create_function(userdb,"HEROMESH_ESCAPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_escape,0,0); sqlite3_create_function(userdb,"HEROMESH_TYPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_type,0,0); sqlite3_create_function(userdb,"HEROMESH_UNESCAPE",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_heromesh_unescape,0,0); sqlite3_create_function(userdb,"LEVEL",0,SQLITE_UTF8,&level_ord,fn_level,0,0); sqlite3_create_function(userdb,"LEVEL_CACHEID",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,ptr0,fn_cacheid,0,0); |
︙ | ︙ |
Modified sql.doc from [8a70d5bf69] to [dcec016e62].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | This document explains the SQL functions and SQL tables which are available for the user customization in Free Hero Mesh. (You cannot use SQL to define the rules of the game.) === Functions === Asterisks denote aggregate/window functions. BASENAME() 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. You can also specify the class name instead of the number. | > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | This document explains the SQL functions and SQL tables which are available for the user customization in Free Hero Mesh. (You cannot use SQL to define the rules of the game.) === Functions === Asterisks denote aggregate/window functions. BASENAME() The base name, which is a copy of the first command-line argument (not counting the switches or the program name). CL(text) Returns the class number, given the class name. If there is no such class, then the result is null. (This may be useful as a shortcut when used with the "OBJECTS" or "CLASSES" table.) CLASS_DATA(id,info) Returns data about a class. CVALUE(number) Makes a game value of type 'class', given the class number. You can also specify the class name instead of the number. |
︙ | ︙ |