Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
emily33901 committed Jul 21, 2020
1 parent d1ce75d commit b142013
Show file tree
Hide file tree
Showing 5 changed files with 1,529 additions and 91 deletions.
18 changes: 15 additions & 3 deletions asteamid.v
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
module vapor

// SteamId represents a steamid
pub type SteamId = u64

const (
// default_steamid is the default
// universe 1, type .individual, instance 1, id 0
// steamid
pub const (
default_steamid = SteamId(76561197960265728)
)

const (
steamid_universe_mask = 0xFF00000000000000
steamid_type_mask = 0x00F0000000000000
steamid_instance_mask = 0x000FFFFF00000000
Expand All @@ -17,35 +23,41 @@ const (
steamid_id_shift = 0
)

// steamid creates a SteamId from the u64 given
// it is a workaround for alias type casting being
// a little buggy...
pub fn steamid(x u64) SteamId {
return SteamId(x)
}

// universe returns the steamids universe
// universe returns the steamid's universe
pub fn (s SteamId) universe() Universe {
return Universe((u64(s) & steamid_universe_mask) >> steamid_universe_shift)
// return int(byte(u64(s) >> 56))
}

// set_universe sets the steamid's universe
pub fn (mut s SteamId) set_universe(u Universe) {
// TODO unnecessary to coerce compiler
unsafe {
u64(*s) |= ((u64(u) << steamid_universe_shift) & steamid_universe_mask)
}
}

// @type returns the type
// @type returns the steamid's type
pub fn (s SteamId) @type() AccountType {
return AccountType((u64(s) & steamid_type_mask) >> steamid_type_shift)
}

// set_type sets the steamid's type
pub fn (mut s SteamId) set_type(a AccountType) {
// TODO unnecessary to coerce compiler
unsafe {
u64(*s) |= ((u64(a) << steamid_type_shift) & steamid_type_mask)
}
}

// instance returns the steamid's instance
pub fn (s SteamId) instance() int {
return int((u64(s) & steamid_instance_mask) >> steamid_instance_shift)
}
Expand Down
10 changes: 10 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="refresh" content="0; URL='vapor.html'" />
</head>

</html>
Loading

0 comments on commit b142013

Please sign in to comment.