Skip to content

Commit

Permalink
Fix compile error. Fix mac build.
Browse files Browse the repository at this point in the history
  • Loading branch information
fluxxu committed Dec 10, 2023
1 parent 4fb87cc commit d559686
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/client/src/controller/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,15 @@ impl ControllerStream {
}
}

let type_id = frame.type_id;
match Self::handle_frame(id, player_id, frame, &mut stream, &owner, &parent, &nodes_reg).await {
Ok(_) => {},
Err(e) => {
tracing::error!("handle frame: {}", e);
}
}

if frame.type_id == PacketTypeId::LobbyDisconnect {
if type_id == PacketTypeId::LobbyDisconnect {
disconnect_handled = true;
}
},
Expand Down
63 changes: 36 additions & 27 deletions crates/platform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ impl ClientPlatformInfo {
if let Some(executable_path) = running_executable_path {
let version = crate::war3::get_war3_version(&executable_path).ok();
if let Some(version) = version {
let ptr = config
.ptr
.unwrap_or(false);
let ptr = config.ptr.unwrap_or(false);
return Ok(ClientPlatformInfo {
user_data_path: config
.user_data_path
Expand All @@ -52,7 +50,11 @@ impl ClientPlatformInfo {
version,
executable_path,
ptr,
user_battlenet_id: config.user_battlenet_client_id.as_ref().map(|inner_str| { inner_str.to_string() }).unwrap_or("0".to_string()),
user_battlenet_id: config
.user_battlenet_client_id
.as_ref()
.map(|inner_str| inner_str.to_string())
.unwrap_or("0".to_string()),
});
}
}
Expand All @@ -64,13 +66,13 @@ impl ClientPlatformInfo {
.or_else(|| path::detect_installation_path())
.ok_or_else(|| Error::NoInstallationFolder)?;

let ptr = config
.ptr
.unwrap_or(false);
let ptr = config.ptr.unwrap_or(false);

let executable_path = installation_path
.join(if ptr {"_ptr_/x86_64/Warcraft III.exe"}
else {"_retail_/x86_64/Warcraft III.exe"});
let executable_path = installation_path.join(if ptr {
"_ptr_/x86_64/Warcraft III.exe"
} else {
"_retail_/x86_64/Warcraft III.exe"
});
let version = crate::war3::get_war3_version(&executable_path)?;

Ok(ClientPlatformInfo {
Expand All @@ -83,7 +85,10 @@ impl ClientPlatformInfo {
version,
executable_path,
ptr,
user_battlenet_id: config.user_battlenet_client_id.clone().unwrap_or("0".to_string()),
user_battlenet_id: config
.user_battlenet_client_id
.clone()
.unwrap_or("0".to_string()),
})
}

Expand All @@ -95,13 +100,13 @@ impl ClientPlatformInfo {
.or_else(|| path::detect_installation_path())
.ok_or_else(|| Error::NoInstallationFolder)?;

let ptr = config
.ptr
.unwrap_or(false);
let ptr = config.ptr.unwrap_or(false);

let executable_path = installation_path
.join(if ptr {"_ptr_/x86_64/Warcraft III.app"}
else {"_retail_/x86_64/Warcraft III.app"});
let executable_path = installation_path.join(if ptr {
"_ptr_/x86_64/Warcraft III.app"
} else {
"_retail_/x86_64/Warcraft III.app"
});

tracing::debug!("executable_path: {:?}", executable_path);

Expand All @@ -122,7 +127,11 @@ impl ClientPlatformInfo {
installation_path,
version,
executable_path,
ptr
ptr,
user_battlenet_id: config
.user_battlenet_client_id
.clone()
.unwrap_or("0".to_string()),
})
}

Expand All @@ -136,17 +145,16 @@ impl ClientPlatformInfo {
let version = config
.version
.clone()
.ok_or_else(||Error::NoVersionNumber)?;
.ok_or_else(|| Error::NoVersionNumber)?;


let ptr = config
.ptr
.unwrap_or(false);
let ptr = config.ptr.unwrap_or(false);
tracing::debug!("warcraft_3_version: {:?}", config.version.clone());

let executable_path = installation_path
.join(if ptr {"_ptr_/x86_64/Warcraft III.exe"}
else {"_retail_/x86_64/Warcraft III.exe"});
let executable_path = installation_path.join(if ptr {
"_ptr_/x86_64/Warcraft III.exe"
} else {
"_retail_/x86_64/Warcraft III.exe"
});
tracing::debug!("executable_path: {:?}", executable_path);

let user_data_path = config
Expand All @@ -161,7 +169,8 @@ impl ClientPlatformInfo {
installation_path,
version,
executable_path,
ptr
ptr,
user_battlenet_id: "0".to_string(),
})
}

Expand Down

0 comments on commit d559686

Please sign in to comment.