Passed
Pull Request — master (#23)
by
unknown
09:10 queued 04:58
created

src/app/data/savefile-expanded/fragments/WarpData.ts   A

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 32
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 26
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 3
mnd 1
bc 1
fnc 2
bpm 0.5
cpm 1.5
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A WarpData.load 0 8 2
A WarpData.save 0 8 1
1
import { SaveFileService } from './../../savefile.service';
2
3
export class WarpData {
4
    constructor(savefile?: SaveFileService, index?: number) {
5
        if (savefile !== undefined)
6
            this.load(savefile as SaveFileService, index as number);
7
    }
8
9
    public load(savefile: SaveFileService, index: number) {
10
        const it = savefile.iterator.offsetTo((0x4 * index) + 0x265B);
11
12
        this.y = it.getByte();
13
        this.x = it.getByte();
14
        this.destWarp = it.getByte();
15
        this.destMap = it.getByte();
16
    }
17
18
    public save(savefile: SaveFileService, index: number) {
19
        const it = savefile.iterator.offsetTo((0x4 * index) + 0x265B);
20
21
        it.setByte(this.y);
22
        it.setByte(this.x);
23
        it.setByte(this.destWarp);
24
        it.setByte(this.destMap);
25
    }
26
27
    public y: number = 0;
28
    public x: number = 0;
29
    public destWarp: number = 0;
30
    public destMap: number = 0;
31
}
32