static void UpdateFences(TileIndex tile) { assert(IsTileType(tile, MP_CLEAR) && IsClearGround(tile, CLEAR_FIELDS)); bool dirty = false; bool neighbour = (IsTileType(TILE_ADDXY(tile, 1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 1, 0), CLEAR_FIELDS)); if (!neighbour && GetFence(tile, DIAGDIR_SW) == 0) { SetFence(tile, DIAGDIR_SW, 3); dirty = true; } neighbour = (IsTileType(TILE_ADDXY(tile, 0, 1), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 0, 1), CLEAR_FIELDS)); if (!neighbour && GetFence(tile, DIAGDIR_SE) == 0) { SetFence(tile, DIAGDIR_SE, 3); dirty = true; } neighbour = (IsTileType(TILE_ADDXY(tile, -1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, -1, 0), CLEAR_FIELDS)); if (!neighbour && GetFence(tile, DIAGDIR_NE) == 0) { SetFence(tile, DIAGDIR_NE, 3); dirty = true; } neighbour = (IsTileType(TILE_ADDXY(tile, 0, -1), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 0, -1), CLEAR_FIELDS)); if (!neighbour && GetFence(tile, DIAGDIR_NW) == 0) { SetFence(tile, DIAGDIR_NW, 3); dirty = true; } if (dirty) MarkTileDirtyByTile(tile); }
// Execute CommandBuffer void DeviceVulkanw::CommitCommandBuffer( bool in_wait_till_completed ) { const auto fence = GetFence( m_cpu_fence_id ); m_is_command_buffer_recording = false; m_command_buffer->stop_recording(); GetQueue()->submit_command_buffer( m_command_buffer.get(), in_wait_till_completed, fence ); }
// To start recording Vulkan commands to the CommandBuffer void DeviceVulkanw::StartRecording() { Assert( false == m_is_command_buffer_recording ); AllocNextFenceId(); const auto fence = GetFence( m_cpu_fence_id ); fence->reset(); m_is_command_buffer_recording = true; m_command_buffer->reset( false ); m_command_buffer->start_recording( true, false ); }
// ------------------------------------------------------------------------------------------------------------------------------------- // Init Method 초기화 // VOID CSHFarm::Init() { SetOwnState(CSHFarmObj::OWN_STATE_EMPTY); SetOwner(0); SetGrade(0); GetGarden(0)->SetGrade(0); GetHouse(0)->SetGrade(0); GetWarehouse(0)->SetGrade(0); GetAnimalCage(0)->SetGrade(0); GetFence(0)->SetGrade(0); SetTaxArrearageFreq(0); SetTaxPayPlayerName(0); }
static void DrawClearLandFence(const TileInfo *ti) { /* combine fences into one sprite object */ StartSpriteCombine(); int maxz = GetSlopeMaxPixelZ(ti->tileh); uint fence_nw = GetFence(ti->tile, DIAGDIR_NW); if (fence_nw != 0) { int z = GetSlopePixelZInCorner(ti->tileh, CORNER_W); SpriteID sprite = _clear_land_fence_sprites[fence_nw - 1] + _fence_mod_by_tileh_nw[ti->tileh]; AddSortableSpriteToDraw(sprite, PAL_NONE, ti->x, ti->y - 15, 16, 31, maxz - z + 4, ti->z + z, false, 0, 15, -z); } uint fence_ne = GetFence(ti->tile, DIAGDIR_NE); if (fence_ne != 0) { int z = GetSlopePixelZInCorner(ti->tileh, CORNER_E); SpriteID sprite = _clear_land_fence_sprites[fence_ne - 1] + _fence_mod_by_tileh_ne[ti->tileh]; AddSortableSpriteToDraw(sprite, PAL_NONE, ti->x - 15, ti->y, 31, 16, maxz - z + 4, ti->z + z, false, 15, 0, -z); } uint fence_sw = GetFence(ti->tile, DIAGDIR_SW); uint fence_se = GetFence(ti->tile, DIAGDIR_SE); if (fence_sw != 0 || fence_se != 0) { int z = GetSlopePixelZInCorner(ti->tileh, CORNER_S); if (fence_sw != 0) { SpriteID sprite = _clear_land_fence_sprites[fence_sw - 1] + _fence_mod_by_tileh_sw[ti->tileh]; AddSortableSpriteToDraw(sprite, PAL_NONE, ti->x, ti->y, 16, 16, maxz - z + 4, ti->z + z, false, 0, 0, -z); } if (fence_se != 0) { SpriteID sprite = _clear_land_fence_sprites[fence_se - 1] + _fence_mod_by_tileh_se[ti->tileh]; AddSortableSpriteToDraw(sprite, PAL_NONE, ti->x, ti->y, 16, 16, maxz - z + 4, ti->z + z, false, 0, 0, -z); } } EndSpriteCombine(); }
void DeviceVulkanw::WaitForFence( uint64_t id ) const { AssertEx( id < m_gpu_known_fence_id + NUM_FENCE_TRACKERS, "CPU too far ahead of GPU" ); while(HasFenceBeenPassed(id) == false ) { vkWaitForFences(m_anvil_device->get_device_vk(), 1, GetFence(m_gpu_known_fence_id)->get_fence_ptr(), VK_TRUE, UINT64_MAX); // don't known id update until wait has finished m_gpu_known_fence_id++; } }
// ------------------------------------------------------------------------------------------------------------------------------------- // CreateFence Method 하위 구성물 생성 // VOID CSHFarm::CreateFence(int nFenceNum) { for(int i = 0; i < nFenceNum; ++i ) { CSHFarmObj* farmObject = GetFence( i ); if( 0 == farmObject ) { farmObject = new CSHFarmObj; m_pcsFence.Add( farmObject, i ); } farmObject->SetID((WORD)i); farmObject->SetParent(this); AddChild( farmObject, FARM_EVENT_FENCE ); } }