Free Hero Mesh

Check-in [5cdca70402]
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:Implement the %C substitution, and allow %s substitutions to display message names as well.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5cdca70402fcdd9c8ea98aa964219ec9dd5e6f4e
User & Date: user on 2021-03-09 23:15:05
Other Links: manifest | tags
Context
2021-03-11
05:38
Implement importing levels check-in: 04cceae6dc user: user tags: trunk
2021-03-09
23:15
Implement the %C substitution, and allow %s substitutions to display message names as well. check-in: 5cdca70402 user: user tags: trunk
00:38
Add a comment into class.c describing the use of the hash tables check-in: 136167067e user: user tags: trunk
Changes

Modified class.doc from [b561abab61] to [10812d8f88].

1528
1529
1530
1531
1532
1533
1534




1535
1536
1537
1538
1539
1540
1541
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545







+
+
+
+









=== Substitution codes ===

%c
  Display a single character whose code is the low 8-bits of the value.

%C
  The low 3-bits of the argument specifies the colour of the text. If it
  is not a number, then the colour is unchanged.

%d
  Display a signed decimal number.

%i
  Display a picture. Consumes two arguments, being first a class and then
  the image number. If either argument is not valid, displays nothing. The
  picture may take up multiple lines of space; the lines will be moved

Modified exec.c from [f09acdaf65] to [7f9f58fd2f].

1184
1185
1186
1187
1188
1189
1190





1191
1192
1193
1194
1195
1196
1197
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202







+
+
+
+
+







            if(argi==argc) break;
            v=vstack[vstackptr+argi++];
            if(v.t==TY_NUMBER) {
              sqlite3_str_appendchar(s,1,31);
              sqlite3_str_appendchar(s,1,v.u&255?:255);
            }
            break;
          case 'C':
            if(argi==argc) break;
            v=vstack[vstackptr+argi++];
            if(v.t==TY_NUMBER) sqlite3_str_appendchar(s,1,(v.u&7)+1);
            break;
          case 'd':
            if(argi==argc) break;
            v=vstack[vstackptr+argi++];
            if(v.t==TY_NUMBER) sqlite3_str_appendf(s,"%d",(signed int)v.s);
            break;
          case 'i':
            if(argi>=argc-1) break;
1211
1212
1213
1214
1215
1216
1217



1218
1219
1220
1221
1222
1223
1224
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232







+
+
+







                break;
              case TY_NUMBER:
                sqlite3_str_appendf(s,"%llu",(sqlite3_int64)v.u);
                break;
              case TY_CLASS:
                sqlite3_str_appendf(s,"%s",classes[v.u]->name);
                break;
              case TY_MESSAGE:
                sqlite3_str_appendf(s,"%s",v.u<256?standard_message_names[v.u]:messages[v.u-256]);
                break;
              default:
                Throw("Type mismatch");
            }
            break;
          case 'u':
            if(argi==argc) break;
            v=vstack[vstackptr+argi++];
1252
1253
1254
1255
1256
1257
1258



1259
1260
1261
1262
1263
1264
1265
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276







+
+
+







        break;
      case TY_NUMBER:
        quiz_text=sqlite3_mprintf("%llu",(sqlite3_int64)v.u);
        break;
      case TY_CLASS:
        quiz_text=sqlite3_mprintf("%s",classes[v.u]->name);
        break;
      case TY_MESSAGE:
        quiz_text=sqlite3_mprintf("%s",v.u<256?standard_message_names[v.u]:messages[v.u-256]);
        break;
      default:
        Throw("Type mismatch");
    }
  }
  if(!quiz_text) fatal("Allocation failed\n");
  t=quiz_text;
  while(*t) {