equal
deleted
inserted
replaced
168 )), |
168 )), |
169 "$maze_size" => config.push(GameCfg::MazeSize( |
169 "$maze_size" => config.push(GameCfg::MazeSize( |
170 u32::from_str(arg).unwrap_or_default(), |
170 u32::from_str(arg).unwrap_or_default(), |
171 )), |
171 )), |
172 "addteam" => { |
172 "addteam" => { |
173 if let parts = arg.splitn(3, ' ').collect::<Vec<_>>() { |
173 let parts = arg.splitn(3, ' ').collect::<Vec<_>>(); |
174 let color = parts.get(1).unwrap_or(&"1"); |
174 let color = parts.get(1).unwrap_or(&"1"); |
175 let name = parts.get(2).unwrap_or(&"Unnamed"); |
175 let name = parts.get(2).unwrap_or(&"Unnamed"); |
176 teams.push(TeamInfo { |
176 teams.push(TeamInfo { |
177 color: (u32::from_str(color).unwrap_or(2113696) |
177 color: (u32::from_str(color).unwrap_or(2113696) / 2113696 |
178 / 2113696 |
178 - 1) |
179 - 1) |
179 as u8, |
180 as u8, |
180 name: name.to_string(), |
181 name: name.to_string(), |
181 ..TeamInfo::default() |
182 ..TeamInfo::default() |
182 }); |
183 }) |
|
184 }; |
|
185 } |
183 } |
186 "fort" => teams |
184 "fort" => teams |
187 .last_mut() |
185 .last_mut() |
188 .iter_mut() |
186 .iter_mut() |
189 .for_each(|t| t.fort = arg.to_string()), |
187 .for_each(|t| t.fort = arg.to_string()), |
191 .last_mut() |
189 .last_mut() |
192 .iter_mut() |
190 .iter_mut() |
193 .for_each(|t| t.grave = arg.to_string()), |
191 .for_each(|t| t.grave = arg.to_string()), |
194 "addhh" => { |
192 "addhh" => { |
195 hog_index = (hog_index + 1) % 8; |
193 hog_index = (hog_index + 1) % 8; |
196 if let parts = arg.splitn(3, ' ').collect::<Vec<_>>() { |
194 let parts = arg.splitn(3, ' ').collect::<Vec<_>>(); |
197 let health = parts.get(1).unwrap_or(&"100"); |
195 let health = parts.get(1).unwrap_or(&"100"); |
198 teams.last_mut().iter_mut().for_each(|t| { |
196 teams.last_mut().iter_mut().for_each(|t| { |
199 if let Some(difficulty) = parts.get(0) { |
197 if let Some(difficulty) = parts.get(0) { |
200 t.difficulty = |
198 t.difficulty = u8::from_str(difficulty).unwrap_or(0); |
201 u8::from_str(difficulty).unwrap_or(0); |
199 } |
202 } |
200 if let Some(init_health) = parts.get(1) { |
203 if let Some(init_health) = parts.get(1) { |
201 scheme_properties[2] = init_health.to_string(); |
204 scheme_properties[2] = init_health.to_string(); |
202 } |
205 } |
203 t.hedgehogs_number = (hog_index + 1) as u8; |
206 t.hedgehogs_number = (hog_index + 1) as u8; |
204 t.hedgehogs[hog_index].name = |
207 t.hedgehogs[hog_index].name = |
205 parts.get(2).unwrap_or(&"Unnamed").to_string(); |
208 parts.get(2).unwrap_or(&"Unnamed").to_string() |
206 }); |
209 }); |
|
210 } |
|
211 } |
207 } |
212 "hat" => { |
208 "hat" => { |
213 teams |
209 teams |
214 .last_mut() |
210 .last_mut() |
215 .iter_mut() |
211 .iter_mut() |