Fixed cargo test-server. Removed -Z package-features from .cargo/config as it is no longer required

This commit is contained in:
Ben Wallis 2021-04-15 19:07:46 +01:00
parent a386a27411
commit 95d7a3d761
10 changed files with 46 additions and 16 deletions

View File

@ -6,10 +6,10 @@ rustflags = [
[alias] [alias]
csv-export = "run --manifest-path common/Cargo.toml --features=bin_csv --bin csv_export" csv-export = "run --manifest-path common/Cargo.toml --features=bin_csv --bin csv_export"
csv-import = "run --manifest-path common/Cargo.toml --features=bin_csv --bin csv_import" csv-import = "run --manifest-path common/Cargo.toml --features=bin_csv --bin csv_import"
test-server = "-Zpackage-features run --bin veloren-server-cli --no-default-features -- -b" test-server = "run --bin veloren-server-cli --no-default-features -- -b"
tracy-server = "-Zunstable-options -Zpackage-features run --bin veloren-server-cli --no-default-features --features tracy,simd --profile no_overflow" tracy-server = "-Zunstable-options run --bin veloren-server-cli --no-default-features --features tracy,simd --profile no_overflow"
tracy-world-server = "-Zunstable-options -Zpackage-features run --bin veloren-server-cli --features tracy,simd --profile no_overflow -- -b" tracy-world-server = "-Zunstable-options run --bin veloren-server-cli --features tracy,simd --profile no_overflow -- -b"
test-voxygen = "-Zpackage-features run --bin veloren-voxygen --no-default-features --features gl,simd" test-voxygen = "run --bin veloren-voxygen --no-default-features --features gl,simd"
tracy-voxygen = "-Zunstable-options -Zpackage-features run --bin veloren-voxygen --no-default-features --features tracy,gl,simd --profile no_overflow" tracy-voxygen = "-Zunstable-options run --bin veloren-voxygen --no-default-features --features tracy,gl,simd --profile no_overflow"
server = "run --bin veloren-server-cli" server = "run --bin veloren-server-cli"

View File

@ -248,6 +248,7 @@ fn main() -> io::Result<()> {
server.remove_admin(&username); server.remove_admin(&username);
}, },
Message::LoadArea(view_distance) => { Message::LoadArea(view_distance) => {
#[cfg(feature = "worldgen")]
server.create_centered_persister(view_distance); server.create_centered_persister(view_distance);
}, },
Message::SetSqlLogMode(sql_log_mode) => { Message::SetSqlLogMode(sql_log_mode) => {

View File

@ -516,6 +516,7 @@ fn handle_site(
args: String, args: String,
action: &ChatCommand, action: &ChatCommand,
) -> CmdResult<()> { ) -> CmdResult<()> {
#[cfg(feature = "worldgen")]
if let Ok(dest_name) = scan_fmt!(&args, &action.arg_fmt(), String) { if let Ok(dest_name) = scan_fmt!(&args, &action.arg_fmt(), String) {
let site = server let site = server
.world .world
@ -538,6 +539,9 @@ fn handle_site(
} else { } else {
Err(action.help_string()) Err(action.help_string())
} }
#[cfg(not(feature = "worldgen"))]
Ok(())
} }
fn handle_home( fn handle_home(

View File

@ -12,6 +12,8 @@ pub fn handle_site_info(server: &Server, entity: EcsEntity, id: u64) {
labor_values: HashMap::new(), labor_values: HashMap::new(),
values: HashMap::new(), values: HashMap::new(),
labors: Vec::new(), labors: Vec::new(),
last_exports: HashMap::new(),
resources: HashMap::new(),
}; };
let msg = ServerGeneral::SiteEconomy(info); let msg = ServerGeneral::SiteEconomy(info);
server server

View File

@ -223,6 +223,7 @@ pub fn handle_invite_accept(server: &mut Server, entity: specs::Entity) {
.inbox .inbox
.push_front(AgentEvent::TradeAccepted(invitee_uid)); .push_front(AgentEvent::TradeAccepted(invitee_uid));
} }
#[cfg(feature = "worldgen")]
let pricing = agents let pricing = agents
.get(inviter) .get(inviter)
.and_then(|a| { .and_then(|a| {
@ -237,6 +238,9 @@ pub fn handle_invite_accept(server: &mut Server, entity: specs::Entity) {
.and_then(|id| index.get_site_prices(id)) .and_then(|id| index.get_site_prices(id))
}) })
}); });
#[cfg(not(feature = "worldgen"))]
let pricing = None;
clients.get(inviter).map(|c| { clients.get(inviter).map(|c| {
c.send(ServerGeneral::UpdatePendingTrade( c.send(ServerGeneral::UpdatePendingTrade(
id, id,

View File

@ -118,6 +118,8 @@ pub fn handle_process_trade_action(
.map(|i| ReducedInventory::from(i)); .map(|i| ReducedInventory::from(i));
// Get price info from the first Agent in the trade (currently, an // Get price info from the first Agent in the trade (currently, an
// Agent will never initiate a trade with another agent though) // Agent will never initiate a trade with another agent though)
#[cfg(feature = "worldgen")]
{
prices = prices.or_else(|| { prices = prices.or_else(|| {
agents agents
.get(e) .get(e)
@ -126,6 +128,7 @@ pub fn handle_process_trade_action(
}); });
} }
} }
}
drop(agents); drop(agents);
for party in entities.iter() { for party in entities.iter() {
if let Some(e) = *party { if let Some(e) = *party {
@ -137,6 +140,7 @@ pub fn handle_process_trade_action(
prices.clone(), prices.clone(),
), ),
); );
#[cfg(feature = "worldgen")]
notify_agent_prices( notify_agent_prices(
server.state.ecs().write_storage::<Agent>(), server.state.ecs().write_storage::<Agent>(),
&server.index, &server.index,

View File

@ -337,15 +337,21 @@ impl Server {
// Insert a default AABB for the world // Insert a default AABB for the world
// TODO: prevent this from being deleted // TODO: prevent this from being deleted
{ {
let mut build_areas = state.ecs().write_resource::<BuildAreas>(); #[cfg(feature = "worldgen")]
let world_size = world.sim().get_size().map(|e| e as i32) let size = world.sim().get_size();
* TerrainChunk::RECT_SIZE.map(|e| e as i32); #[cfg(not(feature = "worldgen"))]
let size = Vec2::new(40, 40);
let world_size = size.map(|e| e as i32) * TerrainChunk::RECT_SIZE.map(|e| e as i32);
let world_aabb = Aabb { let world_aabb = Aabb {
min: Vec3::new(0, 0, -32768), min: Vec3::new(0, 0, -32768),
max: Vec3::new(world_size.x, world_size.y, 32767), max: Vec3::new(world_size.x, world_size.y, 32767),
} }
.made_valid(); .made_valid();
build_areas
state
.ecs()
.write_resource::<BuildAreas>()
.insert("world".to_string(), world_aabb) .insert("world".to_string(), world_aabb)
.expect("The initial insert should always work."); .expect("The initial insert should always work.");
} }
@ -1092,6 +1098,7 @@ impl Server {
/// view_distance: distance in chunks that are persisted, this acts like the /// view_distance: distance in chunks that are persisted, this acts like the
/// player view distance so it is actually a bit farther due to a buffer /// player view distance so it is actually a bit farther due to a buffer
/// zone /// zone
#[cfg(feature = "worldgen")]
pub fn create_centered_persister(&mut self, view_distance: u32) { pub fn create_centered_persister(&mut self, view_distance: u32) {
let world_dims_chunks = self.world.sim().get_size(); let world_dims_chunks = self.world.sim().get_size();
let world_dims_blocks = TerrainChunkSize::blocks(world_dims_chunks); let world_dims_blocks = TerrainChunkSize::blocks(world_dims_chunks);

View File

@ -104,6 +104,7 @@ pub fn init(state: &mut State, #[cfg(feature = "worldgen")] world: &world::World
#[cfg(not(feature = "worldgen"))] #[cfg(not(feature = "worldgen"))]
let mut rtsim = RtSim::new(Vec2::new(40, 40)); let mut rtsim = RtSim::new(Vec2::new(40, 40));
#[cfg(feature = "worldgen")]
for _ in 0..world.sim().get_size().product() / 400 { for _ in 0..world.sim().get_size().product() / 400 {
let pos = rtsim let pos = rtsim
.chunks .chunks

View File

@ -352,7 +352,10 @@ impl StateExt for State {
* TerrainChunkSize::RECT_SIZE.x as f64 * TerrainChunkSize::RECT_SIZE.x as f64
}) })
.for_each(|chunk_key| { .for_each(|chunk_key| {
#[cfg(feature = "worldgen")]
{
chunk_generator.generate_chunk(None, chunk_key, &slow_jobs, Arc::clone(world), index.clone()); chunk_generator.generate_chunk(None, chunk_key, &slow_jobs, Arc::clone(world), index.clone());
}
}); });
} }

View File

@ -95,6 +95,7 @@ pub struct ReadData<'a> {
mount_states: ReadStorage<'a, MountState>, mount_states: ReadStorage<'a, MountState>,
time_of_day: Read<'a, TimeOfDay>, time_of_day: Read<'a, TimeOfDay>,
light_emitter: ReadStorage<'a, LightEmitter>, light_emitter: ReadStorage<'a, LightEmitter>,
#[cfg(feature = "worldgen")]
world: ReadExpect<'a, Arc<world::World>>, world: ReadExpect<'a, Arc<world::World>>,
rtsim_entities: ReadStorage<'a, RtSimEntity>, rtsim_entities: ReadStorage<'a, RtSimEntity>,
buffs: ReadStorage<'a, Buffs>, buffs: ReadStorage<'a, Buffs>,
@ -761,12 +762,15 @@ impl<'a> AgentData<'a> {
let mut ground_too_close = self let mut ground_too_close = self
.body .body
.map(|body| { .map(|body| {
#[cfg(feature = "worldgen")]
let height_approx = self.pos.0.y let height_approx = self.pos.0.y
- read_data - read_data
.world .world
.sim() .sim()
.get_alt_approx(self.pos.0.xy().map(|x: f32| x as i32)) .get_alt_approx(self.pos.0.xy().map(|x: f32| x as i32))
.unwrap_or(0.0); .unwrap_or(0.0);
#[cfg(not(feature = "worldgen"))]
let height_approx = self.pos.0.y;
height_approx < body.flying_height() height_approx < body.flying_height()
}) })