2022-01-14 20:34:48 +01:00
|
|
|
#ifndef INCLUDE_EVENTS_H
|
|
|
|
#define INCLUDE_EVENTS_H
|
|
|
|
#print "[include <collection.h>]\n"
|
2018-11-01 22:48:33 +01:00
|
|
|
|
2022-01-14 20:34:48 +01:00
|
|
|
#include "../lib/collection.h"
|
2018-11-01 22:48:33 +01:00
|
|
|
|
|
|
|
#define ECTRL 300
|
|
|
|
|
|
|
|
struct EVENTS
|
|
|
|
{
|
2022-01-14 20:34:48 +01:00
|
|
|
collection_int array;
|
2018-11-01 22:48:33 +01:00
|
|
|
int new_id;
|
|
|
|
void init();
|
|
|
|
int add();
|
|
|
|
int add_n();
|
|
|
|
bool press();
|
|
|
|
};
|
|
|
|
|
|
|
|
void EVENTS::init(dword size)
|
|
|
|
{
|
2022-01-14 20:34:48 +01:00
|
|
|
array.drop();
|
2018-11-01 22:48:33 +01:00
|
|
|
new_id = 900;
|
|
|
|
}
|
|
|
|
|
|
|
|
int EVENTS::add(dword event1)
|
|
|
|
{
|
|
|
|
new_id++;
|
|
|
|
array.set(new_id, event1);
|
|
|
|
return new_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
int EVENTS::add_n(dword id, event2)
|
|
|
|
{
|
|
|
|
array.set(id, event2);
|
|
|
|
return new_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EVENTS::press(dword id)
|
|
|
|
{
|
|
|
|
dword event3;
|
|
|
|
if (array.get(id)) {
|
|
|
|
event3 = array.get(id);
|
|
|
|
event3();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2022-01-14 20:34:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|