| Total Complexity | 5 |
| Complexity/F | 2.5 |
| Lines of Code | 27 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { HoFRecord } from './../fragments/HoFRecord'; |
||
| 2 | import { SaveFileService } from './../../savefile.service'; |
||
| 3 | |||
| 4 | export class HoF { |
||
| 5 | constructor(saveFile?: SaveFileService) { |
||
| 6 | if (saveFile !== undefined) |
||
| 7 | this.load(saveFile as SaveFileService); |
||
| 8 | } |
||
| 9 | |||
| 10 | public load(saveFile: SaveFileService) { |
||
| 11 | const hofRecordCount = saveFile.getByte(0x284E); |
||
| 12 | for (let i = 0; i < hofRecordCount && i < 50; i++) { |
||
| 13 | this.hallOfFame.push(new HoFRecord(saveFile, i)); |
||
| 14 | } |
||
| 15 | } |
||
| 16 | |||
| 17 | public save(saveFile: SaveFileService) { |
||
| 18 | saveFile.setByte(0x284E, this.hallOfFame.length); |
||
| 19 | for (let i = 0; i < this.hallOfFame.length && i < 50; i++) { |
||
| 20 | this.hallOfFame[i].save(saveFile, i); |
||
| 21 | } |
||
| 22 | } |
||
| 23 | |||
| 24 | // Related to the Hall of Fame |
||
| 25 | public hallOfFame: HoFRecord[] = []; |
||
| 26 | } |
||
| 27 |