|
@@ -36,7 +36,7 @@ pub mod world {
|
|
|
}
|
|
|
|
|
|
#[allow(unused_variables)]
|
|
|
- pub fn add_entity(ctx: Context<AddEntity>, extra_seed: Option<String>) -> Result<()> {
|
|
|
+ pub fn add_entity(ctx: Context<AddEntity>, seed: Option<String>) -> Result<()> {
|
|
|
require!(
|
|
|
ctx.accounts.world.key() == ctx.accounts.world.pda().0,
|
|
|
WorldError::WorldAccountMismatch
|
|
@@ -132,16 +132,16 @@ pub struct InitializeNewWorld<'info> {
|
|
|
}
|
|
|
|
|
|
#[derive(Accounts)]
|
|
|
-#[instruction(extra_seed: Option<String>)]
|
|
|
+#[instruction(seed: Option<String>)]
|
|
|
pub struct AddEntity<'info> {
|
|
|
#[account(mut)]
|
|
|
pub payer: Signer<'info>,
|
|
|
- #[account(init, payer = payer, space = World::size(), seeds = [Entity::seed(), &world.id.to_be_bytes(),
|
|
|
- &match extra_seed {
|
|
|
+ #[account(init, payer = payer, space = World::size(), seeds = [Entity::seed(), &world.key().to_bytes(),
|
|
|
+ &match seed {
|
|
|
Some(ref seed) => [0; 8],
|
|
|
None => world.entities.to_be_bytes()
|
|
|
},
|
|
|
- match extra_seed {
|
|
|
+ match seed {
|
|
|
Some(ref seed) => seed.as_bytes(),
|
|
|
None => &[],
|
|
|
}], bump)]
|