Skip to content

Commit

Permalink
Rename component to model (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev authored Sep 28, 2023
1 parent 00dd22a commit ff040b0
Show file tree
Hide file tree
Showing 75 changed files with 387 additions and 461 deletions.
6 changes: 3 additions & 3 deletions crates/dojo-core/src/database.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ fn del(class_hash: starknet::ClassHash, table: felt252, key: felt252) {
// returns a tuple of spans, first contains the entity IDs,
// second the deserialized entities themselves
fn all(
class_hash: starknet::ClassHash, component: felt252, partition: felt252, length: usize, layout: Span<u8>
class_hash: starknet::ClassHash, model: felt252, partition: felt252, length: usize, layout: Span<u8>
) -> (Span<felt252>, Span<Span<felt252>>) {
let table = {
if partition == 0.into() {
component
model
} else {
let mut serialized = ArrayTrait::new();
component.serialize(ref serialized);
model.serialize(ref serialized);
partition.serialize(ref serialized);
let hash = poseidon_hash_span(serialized.span());
hash.into()
Expand Down
2 changes: 1 addition & 1 deletion crates/dojo-core/src/database/utils.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const OFFSET: felt252 = 0x10000000000000000000000000000000000;
// * `entities` is a list of lists of deserialized entities; each list of entities
// is of the same entity type in the order of IDs from `ids
//
// to illustrate, consider we have two entity types (components), Place and Owner
// to illustrate, consider we have two entity types (models), Place and Owner
// `ids` are [[4, 2, 3], [3, 4, 5]]
// `entities` are [[P4, P2, P3], [O3, O4, O5]]
// where P4 is a deserialized (i.e. a Span<felt252>) Place entity with ID 4,
Expand Down
8 changes: 4 additions & 4 deletions crates/dojo-core/src/test_utils.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn deploy_with_world_address(class_hash: felt252, world: IWorldDispatcher) -> Co
deploy_contract(class_hash, array![world.contract_address.into()].span())
}

fn spawn_test_world(components: Array<felt252>) -> IWorldDispatcher {
fn spawn_test_world(models: Array<felt252>) -> IWorldDispatcher {
// deploy executor
let constructor_calldata = array::ArrayTrait::new();
let (executor_address, _) = deploy_syscall(
Expand All @@ -57,13 +57,13 @@ fn spawn_test_world(components: Array<felt252>) -> IWorldDispatcher {
.unwrap();
let world = IWorldDispatcher { contract_address: world_address };

// register components
// register models
let mut index = 0;
loop {
if index == components.len() {
if index == models.len() {
break ();
}
world.register_component((*components[index]).try_into().unwrap());
world.register_model((*models[index]).try_into().unwrap());
index += 1;
};

Expand Down
Loading

0 comments on commit ff040b0

Please sign in to comment.