UNPKG

sc4

Version:

A command line utility for automating SimCity 4 modding tasks & modifying savegames

30 lines (29 loc) 792 B
import FileType from './file-types.js'; import { kFileType } from './symbols.js'; import WriteBuffer from './write-buffer.js'; // # NetworkManager export default class NetworkManager { static [kFileType] = FileType.NetworkManager; crc = 0x00000000; mem = 0x00000000; version = 1; pointers = []; // ## parse(rs) parse(rs) { rs.size(); this.crc = rs.dword(); this.mem = rs.dword(); this.version = rs.word(); this.pointers = rs.array(() => rs.pointer()); rs.assert(); return this; } // ## toBuffer() toBuffer() { let ws = new WriteBuffer(); ws.dword(this.mem); ws.word(this.version); ws.array(this.pointers, ptr => ws.pointer(ptr)); return ws.seal(); } }