-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlocation.go
47 lines (43 loc) · 822 Bytes
/
location.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
// Copyright 2016, JuanDeFu.ca. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
import (
"sabey.co/spoofgo/cli"
"sync"
)
var (
location int
location_mu sync.RWMutex
)
func SetLocation(
jump int,
) {
location_mu.Lock()
defer location_mu.Unlock()
if jump != cli.PLAYER &&
jump != cli.OPTIONS &&
jump != cli.HELP &&
jump != cli.NEWS {
// invalid location
return
}
// valid location
location = jump
if jump == cli.OPTIONS {
// reset option position
menu_option.Top()
}
if jump == cli.HELP {
// reset help position
textblock_help.Top()
}
if jump == cli.NEWS {
// reset news textblock
ResetNews()
}
}
func GetLocation() int {
location_mu.RLock()
defer location_mu.RUnlock()
return location
}