Skip to content

Commit

Permalink
patch userid in game events new demos
Browse files Browse the repository at this point in the history
  • Loading branch information
LaihoE committed Nov 17, 2023
1 parent b575480 commit 116ec97
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/parser/src/game_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ impl ParserThread {
}

pub fn find_user_by_userid(&self, userid: i32) -> Option<&UserInfo> {
for player in self.stringtable_players.values() {
if player.userid & 0xFF == userid {
return Some(player);
}
}
// Fallback for old demos?
for player in self.stringtable_players.values() {
if player.userid == userid {
return Some(player);
Expand All @@ -151,16 +157,6 @@ impl ParserThread {
}
return None;
}
pub fn entity_userid_from_entityid(&self, userid: i32) -> Option<i32> {
if let Some(userinfo) = self.find_user_by_userid(userid) {
for player in self.players.values() {
if player.steamid == Some(userinfo.steamid) {
return Some(player.player_entity_id.unwrap());
}
}
}
return None;
}
pub fn find_extra(&self, fields: &Vec<EventField>) -> Result<Vec<EventField>, DemoParserError> {
let mut extra_fields = vec![];
// Always add tick to event
Expand Down

0 comments on commit 116ec97

Please sign in to comment.