Raised This Month: $52 Target: $400
 13% 

[INC] Queue - FIFO


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JoinedSenses
Senior Member
Join Date: Sep 2013
Old 11-04-2019 , 00:04   [INC] Queue - FIFO
Reply With Quote #1

Based on some discussion via SM discord, I created a queue methodmap which inherits from Handle and utilizes arraylist methods. Unlike ArrayStack, this methodmap is First In, First Out.

Code can be found here:
queue.inc

Simple example usage:

Code:
#include <sourcemod>
#include <queue>

public void OnPluginStart() {
	RegAdminCmd("sm_test", cmdTest, ADMFLAG_ROOT);
}

public Action cmdTest(int client, int args) {
	Queue q = new Queue();

	for (int i = 1; i <= 10; i++) {
		q.Push(i);	
	}

	while (!q.Empty) {
		ReplyToCommand(client, "%i", q.Pop());
	}

	delete q;

	return Plugin_Handled;
}
__________________

Last edited by JoinedSenses; 11-04-2019 at 00:58.
JoinedSenses is offline
Bara
AlliedModders Donor
Join Date: Apr 2012
Location: Germany
Old 11-04-2019 , 14:13   Re: [INC] Queue - FIFO
Reply With Quote #2

Thanks, will be useful for some stuff.
__________________
Bara is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:21.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode