52 lines
1.7 KiB
Rust
52 lines
1.7 KiB
Rust
|
#![feature(const_generics)]
|
||
|
|
||
|
|
||
|
mod common;
|
||
|
mod entity;
|
||
|
mod patch;
|
||
|
mod login;
|
||
|
mod ship;
|
||
|
|
||
|
use std::thread;
|
||
|
|
||
|
use patch::patch::{PatchServerState, generate_patch_tree};
|
||
|
use login::login::LoginServerState;
|
||
|
use login::character::CharacterServerState;
|
||
|
use ship::ship::ShipServerState;
|
||
|
|
||
|
use entity::gateway::{EntityGateway, InMemoryGateway};
|
||
|
|
||
|
fn main() {
|
||
|
let entity_gateway = InMemoryGateway::new();
|
||
|
|
||
|
let patch_thread = thread::spawn(|| {
|
||
|
println!("[patch] starting server");
|
||
|
let (patch_file_tree, patch_file_lookup) = generate_patch_tree("patchfiles/");
|
||
|
let patch_state = PatchServerState::new(patch_file_tree, patch_file_lookup);
|
||
|
common::mainloop::mainloop(patch_state, patch::patch::PATCH_PORT);
|
||
|
});
|
||
|
let thread_entity_gateway = entity_gateway.clone();
|
||
|
let auth_thread = thread::spawn(|| {
|
||
|
println!("[auth] starting server");
|
||
|
let auth_state = LoginServerState::new(thread_entity_gateway);
|
||
|
common::mainloop::mainloop(auth_state, login::login::LOGIN_PORT);
|
||
|
});
|
||
|
let thread_entity_gateway = entity_gateway.clone();
|
||
|
let char_thread = thread::spawn(|| {
|
||
|
println!("[character] starting server");
|
||
|
let char_state = CharacterServerState::new(thread_entity_gateway);
|
||
|
common::mainloop::mainloop(char_state, login::character::CHARACTER_PORT);
|
||
|
});
|
||
|
let thread_entity_gateway = entity_gateway.clone();
|
||
|
let ship_thread = thread::spawn(|| {
|
||
|
println!("[ship] starting server");
|
||
|
let ship_state = ShipServerState::new(thread_entity_gateway);
|
||
|
common::mainloop::mainloop(ship_state, ship::ship::SHIP_PORT);
|
||
|
});
|
||
|
|
||
|
patch_thread.join().unwrap();
|
||
|
auth_thread.join().unwrap();
|
||
|
char_thread.join().unwrap();
|
||
|
ship_thread.join().unwrap();
|
||
|
}
|