UNPKG

mdx-m3-viewer

Version:

A browser WebGL model viewer. Mainly focused on models of the games Warcraft 3 and Starcraft 2.

28 lines (23 loc) 627 B
import BinaryStream from '../../../common/binarystream'; import { byteLengthUtf8 } from '../../../common/utf8'; /** * A force. */ export default class Force { flags: number = 0; playerMasks: number = 0; name: string = ''; load(stream: BinaryStream) { this.flags = stream.readUint32(); this.playerMasks = stream.readUint32(); this.name = stream.readNull(); } save(stream: BinaryStream) { stream.writeUint32(this.flags); stream.writeUint32(this.playerMasks); stream.writeNull(this.name); } getByteLength() { return 9 + byteLengthUtf8(this.name); } }