• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

does SubStringBJ get inlined?

Status
Not open for further replies.
Level 7
Joined
Jan 30, 2011
Messages
267
is the method SubStringBJ inlined by SubString?
i read the jass helper documentation but i still don't know the answer
this is the excerpt:

How to make a function inlineable? The current algorithm basically follows these rules (which are subject to change to allow more functions to be considered inlineable in the future):

1. The function is a one-liner
2. If the function is called by call the function's contents must begin with set or call or be a return of a single function.
3. If the inlined function is an assigment (set) it should not assign one of its arguments.
4. Every argument must be evaluated once and only once by the function, in the same order as they appear in the arguments list.
5. If the function contains function calls, they should all be evaluated after the arguments UNLESS the function is marked as non-state changing, at the moment some very few native functions and also return bug exploiters are considered as non-state changing.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
No it does not. I believe none of the BJs get inlined but there are some that are ok to use because they do the same thing even if they get inlined. Example: TriggerRegisterAnyUnitEventBJ
It does not get inlined but it does the same thing as looping through each player and registering it manually.

Also substringBJ() uses math in the thing to reduce the numbers you put in so it is slower than substring()
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Long Answer:

JASS:
globals
    // Generated
trigger gg_trg_Init= null


//JASSHelper struct globals:

endglobals


//===========================================================================
// 
// Just another Warcraft III map
// 
//   Warcraft III map script
//   Generated by the Warcraft III World Editor
//   Date: Sun Sep 08 02:13:12 2013
//   Map Author: Unknown
// 
//===========================================================================

//***************************************************************************
//*
//*  Global Variables
//*
//***************************************************************************


function InitGlobals takes nothing returns nothing
endfunction

//***************************************************************************
//*
//*  Triggers
//*
//***************************************************************************

//===========================================================================
// Trigger: Init
//
// Default melee game initialization for all players
//===========================================================================
//TESH.scrollpos=0
//TESH.alwaysfold=0
//===========================================================================
function InitTrig_Init takes nothing returns nothing
    local unit c=CreateUnit(Player(0), 'hfoo', 0, 0, 0)
    local string str=SubStringBJ("Halo Everynyan!", 0, 0)
    call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 8.00)
    set c=null
    call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 0, str)
endfunction

//===========================================================================
function InitCustomTriggers takes nothing returns nothing
    call InitTrig_Init()
endfunction

//===========================================================================
function RunInitializationTriggers takes nothing returns nothing
    call ConditionalTriggerExecute(gg_trg_Init)
endfunction

//***************************************************************************
//*
//*  Players
//*
//***************************************************************************

function InitCustomPlayerSlots takes nothing returns nothing

    // Player 0
    call SetPlayerStartLocation(Player(0), 0)
    call SetPlayerColor(Player(0), ConvertPlayerColor(0))
    call SetPlayerRacePreference(Player(0), RACE_PREF_HUMAN)
    call SetPlayerRaceSelectable(Player(0), true)
    call SetPlayerController(Player(0), MAP_CONTROL_USER)

endfunction

function InitCustomTeams takes nothing returns nothing
    // Force: TRIGSTR_002
    call SetPlayerTeam(Player(0), 0)

endfunction

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

//===========================================================================
function main takes nothing returns nothing
    call SetCameraBounds(- 1280.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), - 1536.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 1280.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 1024.0 - GetCameraMargin(CAMERA_MARGIN_TOP), - 1280.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 1024.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 1280.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), - 1536.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM))
    call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
    call NewSoundEnvironment("Default")
    call SetAmbientDaySound("LordaeronSummerDay")
    call SetAmbientNightSound("LordaeronSummerNight")
    call SetMapMusic("Music", true, 0)
    call InitBlizzard()


    call InitGlobals()
    call InitTrig_Init() // INLINED!!
    call ConditionalTriggerExecute(gg_trg_Init) // INLINED!!

endfunction

//***************************************************************************
//*
//*  Map Configuration
//*
//***************************************************************************

function config takes nothing returns nothing
    call SetMapName("Just another Warcraft III map")
    call SetMapDescription("Nondescript")
    call SetPlayers(1)
    call SetTeams(1)
    call SetGamePlacement(MAP_PLACEMENT_USE_MAP_SETTINGS)

    call DefineStartLocation(0, 0.0, - 256.0)

    // Player setup
    call InitCustomPlayerSlots()
    call SetPlayerSlotAvailable(Player(0), MAP_CONTROL_USER)
    call InitGenericPlayerSlots()
endfunction




//Struct method generated initializers/callers:


Short Answer: No
 
Status
Not open for further replies.
Top