allow inlining (this did not provide a statistically significant performance boost - oh well)

This commit is contained in:
2020-04-28 18:00:31 +01:00
parent dd00686de0
commit f899f03dbe
15 changed files with 56 additions and 2 deletions

View File

@@ -15,10 +15,12 @@ pub struct Room {
}
impl Room {
#[inline]
fn name_line(&self) -> String {
optional_data_line("NAME", self.name.as_ref())
}
#[inline]
fn wall_line(&self) -> String {
if self.walls.len() > 0 {
let ids: Vec<String> = self.walls.iter().map(|&id| id.to_base36()).collect();
@@ -28,6 +30,7 @@ impl Room {
}
}
#[inline]
fn palette_line(&self) -> String {
if self.palette_id.is_some() {
optional_data_line("PAL", Some(self.palette_id.unwrap().to_base36()))
@@ -38,6 +41,7 @@ impl Room {
}
impl From<String> for Room {
#[inline]
fn from(string: String) -> Room {
let string = string.replace("ROOM ", "");
let string = string.replace("SET ", "");
@@ -141,6 +145,7 @@ impl From<String> for Room {
}
impl Room {
#[inline]
pub fn to_string(&self, room_format: RoomFormat, room_type: RoomType) -> String {
let mut tiles = String::new();
let mut items = String::new();