Crossfire Server, Trunk  R20513
CRERegionPanel.cpp
Go to the documentation of this file.
1 #include <QtGui>
2 
3 #include "CRERegionPanel.h"
4 
6 {
7  QGridLayout* layout = new QGridLayout(this);
8 
9  int line = 0;
10  layout->addWidget(new QLabel(tr("Short name:"), this), 0, 0);
11 
12  myShortName = new QLabel(this);
13  layout->addWidget(myShortName, line++, 1);
14 
15  layout->addWidget(new QLabel(tr("Long name:"), this), line, 0);
16 
17  myName = new QLabel(this);
18  layout->addWidget(myName, line++, 1);
19 
20  layout->addWidget(new QLabel(tr("Message:"), this), line, 0);
21  myMessage = new QLabel(this);
22  myMessage->setWordWrap(true);
23  layout->addWidget(myMessage, line++, 1);
24 
25  layout->addWidget(new QLabel(tr("Jail:"), this), line, 0);
26 
27  myJail = new QLabel(this);
28  myJailX = new QLabel(this);
29  myJailY = new QLabel(this);
30 
31  layout->addWidget(myJail, line++, 1);
32  layout->addWidget(myJailX, line++, 1);
33  layout->addWidget(myJailY, line++, 1);
34 }
35 
37 {
38 }
39 
41 {
42  myShortName->setText(region->name);
43  myName->setText(get_region_longname(region));
44  myMessage->setText(get_region_msg(region));
45 
46  while (region && region->jailmap == NULL)
47  region = region->parent;
48 
49  if (region)
50  {
51  myJail->setText(region->jailmap);
52  myJailX->setText(QString::number(region->jailx));
53  myJailY->setText(QString::number(region->jaily));
54  }
55  else
56  {
57  myJail->setText("?");
58  myJailX->setText("?");
59  myJailY->setText("?");
60  }
61 }
int16_t jaily
The coodinates in jailmap to which the player should be sent.
Definition: map.h:298
const char * get_region_longname(const region *r)
Gets the longname of a region.
Definition: region.c:217
char * name
Shortend name of the region as maps refer to it.
Definition: map.h:278
QLabel * myMessage
This is a game region.
Definition: map.h:276
struct regiondef * parent
Pointer to the region that is a parent of the current region, if a value isn&#39;t defined in the current...
Definition: map.h:286
QLabel * myJailY
virtual ~CRERegionPanel()
int16_t jailx
Definition: map.h:298
QLabel * myShortName
QLabel * myJailX
char * jailmap
Where a player that is arrested in this region should be imprisoned.
Definition: map.h:297
virtual void setItem(regiondef *region)
const char * get_region_msg(const region *r)
Gets a message for a region.
Definition: region.c:238
Definition: main.c:88