| 169 | chara, |
| 170 | voice, |
| 171 | }); |
| 172 | } |
| 173 | |
| 174 | pub(crate) fn push_command(&mut self, command: Commands) { |
| 175 | self.commands.push(command); |
| 176 | } |
| 177 | |
| 178 | pub(crate) fn backlog(&self) -> Vec<BackLogItem> { |
| 179 | let total = self.backlog.len(); |
| 180 | if total == 0 { |
| 181 | return vec![]; |
| 182 | } |
| 183 | |
| 184 | let end = total.saturating_sub(self.backlog_offset); |
| 185 | let start = end.saturating_sub(WINDOW_SIZE); |
| 186 | self.backlog[start..end].to_vec() |
| 187 | } |
| 188 | |
| 189 | pub(crate) fn last_voice(&self) -> Option<(String, String)> { |
| 190 | let backlog = self.backlog.last().unwrap(); |
| 191 | if backlog.voice.is_empty() && backlog.chara.is_empty() { |
| 192 | return None; |
| 193 | } |