name max len of 20
This commit is contained in:
parent
2894e346e3
commit
1b71c79bb9
@ -271,8 +271,11 @@ impl Construct {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn new_name(self, name: String) -> Construct {
|
||||
self.named(&name)
|
||||
pub fn new_name(self, name: String) -> Result<Construct, Error> {
|
||||
if name.len() > 20 {
|
||||
return Err(err_msg("20 character name maximum"));
|
||||
}
|
||||
Ok(self.named(&name))
|
||||
}
|
||||
|
||||
pub fn learn(mut self, s: Skill) -> Construct {
|
||||
|
||||
@ -152,7 +152,7 @@ pub fn apply(tx: &mut Transaction, account: &Account, variant: MtxVariant, const
|
||||
account::debit(tx, account.id, cost)?;
|
||||
|
||||
construct = match mtx.variant {
|
||||
MtxVariant::Rename => construct.new_name(name),
|
||||
MtxVariant::Rename => construct.new_name(name)?,
|
||||
_ => construct.new_img(),
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user