Mercurial > wow > reaction
comparison classes/Button.lua @ 123:943eed2c7def
Fixes for new ActionButton implementation
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Mon, 23 Feb 2009 19:41:11 +0000 |
parents | a2d2f23137c8 |
children | 0c5017f6062d |
comparison
equal
deleted
inserted
replaced
122:a2d2f23137c8 | 123:943eed2c7def |
---|---|
109 local poolID = self.actionPoolID | 109 local poolID = self.actionPoolID |
110 local maxID = self.actionMaxID | 110 local maxID = self.actionMaxID |
111 if not poolID or not maxID then | 111 if not poolID or not maxID then |
112 error("AcquireActionID: must setup pool first with SetActionIDPool") | 112 error("AcquireActionID: must setup pool first with SetActionIDPool") |
113 end | 113 end |
114 local pool = pools[poolID] | 114 local pool = idPools[poolID] |
115 if not pool then | 115 if not pool then |
116 pool = { nWraps = 0, useCount = { } } | 116 pool = { nWraps = 0, useCount = { } } |
117 for i = 1, maxID do | 117 for i = 1, maxID do |
118 pool.useCount[i] = 0 | 118 pool.useCount[i] = 0 |
119 end | 119 end |
120 pools[poolID] = pool | 120 idPools[poolID] = pool |
121 end | 121 end |
122 local useCount = pool.useCount | 122 local useCount = pool.useCount |
123 if id == nil then | 123 if id == nil then |
124 repeat | 124 repeat |
125 local nWraps = pool.nWraps | 125 local nWraps = pool.nWraps |
157 function Button:ReleaseActionID( id ) | 157 function Button:ReleaseActionID( id ) |
158 local poolID = self.actionPoolID | 158 local poolID = self.actionPoolID |
159 if not poolID then | 159 if not poolID then |
160 error("ReleaseActionID: must setup pool first with SetActionIDPool") | 160 error("ReleaseActionID: must setup pool first with SetActionIDPool") |
161 end | 161 end |
162 local pool = pools[poolID] | 162 local pool = idPools[poolID] |
163 if pool and id and pool.useCount[id] then | 163 if pool and id and pool.useCount[id] then |
164 pool.useCount[id] = pool.useCount[id] - 1 | 164 pool.useCount[id] = pool.useCount[id] - 1 |
165 pool.nWraps = min(pool.useCount[id], pool.nWraps) | 165 pool.nWraps = min(pool.useCount[id], pool.nWraps) |
166 end | 166 end |
167 end | 167 end |