fixes bug (float precision) by using f64
This commit is contained in:
@@ -86,9 +86,9 @@ pub enum ApiActions {
|
||||
// Player actions
|
||||
FetchPlayer(i32),
|
||||
FetchLoot(i32),
|
||||
UpdateWealth(i32, f32),
|
||||
BuyItems(i32, Vec<(i32, Option<f32>)>),
|
||||
SellItems(i32, Vec<(i32, Option<f32>)>),
|
||||
UpdateWealth(i32, f64),
|
||||
BuyItems(i32, Vec<(i32, Option<f64>)>),
|
||||
SellItems(i32, Vec<(i32, Option<f64>)>),
|
||||
ClaimItem(i32, i32),
|
||||
UnclaimItem(i32, i32),
|
||||
// Group actions
|
||||
@@ -96,7 +96,7 @@ pub enum ApiActions {
|
||||
}
|
||||
|
||||
pub enum AdminActions {
|
||||
AddPlayer(String, f32),
|
||||
AddPlayer(String, f64),
|
||||
//AddInventoryItem(pub String, pub i32),
|
||||
ResolveClaims,
|
||||
//SetClaimsTimeout(pub i32),
|
||||
|
||||
@@ -10,7 +10,7 @@ use crate::api;
|
||||
type AppPool = web::Data<db::Pool>;
|
||||
type PlayerId = web::Path<i32>;
|
||||
type ItemId = web::Json<i32>;
|
||||
type ItemListWithMods = web::Json<Vec<(i32, Option<f32>)>>;
|
||||
type ItemListWithMods = web::Json<Vec<(i32, Option<f64>)>>;
|
||||
|
||||
/// Wraps call to the database query and convert its result as a async HttpResponse
|
||||
pub fn db_call(
|
||||
@@ -65,7 +65,7 @@ fn configure_app(config: &mut web::ServiceConfig) {
|
||||
web::resource("/wealth")
|
||||
//.route(web::get().to_async(...))
|
||||
.route(web::put().to_async(
|
||||
|pool, (player, data): (PlayerId, web::Json<f32>)| {
|
||||
|pool, (player, data): (PlayerId, web::Json<f64>)| {
|
||||
db_call(
|
||||
pool,
|
||||
Q::UpdateWealth(*player, *data),
|
||||
|
||||
Reference in New Issue
Block a user