Crossfire Server, Trunk
RandomMapPanel.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #include <QtWidgets>
14 
15 #include "RandomMapPanel.h"
16 #include "RandomMap.h"
17 #include "CREMapInformation.h"
18 
20 {
21  myLayout->addWidget(new QLabel(tr("Source map:"), this), 0, 0);
22  myLayout->addWidget(mySource = new QLabel(this), 0, 1);
23  myLayout->addWidget(new QLabel(tr("Parameters:"), this), 1, 0, 1, 2);
24  myLayout->addWidget(myInformation = new QTextEdit(this), 2, 0, 1, 2);
25  myInformation->setReadOnly(true);
26 }
27 
29 {
31  char* text = stringbuffer_finish(sb);
32  myInformation->setText(text);
33  free(text);
34 
35  mySource->setText(QString("%1 [%2, %3]").arg(myItem->map()->displayName()).arg(myItem->x()).arg(myItem->y()));
36 }
RandomMap::parameters
const RMParms * parameters() const
Definition: RandomMap.cpp:39
RandomMap::y
int y() const
Definition: RandomMap.cpp:34
AssetWrapperPanel::myLayout
QGridLayout * myLayout
Definition: AssetWrapperPanel.h:56
CREMapInformation::displayName
virtual QString displayName() const override
Definition: CREMapInformation.cpp:47
RandomMap.h
RandomMap::map
const CREMapInformation * map() const
Definition: RandomMap.cpp:24
stringbuffer_finish
char * stringbuffer_finish(StringBuffer *sb)
Definition: stringbuffer.cpp:76
AssetSWrapperPanel< const RandomMap >::myItem
const RandomMap * myItem
Definition: AssetWrapperPanel.h:126
AssetSWrapperPanel
Definition: AssetWrapperPanel.h:113
CRERandomMapPanel::updateItem
virtual void updateItem() override
Definition: RandomMapPanel.cpp:28
CRERandomMapPanel::myInformation
QTextEdit * myInformation
Definition: RandomMapPanel.h:33
RandomMapPanel.h
StringBuffer
Definition: stringbuffer.cpp:25
RandomMap::x
int x() const
Definition: RandomMap.cpp:29
text
Crossfire Protocol most of the time after the actual code was already omit certain important and possibly make life miserable any new developer or curious player should be able to find most of the relevant information here If inconsistencies are found or this documentation proves to be consider the latest server side protocol code in the public source code repository as the authoritative reference Introduction If you were ever curious enough to telnet or netcat to a Crossfire chances are you were sorely disappointed While the protocol may seem to use plain text at it actually uses a mix of ASCII and binary data This handbook attempts to document various aspects of the Crossfire protocol As consult the README file to find out how to get in touch with helpful people via mailing and more History the communications plan was set to be a text based system It was up to the server and client to parse these messages and determine what to do These messages were assumed to be line per message At a reasonably early stage of Eric Anderson wrote a then the data itself you could send many data and after the other end could decode these commands This works fairly but I think the creation of numerous sub packets has some performance hit the eutl was not especially well so writing a client for a different platform became more Eric left to work on other products shortly after writing his which didn t really leave anyone with a full understanding of the socket code I have decided to remove the eutl dependency At least one advantage is that having this network related code directly in the client and server makes error handling a bit easier cleaner Packet Format the outside packet method the byte size for the size information is not included here Eutl originally used bytes for the size to bytes seems it makes a least some sense The actual data is something of the nature of the commands listed below It is a text followed by possible other data The remaining data can be binary it is up to the client and server to decode what it sent The commands as described below is just the data portion of the packet If writing a new remember that you must take into account the size of the packet There is no termination of other than knowing how long it should be For most everything that is sent is text This is more or less how things worked under except it packed the ints into bytes in a known order In some we handle ints as in they are sent as binary information How any command handles it is detailed below in the command description The S and C represent the direction of the we use MSB as well as any ints or shorts that get sent inside the packets All packets are defined to have at least one word of text
Definition: protocol.txt:84
write_map_parameters_to_string
StringBuffer * write_map_parameters_to_string(const RMParms *RP)
Definition: random_map.cpp:749
CREMapInformation.h
CRERandomMapPanel::mySource
QLabel * mySource
Definition: RandomMapPanel.h:32
CRERandomMapPanel::CRERandomMapPanel
CRERandomMapPanel(QWidget *parent)
Definition: RandomMapPanel.cpp:19