Overview
Comment: | Implement %R substitution for roman numbers, and do not throw a type mismatch error during string substitution |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ca9c200f64268ed78756143ba6866548 |
User & Date: | user on 2021-03-23 05:18:32 |
Other Links: | manifest | tags |
Context
2021-03-23
| ||
07:29 | Add a missing "break" in the handling of popup messages check-in: cae837d7b3 user: user tags: trunk | |
05:18 | Implement %R substitution for roman numbers, and do not throw a type mismatch error during string substitution check-in: ca9c200f64 user: user tags: trunk | |
05:06 | Fix a bug in game.c causing it to use the wrong replay data when switching between the game and editor. check-in: d0f39b05fa user: user tags: trunk | |
Changes
Modified class.doc from [de4beeba2e] to [455879bbc3].
︙ | ︙ | |||
1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 | %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 farther apart to make room if necessary. %s Display a string. If the value is not a string, it will display it as whatever type it is. %u Display a unsigned decimal number. | > > > | 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 | %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 farther apart to make room if necessary. %R Display a roman number. %s Display a string. If the value is not a string, it will display it as whatever type it is. %u Display a unsigned decimal number. |
︙ | ︙ |
Modified exec.c from [701969d391] to [8d61aca3bb].
︙ | ︙ | |||
1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 | if(argi>=argc-1) break; if(vstack[vstackptr+argi].t==TY_CLASS && vstack[vstackptr+argi+1].t==TY_NUMBER) { Class*c=classes[vstack[vstackptr+argi].u]; int n=vstack[vstackptr+argi+1].u&255; if(n<c->nimages) sqlite3_str_appendf(s,"\x0E\x07:%d\\",c->images[n]&0x7FFF); } argi+=2; break; case 's': if(argi==argc) break; v=vstack[vstackptr+argi++]; switch(v.t) { case TY_STRING: case TY_LEVELSTRING: sqlite3_str_appendf(s,"%s",value_string_ptr(v)); 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; | > > > > > > > > > > > > < < | 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 | if(argi>=argc-1) break; if(vstack[vstackptr+argi].t==TY_CLASS && vstack[vstackptr+argi+1].t==TY_NUMBER) { Class*c=classes[vstack[vstackptr+argi].u]; int n=vstack[vstackptr+argi+1].u&255; if(n<c->nimages) sqlite3_str_appendf(s,"\x0E\x07:%d\\",c->images[n]&0x7FFF); } argi+=2; break; case 'R': if(argi==argc) break; v=vstack[vstackptr+argi++]; if(v.t==TY_NUMBER) { static const char*const r1000[10]={"","M","MM","MMM","MMMM","MMMMM","MMMMMM","MMMMMMM","MMMMMMMM","MMMMMMMMM"}; static const char*const r100[10]={"","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"}; static const char*const r10[10]={"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"}; static const char*const r1[10]={"","I","II","III","IV","V","VI","VII","VIII","IX"}; if(v.u) sqlite3_str_appendf(s,"%s%s%s%s",r1000[(v.u/1000)%10],r100[(v.u/100)%10],r10[(v.u/10)%10],r1[v.u%10]); else sqlite3_str_appendchar(s,1,'N'); } break; case 's': if(argi==argc) break; v=vstack[vstackptr+argi++]; switch(v.t) { case TY_STRING: case TY_LEVELSTRING: sqlite3_str_appendf(s,"%s",value_string_ptr(v)); 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; } break; case 'u': if(argi==argc) break; v=vstack[vstackptr+argi++]; if(v.t==TY_NUMBER) sqlite3_str_appendf(s,"%u",(unsigned int)v.u); break; |
︙ | ︙ |