mirror of
				https://github.com/Ukendio/jecs.git
				synced 2025-11-04 10:59:18 +00:00 
			
		
		
		
	Fix indentations
This commit is contained in:
		
							parent
							
								
									7d09aca97d
								
							
						
					
					
						commit
						c02a5d60ba
					
				
					 1 changed files with 5 additions and 24 deletions
				
			
		| 
						 | 
					@ -74,7 +74,7 @@ type EntityIndex = {
 | 
				
			||||||
	sparse_array: Map<i53, Record>,
 | 
						sparse_array: Map<i53, Record>,
 | 
				
			||||||
	sparse_count: number,
 | 
						sparse_count: number,
 | 
				
			||||||
	alive_count: number,
 | 
						alive_count: number,
 | 
				
			||||||
	max_id: number
 | 
						max_id: number,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local HI_COMPONENT_ID = _G.__JECS_HI_COMPONENT_ID or 256
 | 
					local HI_COMPONENT_ID = _G.__JECS_HI_COMPONENT_ID or 256
 | 
				
			||||||
| 
						 | 
					@ -172,9 +172,6 @@ local function ECS_PAIR(pred: i53, obj: i53): i53
 | 
				
			||||||
	return ECS_COMBINE(ECS_ENTITY_T_LO(obj), ECS_ENTITY_T_LO(pred)) + FLAGS_ADD(--[[isPair]] true) :: i53
 | 
						return ECS_COMBINE(ECS_ENTITY_T_LO(obj), ECS_ENTITY_T_LO(pred)) + FLAGS_ADD(--[[isPair]] true) :: i53
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local ERROR_ENTITY_NOT_ALIVE = "Entity is not alive"
 | 
					 | 
				
			||||||
local ERROR_GENERATION_INVALID = "INVALID GENERATION"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local function entity_index_try_get_any(entity_index: EntityIndex, entity: number): Record?
 | 
					local function entity_index_try_get_any(entity_index: EntityIndex, entity: number): Record?
 | 
				
			||||||
	local r = entity_index.sparse_array[ECS_ENTITY_T_LO(entity)]
 | 
						local r = entity_index.sparse_array[ECS_ENTITY_T_LO(entity)]
 | 
				
			||||||
	if not r then
 | 
						if not r then
 | 
				
			||||||
| 
						 | 
					@ -210,7 +207,6 @@ local function entity_index_get_alive(index: EntityIndex, e: i24): i53
 | 
				
			||||||
	error("Invalid entity")
 | 
						error("Invalid entity")
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
local function entity_index_is_alive(entity_index: EntityIndex, entity: number)
 | 
					local function entity_index_is_alive(entity_index: EntityIndex, entity: number)
 | 
				
			||||||
	return entity_index_try_get(entity_index, entity) ~= nil
 | 
						return entity_index_try_get(entity_index, entity) ~= nil
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					@ -226,8 +222,7 @@ local function entity_index_remove(entity_index: EntityIndex, entity: number)
 | 
				
			||||||
	entity_index.alive_count -= 1
 | 
						entity_index.alive_count -= 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	local last_alive_entity = dense_array[last_entity_alive_at_index]
 | 
						local last_alive_entity = dense_array[last_entity_alive_at_index]
 | 
				
			||||||
	local r_swap = entity_index_try_get_any(
 | 
						local r_swap = entity_index_try_get_any(entity_index, last_alive_entity) :: Record
 | 
				
			||||||
		entity_index, last_alive_entity) :: Record
 | 
					 | 
				
			||||||
	r_swap.dense = index_of_deleted_entity
 | 
						r_swap.dense = index_of_deleted_entity
 | 
				
			||||||
	r.archetype = nil :: any
 | 
						r.archetype = nil :: any
 | 
				
			||||||
	r.row = nil :: any
 | 
						r.row = nil :: any
 | 
				
			||||||
| 
						 | 
					@ -237,13 +232,6 @@ local function entity_index_remove(entity_index: EntityIndex, entity: number)
 | 
				
			||||||
	dense_array[last_entity_alive_at_index] = ECS_GENERATION_INC(entity)
 | 
						dense_array[last_entity_alive_at_index] = ECS_GENERATION_INC(entity)
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
local function record_create(entity_index: EntityIndex, id: number, count: number )
 | 
					 | 
				
			||||||
	entity_index.sparse_array[id] = { dense = count } :: Record
 | 
					 | 
				
			||||||
	entity_index.sparse_count += 1
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local function entity_index_new_id(entity_index: EntityIndex, data): i53
 | 
					local function entity_index_new_id(entity_index: EntityIndex, data): i53
 | 
				
			||||||
	local dense_array = entity_index.dense_array
 | 
						local dense_array = entity_index.dense_array
 | 
				
			||||||
	if entity_index.alive_count ~= #dense_array then
 | 
						if entity_index.alive_count ~= #dense_array then
 | 
				
			||||||
| 
						 | 
					@ -260,8 +248,6 @@ local function entity_index_new_id(entity_index: EntityIndex, data): i53
 | 
				
			||||||
		dense = entity_index.alive_count,
 | 
							dense = entity_index.alive_count,
 | 
				
			||||||
	} :: Record
 | 
						} :: Record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	entity_index.sparse_count += 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return id
 | 
						return id
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -421,7 +407,6 @@ local function world_get_one_inline(world: World, entity: i53, id: i53): any
 | 
				
			||||||
	return archetype.columns[tr.column][record.row]
 | 
						return archetype.columns[tr.column][record.row]
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
local function world_has_one_inline(world: World, entity: number, id: i53): boolean
 | 
					local function world_has_one_inline(world: World, entity: number, id: i53): boolean
 | 
				
			||||||
	local record = entity_index_try_get(world.entity_index, entity)
 | 
						local record = entity_index_try_get(world.entity_index, entity)
 | 
				
			||||||
	if not record then
 | 
						if not record then
 | 
				
			||||||
| 
						 | 
					@ -1039,7 +1024,6 @@ local function archetype_destroy(world: World, archetype: Archetype)
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
local function world_cleanup(world: World)
 | 
					local function world_cleanup(world: World)
 | 
				
			||||||
	local archetypes = world.archetypes
 | 
						local archetypes = world.archetypes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1150,13 +1134,10 @@ do
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local function world_contains(world: World, entity): boolean
 | 
					local function world_contains(world: World, entity): boolean
 | 
				
			||||||
	return entity_index_is_alive(world.entity_index, entity)
 | 
						return entity_index_is_alive(world.entity_index, entity)
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
local function NOOP() end
 | 
					local function NOOP() end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local function ARM(query, ...)
 | 
					local function ARM(query, ...)
 | 
				
			||||||
| 
						 | 
					@ -1912,5 +1893,5 @@ return {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	entity_index_try_get = entity_index_try_get,
 | 
						entity_index_try_get = entity_index_try_get,
 | 
				
			||||||
	entity_index_try_get_any = entity_index_try_get_any,
 | 
						entity_index_try_get_any = entity_index_try_get_any,
 | 
				
			||||||
	entity_index_is_alive = entity_index_is_alive
 | 
						entity_index_is_alive = entity_index_is_alive,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue