summaryrefslogtreecommitdiffstats
path: root/src/server/util/global.h
blob: 4a713485c23d0d4b9e1def54815a07282c79d2d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * global.h
 *
 *  Created on: 29.01.2013
 *      Author: sr
 */

#ifndef GLOBAL_H_
#define GLOBAL_H_

#include <QString>
#include <QByteArray>
#include <QMap>
#include <QPair>
#include <QPoint>
#include <QSize>
#include <QList>

struct Room {
    Room(QMap<QString, QPoint> cPos, QSize grid, QSize client, QString image, QString tutor) :
        clientPositions(cPos),
        gridSize(grid),
        clientSize(client),
        imagePath(image),
        tutorIP(tutor){};
    QMap<QString, QPoint> clientPositions;
    QSize gridSize;
    QSize clientSize;
    QString imagePath;
    QString tutorIP;
};

class Global {
private:
	Global(){}
	~Global(){}

	static QString _sessionName;
	static QByteArray _sessionNameArray;
	static QMap<QString, Room*> _rooms;
	static QString _currentRoom;

public:
	static const QString& sessionName() { return Global::_sessionName; }
	static const QByteArray& sessionNameArray() { return Global::_sessionNameArray; }
	static void setSessionName(const QString& name);
	static void setSessionName();

    static bool manager_only;

	static void setRooms(const QMap<QString, Room*> & roomList);
	static const QMap<QString, Room*> & getRooms() {
		return _rooms;
	}

	static void setCurrentRoom(QString room);
	static const QString& getCurrentRoomName() { return _currentRoom; }

    /* returns a pointer to the current room or a pointer to the constant "defaultRoom".
     * (NEVER returns NULL or undefined) */
    static const Room* getCurrentRoom();
};


#endif /* GLOBAL_H_ */