2020-04-04 01:17:28 +02:00
|
|
|
struct LIST
|
|
|
|
{
|
|
|
|
int level;
|
2020-12-18 00:01:09 +01:00
|
|
|
char ordered[5];
|
2020-04-04 01:17:28 +02:00
|
|
|
int counter[5];
|
|
|
|
void reset();
|
|
|
|
void upd_level();
|
|
|
|
int inc_counter();
|
2020-12-18 00:01:09 +01:00
|
|
|
char order_type();
|
2020-04-04 01:17:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void LIST::reset()
|
|
|
|
{
|
|
|
|
level = 0;
|
|
|
|
}
|
|
|
|
|
2020-12-18 00:01:09 +01:00
|
|
|
void LIST::upd_level(int direction, char type)
|
2020-04-04 01:17:28 +02:00
|
|
|
{
|
|
|
|
if (direction == 1) && (level<5) {
|
|
|
|
level++;
|
2020-12-18 00:01:09 +01:00
|
|
|
counter[level] = 0;
|
|
|
|
ordered[level] = type;
|
2020-04-04 01:17:28 +02:00
|
|
|
}
|
|
|
|
if (direction == 0) && (level>0) {
|
|
|
|
level--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int LIST::inc_counter()
|
|
|
|
{
|
|
|
|
counter[level]++;
|
|
|
|
return counter[level];
|
|
|
|
}
|
|
|
|
|
2020-12-18 00:01:09 +01:00
|
|
|
char LIST::order_type()
|
2020-04-04 01:17:28 +02:00
|
|
|
{
|
|
|
|
return ordered[level];
|
|
|
|
}
|