• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

One Indexing Variables, Two Periodics

Status
Not open for further replies.
Level 13
Joined
Mar 29, 2012
Messages
542
So I wrote 2 indexing functions and 2 periodic functions.
Inside those functions, I only use one Next, Prev, etc variables.

Problem is, when those functions are running together I think there's a conflict between those 2 periodics.

JASS:
    if udg_STool_Recyclable == 0 then
        set udg_STool_MaxIndex = udg_STool_MaxIndex + 1
        set index = udg_STool_MaxIndex
    else
        set udg_STool_Recyclable = udg_STool_Recyclable - 1
        set index = udg_STool_Recycle[udg_STool_Recyclable]
    endif
    set udg_STool_Next[index] = 0
    set udg_STool_Next[udg_STool_Prev[0]] = index
    set udg_STool_Prev[index] = udg_STool_Prev[0]
    set udg_STool_Prev[0] = index

JASS:
    local integer index = 0
    loop
        set index = udg_STool_Next[index]
        exitwhen index == 0
        // actions
    endloop
 
Status
Not open for further replies.
Top