mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'christof/location_fix' into 'master'
Correct location names after editing and creation See merge request veloren/veloren!4108
This commit is contained in:
commit
6c57d17714
@ -59,6 +59,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Dungeons now have an outer wall, preventing them from intersecting with caves or leaving holes in sides of mountains.
|
- Dungeons now have an outer wall, preventing them from intersecting with caves or leaving holes in sides of mountains.
|
||||||
- Location names are displayed in character selection dialog
|
- Location names are displayed in character selection dialog
|
||||||
- You can no longer write messages to old groups after being kicked and not having updated your chat mode.
|
- You can no longer write messages to old groups after being kicked and not having updated your chat mode.
|
||||||
|
- Location names are now also correct after editing and creating characters
|
||||||
|
|
||||||
## [0.15.0] - 2023-07-01
|
## [0.15.0] - 2023-07-01
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ use common::grid::Grid;
|
|||||||
use common::{
|
use common::{
|
||||||
assets::AssetExt,
|
assets::AssetExt,
|
||||||
calendar::Calendar,
|
calendar::Calendar,
|
||||||
character::CharacterId,
|
character::{CharacterId, CharacterItem},
|
||||||
cmd::ServerChatCommand,
|
cmd::ServerChatCommand,
|
||||||
comp,
|
comp,
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
@ -652,6 +652,24 @@ impl Server {
|
|||||||
/// Get a reference to the server's world.
|
/// Get a reference to the server's world.
|
||||||
pub fn world(&self) -> &World { &self.world }
|
pub fn world(&self) -> &World { &self.world }
|
||||||
|
|
||||||
|
fn parse_locations(&self, character_list_data: &mut [CharacterItem]) {
|
||||||
|
character_list_data.iter_mut().for_each(|c| {
|
||||||
|
let name = c
|
||||||
|
.location
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|s| {
|
||||||
|
persistence::parse_waypoint(s)
|
||||||
|
.ok()
|
||||||
|
.and_then(|(waypoint, _)| waypoint.map(|w| w.get_pos()))
|
||||||
|
})
|
||||||
|
.and_then(|wpos| {
|
||||||
|
self.world
|
||||||
|
.get_location_name(self.index.as_index_ref(), wpos.xy().as_::<i32>())
|
||||||
|
});
|
||||||
|
c.location = name;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// Execute a single server tick, handle input and update the game state by
|
/// Execute a single server tick, handle input and update the game state by
|
||||||
/// the given duration.
|
/// the given duration.
|
||||||
pub fn tick(&mut self, _input: Input, dt: Duration) -> Result<Vec<Event>, Error> {
|
pub fn tick(&mut self, _input: Input, dt: Duration) -> Result<Vec<Event>, Error> {
|
||||||
@ -903,23 +921,7 @@ impl Server {
|
|||||||
match response.response_kind {
|
match response.response_kind {
|
||||||
CharacterScreenResponseKind::CharacterList(result) => match result {
|
CharacterScreenResponseKind::CharacterList(result) => match result {
|
||||||
Ok(mut character_list_data) => {
|
Ok(mut character_list_data) => {
|
||||||
character_list_data.iter_mut().for_each(|c| {
|
self.parse_locations(&mut character_list_data);
|
||||||
let name = c
|
|
||||||
.location
|
|
||||||
.as_ref()
|
|
||||||
.and_then(|s| {
|
|
||||||
persistence::parse_waypoint(s).ok().and_then(
|
|
||||||
|(waypoint, _)| waypoint.map(|w| w.get_pos()),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.and_then(|wpos| {
|
|
||||||
self.world.get_location_name(
|
|
||||||
self.index.as_index_ref(),
|
|
||||||
wpos.xy().as_::<i32>(),
|
|
||||||
)
|
|
||||||
});
|
|
||||||
c.location = name;
|
|
||||||
});
|
|
||||||
self.notify_client(
|
self.notify_client(
|
||||||
response.target_entity,
|
response.target_entity,
|
||||||
ServerGeneral::CharacterListUpdate(character_list_data),
|
ServerGeneral::CharacterListUpdate(character_list_data),
|
||||||
@ -931,7 +933,8 @@ impl Server {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
CharacterScreenResponseKind::CharacterCreation(result) => match result {
|
CharacterScreenResponseKind::CharacterCreation(result) => match result {
|
||||||
Ok((character_id, list)) => {
|
Ok((character_id, mut list)) => {
|
||||||
|
self.parse_locations(&mut list);
|
||||||
self.notify_client(
|
self.notify_client(
|
||||||
response.target_entity,
|
response.target_entity,
|
||||||
ServerGeneral::CharacterListUpdate(list),
|
ServerGeneral::CharacterListUpdate(list),
|
||||||
@ -947,7 +950,8 @@ impl Server {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
CharacterScreenResponseKind::CharacterEdit(result) => match result {
|
CharacterScreenResponseKind::CharacterEdit(result) => match result {
|
||||||
Ok((character_id, list)) => {
|
Ok((character_id, mut list)) => {
|
||||||
|
self.parse_locations(&mut list);
|
||||||
self.notify_client(
|
self.notify_client(
|
||||||
response.target_entity,
|
response.target_entity,
|
||||||
ServerGeneral::CharacterListUpdate(list),
|
ServerGeneral::CharacterListUpdate(list),
|
||||||
|
Loading…
Reference in New Issue
Block a user