Browse Source

remove pktvec

pbs
jake 5 years ago
parent
commit
ba226cc28a
  1. 3
      src/common/mod.rs
  2. 90
      src/common/pktvec.rs
  3. 2
      src/login/character.rs
  4. 3
      src/login/login.rs

3
src/common/mod.rs

@ -1,6 +1,3 @@
#[macro_use]
pub mod pktvec;
pub mod cipherkeys; pub mod cipherkeys;
pub mod network; pub mod network;
pub mod serverstate; pub mod serverstate;

90
src/common/pktvec.rs

@ -1,90 +0,0 @@
use std::collections::VecDeque;
use libpso::PSOPacket;
pub struct PktVec {
pkts: VecDeque<Box<dyn PSOPacket>>,
}
impl PktVec {
pub fn new() -> PktVec {
PktVec {
pkts: VecDeque::new(),
}
}
pub fn push(&mut self, pkt: Box<dyn PSOPacket>) {
self.pkts.push_back(pkt);
}
pub fn append(&mut self, pkts: Vec<Box<dyn PSOPacket>>) {
self.pkts.append(&mut VecDeque::from(pkts));
}
/*pub fn append(&mut self, pkts: &mut Vec<Box<dyn PSOPacket>>) {
self.pkts.append(&mut pkts.into());
}*/
}
impl Iterator for PktVec {
type Item = Box<dyn PSOPacket>;
fn next(&mut self) -> Option<Self::Item> {
/*if self.index < self.pkts.len() {
let pkt = Some(self.pkts[self.index]);
self.index += 1;
pkt
}
else {
None
}*/
self.pkts.pop_front()
}
}
#[macro_export]
macro_rules! pktvec {
( $( $pkt:expr ),* ) => {
{
let mut pkts = Box::new(PktVec::new());
$(
pkts.push(Box::new($pkt));
)*
pkts
}
};
}
/*
struct PktVecIter {
iter: Box<dyn Iterator<Item = Box<dyn PSOPacket>>>,
}
impl Iterator for PktVecIter {
type Item = Box<dyn PSOPacket>;
fn next(&mut self) -> Option<Self::Item> {
self.iter.next()
}
}
struct PktVec {
pkts: Vec<Box<dyn PSOPacket>>
}
impl PktVec {
fn push(&mut self, pkt: impl PSOPacket) {
self.pkts.push(Box::new(pkt))
}
fn iter(&self) -> PktVecIter {
PktVecIter {
iter: self.pkts.iter()
}
}
}
*/

2
src/login/character.rs

@ -12,8 +12,6 @@ use libpso::{PacketParseError, PSOPacket};
use libpso::crypto::{CipherError, PSOCipher, NullCipher}; use libpso::crypto::{CipherError, PSOCipher, NullCipher};
use libpso::crypto::bb::PSOBBCipher; use libpso::crypto::bb::PSOBBCipher;
use elseware::pktvec;
use elseware::common::pktvec::PktVec;
use elseware::common::cipherkeys::{ELSEWHERE_PRIVATE_KEY, ELSEWHERE_PARRAY}; use elseware::common::cipherkeys::{ELSEWHERE_PRIVATE_KEY, ELSEWHERE_PARRAY};
use elseware::common::network::{PacketNetworkError}; use elseware::common::network::{PacketNetworkError};
use elseware::common::client::Client; use elseware::common::client::Client;

3
src/login/login.rs

@ -10,8 +10,7 @@ use libpso::{PacketParseError, PSOPacket};
use libpso::crypto::{CipherError, PSOCipher, NullCipher}; use libpso::crypto::{CipherError, PSOCipher, NullCipher};
use libpso::crypto::bb::PSOBBCipher; use libpso::crypto::bb::PSOBBCipher;
use elseware::{pktvec, utf8_to_array};
use elseware::common::pktvec::PktVec;
use elseware::utf8_to_array;
use elseware::common::cipherkeys::{ELSEWHERE_PRIVATE_KEY, ELSEWHERE_PARRAY}; use elseware::common::cipherkeys::{ELSEWHERE_PRIVATE_KEY, ELSEWHERE_PARRAY};
//use elseware::common::network::{PacketNetworkError}; //use elseware::common::network::{PacketNetworkError};
use elseware::common::client::Client; use elseware::common::client::Client;

Loading…
Cancel
Save