jk2pach Invité
|
Posté le: 18/03/10 19:24 Sujet du message: Library: PowerupSentinel |
|
|
Jass: | //! zinc
/*
* PowerupSentinel
* ------------
* Placing this library in your map will automatically fix all rune/tome
* memory leaks in your map.
*
* Powerup items don't get removed automatically by the game, they instead
* just leave a small item in the map, this caused memory leaks but - worse -
* it also makes areas of your map where a lot of tomes have been used lag a lot.
*
*/
library PowerupSentinel
{
timer tic;
item queue[];
integer qn=0;
function onInit40;41;123;
trigger t = CreateTrigger40;41;;
tic = CreateTimer40;41;;
TriggerRegisterAnyUnitEventBJ40;t, EVENT_PLAYER_UNIT_PICKUP_ITEM41;;
TriggerAddCondition40;t, function40;41;->boolean 123;
queue91;qn93; = GetManipulatedItem40;41;;
qn = qn + 1;
TimerStart40;tic, 0.0, false, function40;41; 123;
integer i=0;
for40; 0 <= i < qn 41; 123;
if 40;GetWidgetLife40;queue91;i93;41;<0.40541; 123;
RemoveItem40;queue91;i93;41;;
125;
queue91;i93;=null;
125;
qn = 0;
125;41;;
return false;
125;41;;
125;
125;
//! endzinc |
_________________
|
|