Мой очередной вопрос. Насколько всем известно, Blizzard.j содержит функции, которые не нужны тем, кто может для своего кода использовать native'ки. Также в файле создаются переменные в виде групп, таймеров и прочего, что необходимо для GUI, но для кодера не нужно. Была идея провести чистку по данным переменным не в ущерб самому игровому процессу (то есть не удаляя звуки в разные времена суток).
    if DESTROY_BJ == true{
    
        PauseTimer(bj_volumeGroupsTimer)
        DestroyTimer(bj_volumeGroupsTimer)
        bj_volumeGroupsTimer = null
        
        PauseTimer(bj_queuedExecTimeoutTimer)
        DestroyTimer(bj_queuedExecTimeoutTimer)
        bj_queuedExecTimeoutTimer = null
        
        GroupClear(bj_suspendDecayFleshGroup)
        DestroyGroup(bj_suspendDecayFleshGroup)
        bj_suspendDecayFleshGroup = null
        
        GroupClear(bj_suspendDecayBoneGroup)
        DestroyGroup(bj_suspendDecayBoneGroup)
        bj_suspendDecayBoneGroup = null
        
        PauseTimer(bj_delayedSuspendDecayTimer)
        DestroyTimer(bj_delayedSuspendDecayTimer)
        bj_delayedSuspendDecayTimer = null
        
        GroupClear(bj_lastCreatedGroup)
        DestroyGroup(bj_lastCreatedGroup)
        bj_lastCreatedGroup = null
        
        PauseTimer(bj_lastStartedTimer)
        DestroyTimer(bj_lastStartedTimer)
        bj_lastStartedTimer = null
        
        GroupClear(bj_suspendDecayBoneGroup)
        DestroyGroup(bj_suspendDecayBoneGroup)
        bj_suspendDecayBoneGroup = null
        
        GroupClear(bj_suspendDecayFleshGroup)
        DestroyGroup(bj_suspendDecayFleshGroup)
        bj_suspendDecayFleshGroup = null
        
        TriggerClearConditions(bj_delayedSuspendDecayTrig)
        TriggerClearActions(bj_delayedSuspendDecayTrig)
        DestroyTrigger(bj_delayedSuspendDecayTrig)
        bj_delayedSuspendDecayTrig = null
        
        DestroyBoolExpr(filterEnumDestructablesInCircleBJ)
        filterEnumDestructablesInCircleBJ = null
        
        DestroyBoolExpr(filterEnumDestructablesInCircleBJ)
        filterEnumDestructablesInCircleBJ = null
        
        DestroyBoolExpr(filterGetUnitsInRectOfPlayer)
        filterGetUnitsInRectOfPlayer = null
        
        DestroyBoolExpr(filterGetUnitsOfTypeIdAll)
        filterGetUnitsOfTypeIdAll = null
        
        DestroyBoolExpr(filterGetUnitsOfPlayerAndTypeId)
        filterGetUnitsOfPlayerAndTypeId = null
        
        DestroyBoolExpr(filterMeleeTrainedUnitIsHeroBJ)
        filterMeleeTrainedUnitIsHeroBJ = null
        
        DestroyBoolExpr(filterLivingPlayerUnitsOfTypeId)
        filterLivingPlayerUnitsOfTypeId = null
        
        TriggerClearConditions(bj_queuedExecTimeout)
        TriggerClearActions(bj_queuedExecTimeout)
        bj_queuedExecTimeout = null
        
        TriggerClearConditions(bj_rescueUnitBehavior)
        TriggerClearActions(bj_rescueUnitBehavior)
        bj_rescueUnitBehavior = null
        
        RemoveRect(bj_mapInitialPlayableArea)
        bj_mapInitialPlayableArea = null
        
        RemoveRect(bj_mapInitialCameraBounds)
        bj_mapInitialCameraBounds = null
        
        PauseTimer(bj_stockUpdateTimer)
        DestroyTimer(bj_stockUpdateTimer)
        bj_stockUpdateTimer = null
        
        TriggerClearConditions(bj_stockItemPurchased)
        TriggerClearActions(bj_stockItemPurchased)
        DestroyTrigger(bj_stockItemPurchased)
        bj_stockItemPurchased = null
        
        PauseTimer(bj_gameStartedTimer)
        DestroyTimer(bj_gameStartedTimer)
        bj_gameStartedTimer = null
        
    }
Такой вот код своеобразной оптимизации. Вопрос: все ли делается правильно? Удаляется ли все, что абсолютно не нужно и удаляется ли лишнее?
P.S. Да, я знаю про уничтожение областей, но я ими больше нигде не пользуюсь, так как переменные для блокировки выхода за пределы карты рассчитываются еще во время существования данных глобалок.

Принятый ответ

Друга зачем? Нинада, так толку не будет...
Просто используешь Inject main (vjass) или Define (Cjass) чтобы убрать 1 только строчку из main
//***************************************************************************
//*
//*  Map Configuration
//*
//***************************************************************************

//***************************************************************************
//*
//*  Main Initialization
//*
//***************************************************************************

//===========================================================================
function main takes nothing returns nothing
    call SetCameraBounds(- 3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), - 3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), - 3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), - 3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM))
    call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
    call NewSoundEnvironment("Default")
    call SetAmbientDaySound("SunkenRuinsDay")
    call SetAmbientNightSound("SunkenRuinsNight")
    call SetMapMusic("Music", true, 0)
    call InitBlizzard() // вот и все, удалим и не будет бж объектов.


    call InitGlobals()
    call InitCustomTriggers()
    call RunInitializationTriggers()

endfunction
Совсем забыл, функция main генерируется при сохранении карты в редакторе
Без cjass или vjass придется выколупывать war3map.j (код карты) файл из карты и править ручками в блокнотике, геморойно до безобразия, за то ненужен c\vjass и его знания.
`
ОЖИДАНИЕ РЕКЛАМЫ...
2
32
8 лет назад
2
Друга зачем? Нинада, так толку не будет...
Просто используешь Inject main (vjass) или Define (Cjass) чтобы убрать 1 только строчку из main
//***************************************************************************
//*
//*  Map Configuration
//*
//***************************************************************************

//***************************************************************************
//*
//*  Main Initialization
//*
//***************************************************************************

//===========================================================================
function main takes nothing returns nothing
    call SetCameraBounds(- 3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), - 3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), - 3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), - 3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM))
    call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
    call NewSoundEnvironment("Default")
    call SetAmbientDaySound("SunkenRuinsDay")
    call SetAmbientNightSound("SunkenRuinsNight")
    call SetMapMusic("Music", true, 0)
    call InitBlizzard() // вот и все, удалим и не будет бж объектов.


    call InitGlobals()
    call InitCustomTriggers()
    call RunInitializationTriggers()

endfunction
Совсем забыл, функция main генерируется при сохранении карты в редакторе
Без cjass или vjass придется выколупывать war3map.j (код карты) файл из карты и править ручками в блокнотике, геморойно до безобразия, за то ненужен c\vjass и его знания.
Принятый ответ
1
13
8 лет назад
Отредактирован Пушистый
1
quq_CCCP, это хорошо. Забыл однако про такой метод. Еще удалял единичные глобалки, вроде этих, так как они создаются сразу при их создании, а именно в блоке globals-endglobals. Спасибо большое)
Загруженные файлы
0
28
8 лет назад
0
Пушистый, имхо ненужный труд
если карта лагает то скорее всего из за другого
Чтобы оставить комментарий, пожалуйста, войдите на сайт.