LIBRARY_PROCESS_SVG = ./$(USVG_PROCESSOR) $@ $(wordlist 1,2,$^) '$(USVG) $(USVG_OPTIONS)'
$(LIBRARY_FILES): $(USVG_PROCESSOR) Makefile
+TS_SRCS= script bigfloat
+TS_SRC_FILES= $(addprefix templates/,$(addsuffix .ts,$(TS_SRCS)))
+
LITFILES= LICENCE AGPLv3
TXTFILES= CC-BY-SA-3.0 CC-BY-SA-4.0
$(CARGO_TARGET_DIR)/release/server:
$(CARGO) build --release
-templates/%.js: templates/%.ts tsconfig.json
- tsc --outfile $@.tmp $< 2>&1 \
+templates/script.js: $(TS_SRC_FILES) tsconfig.json
+ tsc --outfile $@.tmp $(TS_SRC_FILES) 2>&1 \
| perl -pe 's/\((\d+),(\d+)\):/:$$1:$$2:/'; \
test "$${PIPESTATUS[*]}" = "0 0"
mv -f $@.tmp $@
export function pack(v: Unpacked): Packed {
function hex16(x: number) { return ('000' + x.toString(16)).slice(-4); }
function hex48(x: Limb) {
- return (hex16(Math.floor(x / 0x100000000)) + '_' +
- hex16( x & 0xffff0000) + '_' +
- hex16( x & 0x0000ffff) );
+ return (hex16(Math.floor(x / 0x100000000) ) + '_' +
+ hex16( (x & 0xffff0000) >> 16 ) + '_' +
+ hex16( x & 0x0000ffff ) );
}
return (
(v.sign < 0 ? '!' : '+') +
}
}
+ export function add(p: Bigfloat, step: number): Bigfloat {
+ let v = unpack(p);
+ add_to_limb(v, 0, step * 0x10000);
+ return pack(v);
+ }
+
export function iter_upto(ap: Packed, bp: Packed, count: number):
() => Packed {
let av = unpack(ap);
held : PlayerId | null,
cseq : number | null,
cseq_updatesvg : number | null,
- z : number,
+ z : Bigfloat,
zg : Generation,
pinned: boolean,
uos : UoDescription[],
}
}
}
-
+/*
keyops_local['lower'] = function (uo: UoRecord) {
// This is a bit subtle. We don't want to lower below pinned pieces
// (unless we are pinned too, or the user is wresting). But maybe
let pinned = treat
}
+*/
keyops_local['wrest'] = function (uo: UoRecord) {
wresting = !wresting;
console.log('CHECK RAISE ', dragraise, dragraise*dragraise, ddr2);
piece_set_zlevel(piece,p, (oldtop_piece) => {
let oldtop_p = pieces[oldtop_piece]!;
- let z = oldtop_p.z + 1;
+ let z = Bigfloats.add(oldtop_p.z, 1);
p.z = z;
api_piece(api, "setz", piece,p, { z: z });
});
svg: string,
held: PlayerId,
pos: Pos,
- z: number,
+ z: Bigfloat,
zg: Generation,
pinned: boolean,
uos: UoDescription[],
}
pieceops.SetZLevel = <PieceHandler>function
-(piece,p, info: { z: number, zg: Generation }) {
+(piece,p, info: { z: Bigfloat, zg: Generation }) {
piece_set_zlevel(piece,p, (oldtop_piece)=>{
let oldtop_p = pieces[oldtop_piece]!;
p.z = info.z;