standardise signatures

This commit is contained in:
ntr 2018-10-15 16:18:50 +11:00
parent 63bae0e0e5
commit eb96b59ca2

View File

@ -38,13 +38,13 @@ impl Rpc {
// now we have the method name
// match on that to determine what fn to call
let response = match v.method.as_ref() {
"cryp_spawn" => Rpc::cryp_spawn(data, &mut tx, account),
"cryp_spawn" => Rpc::cryp_spawn(data, &mut tx, account, client),
"combat_pve" => Rpc::combat_pve(data, &mut tx, account, client),
"account_create" => Rpc::account_create(data, &mut tx),
"account_login" => Rpc::account_login(data, &mut tx),
"account_cryps" => Rpc::account_cryps(&mut tx, account),
"item_list" => Rpc::item_list(&mut tx, account),
"item_use" => Rpc::item_use(data, &mut tx, account),
"account_create" => Rpc::account_create(data, &mut tx, account, client),
"account_login" => Rpc::account_login(data, &mut tx, account, client),
"account_cryps" => Rpc::account_cryps(data, &mut tx, account, client),
"item_list" => Rpc::item_list(data, &mut tx, account, client),
"item_use" => Rpc::item_use(data, &mut tx, account, client),
_ => Err(err_msg("unknown method")),
};
@ -86,7 +86,7 @@ impl Rpc {
return Ok(battle_response);
}
fn cryp_spawn(data: Vec<u8>, tx: &mut Transaction, account: Option<Account>) -> Result<RpcResponse, Error> {
fn cryp_spawn(data: Vec<u8>, tx: &mut Transaction, account: Option<Account>, client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
match from_slice::<CrypSpawnMsg>(&data) {
Ok(v) => {
match account {
@ -101,7 +101,7 @@ impl Rpc {
}
}
fn account_create(data: Vec<u8>, tx: &mut Transaction) -> Result<RpcResponse, Error> {
fn account_create(data: Vec<u8>, tx: &mut Transaction, account: Option<Account>, client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
match from_slice::<AccountCreateMsg>(&data) {
Ok(v) => Ok(RpcResponse {
method: v.method,
@ -111,7 +111,7 @@ impl Rpc {
}
}
fn account_login(data: Vec<u8>, tx: &mut Transaction) -> Result<RpcResponse, Error> {
fn account_login(data: Vec<u8>, tx: &mut Transaction, _account: Option<Account>, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
match from_slice::<AccountLoginMsg>(&data) {
Ok(v) => Ok(RpcResponse {
method: v.method,
@ -121,7 +121,7 @@ impl Rpc {
}
}
fn account_cryps(tx: &mut Transaction, account: Option<Account>) -> Result<RpcResponse, Error> {
fn account_cryps(_data: Vec<u8>, tx: &mut Transaction, account: Option<Account>, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
match account {
Some(a) => Ok(RpcResponse {
method: "account_cryps".to_string(),
@ -131,7 +131,7 @@ impl Rpc {
}
}
fn item_list(tx: &mut Transaction, account: Option<Account>) -> Result<RpcResponse, Error> {
fn item_list(_data: Vec<u8>, tx: &mut Transaction, account: Option<Account>, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
match account {
Some(a) => Ok(RpcResponse {
method: "item_list".to_string(),
@ -141,7 +141,7 @@ impl Rpc {
}
}
fn item_use(data: Vec<u8>, tx: &mut Transaction, account: Option<Account>) -> Result<RpcResponse, Error> {
fn item_use(data: Vec<u8>, tx: &mut Transaction, account: Option<Account>, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
match from_slice::<ItemUseMsg>(&data) {
Ok(v) => {
match account {