sendgc #103
| @ -11,11 +11,10 @@ pub struct UserAccountId(pub u32); | |||||||
| #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] | #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] | ||||||
| pub struct UserSettingsId(pub u32); | pub struct UserSettingsId(pub u32); | ||||||
| 
 | 
 | ||||||
| // TODO: use these
 |  | ||||||
| #[derive(Debug)] | #[derive(Debug)] | ||||||
|  | |||||||
| pub enum GuildcardError { | pub enum GuildcardError { | ||||||
|     GuildcardAlreadyFriend(u32), |     GuildcardAlreadyFriend(UserAccountId), | ||||||
|     GuildcardAlreadyBlocked(u32), |     GuildcardAlreadyBlocked(UserAccountId), | ||||||
|     GuildcardListFull, |     GuildcardListFull, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -130,7 +129,6 @@ impl NewGuildCardDataEntity { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: implement this properly
 |  | ||||||
| #[derive(Clone, Debug)] | #[derive(Clone, Debug)] | ||||||
| pub struct GuildCardDataEntity { | pub struct GuildCardDataEntity { | ||||||
|     pub user_id: UserAccountId, |     pub user_id: UserAccountId, | ||||||
| @ -148,10 +146,8 @@ impl GuildCardDataEntity { | |||||||
|     pub fn add_friend(&mut self, new_friend: &GuildcardAccept) -> Result<(), GuildcardError> { |     pub fn add_friend(&mut self, new_friend: &GuildcardAccept) -> Result<(), GuildcardError> { | ||||||
|         let next_open_spot = self.guildcard_data.friends |         let next_open_spot = self.guildcard_data.friends | ||||||
|                                                         .iter() |                                                         .iter() | ||||||
|                                                         .enumerate() |                                                         .position(|&g| g.id == 0) | ||||||
|                                                         .find(|(_i, g)| g.id == 0) |                                                         .ok_or(GuildcardError::GuildcardListFull)?; | ||||||
|                                                         .ok_or(GuildcardError::GuildcardListFull)? |  | ||||||
|                                                         .0; |  | ||||||
|         self.guildcard_data.friends[next_open_spot] = guildcard::GuildCard::from(new_friend); |         self.guildcard_data.friends[next_open_spot] = guildcard::GuildCard::from(new_friend); | ||||||
|         Ok(()) // TODO: implement a real error
 |         Ok(()) // TODO: implement a real error
 | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	
TODO: remove TODO