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]
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"
test-server = "-Zpackage-features 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-world-server = "-Zunstable-options -Zpackage-features 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"
tracy-voxygen = "-Zunstable-options -Zpackage-features run --bin veloren-voxygen --no-default-features --features tracy,gl,simd --profile no_overflow"
test-server = "run --bin veloren-server-cli --no-default-features -- -b"
tracy-server = "-Zunstable-options run --bin veloren-server-cli --no-default-features --features tracy,simd --profile no_overflow"
tracy-world-server = "-Zunstable-options run --bin veloren-server-cli --features tracy,simd --profile no_overflow -- -b"
test-voxygen = "run --bin veloren-voxygen --no-default-features --features gl,simd"
tracy-voxygen = "-Zunstable-options run --bin veloren-voxygen --no-default-features --features tracy,gl,simd --profile no_overflow"
server = "run --bin veloren-server-cli"

View File

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

View File

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

View File

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

View File

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

View File

@ -118,12 +118,15 @@ pub fn handle_process_trade_action(
.map(|i| ReducedInventory::from(i));
// Get price info from the first Agent in the trade (currently, an
// Agent will never initiate a trade with another agent though)
prices = prices.or_else(|| {
agents
.get(e)
.and_then(|a| a.behavior.trade_site)
.and_then(|id| server.index.get_site_prices(id))
});
#[cfg(feature = "worldgen")]
{
prices = prices.or_else(|| {
agents
.get(e)
.and_then(|a| a.behavior.trade_site)
.and_then(|id| server.index.get_site_prices(id))
});
}
}
}
drop(agents);
@ -137,6 +140,7 @@ pub fn handle_process_trade_action(
prices.clone(),
),
);
#[cfg(feature = "worldgen")]
notify_agent_prices(
server.state.ecs().write_storage::<Agent>(),
&server.index,

View File

@ -337,15 +337,21 @@ impl Server {
// Insert a default AABB for the world
// TODO: prevent this from being deleted
{
let mut build_areas = state.ecs().write_resource::<BuildAreas>();
let world_size = world.sim().get_size().map(|e| e as i32)
* TerrainChunk::RECT_SIZE.map(|e| e as i32);
#[cfg(feature = "worldgen")]
let size = world.sim().get_size();
#[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 {
min: Vec3::new(0, 0, -32768),
max: Vec3::new(world_size.x, world_size.y, 32767),
}
.made_valid();
build_areas
state
.ecs()
.write_resource::<BuildAreas>()
.insert("world".to_string(), world_aabb)
.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
/// player view distance so it is actually a bit farther due to a buffer
/// zone
#[cfg(feature = "worldgen")]
pub fn create_centered_persister(&mut self, view_distance: u32) {
let world_dims_chunks = self.world.sim().get_size();
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"))]
let mut rtsim = RtSim::new(Vec2::new(40, 40));
#[cfg(feature = "worldgen")]
for _ in 0..world.sim().get_size().product() / 400 {
let pos = rtsim
.chunks

View File

@ -352,7 +352,10 @@ impl StateExt for State {
* TerrainChunkSize::RECT_SIZE.x as f64
})
.for_each(|chunk_key| {
chunk_generator.generate_chunk(None, chunk_key, &slow_jobs, Arc::clone(world), index.clone());
#[cfg(feature = "worldgen")]
{
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>,
time_of_day: Read<'a, TimeOfDay>,
light_emitter: ReadStorage<'a, LightEmitter>,
#[cfg(feature = "worldgen")]
world: ReadExpect<'a, Arc<world::World>>,
rtsim_entities: ReadStorage<'a, RtSimEntity>,
buffs: ReadStorage<'a, Buffs>,
@ -761,12 +762,15 @@ impl<'a> AgentData<'a> {
let mut ground_too_close = self
.body
.map(|body| {
#[cfg(feature = "worldgen")]
let height_approx = self.pos.0.y
- read_data
.world
.sim()
.get_alt_approx(self.pos.0.xy().map(|x: f32| x as i32))
.unwrap_or(0.0);
#[cfg(not(feature = "worldgen"))]
let height_approx = self.pos.0.y;
height_approx < body.flying_height()
})