Skip to content

Commit

Permalink
some fixed and replay record downloader work
Browse files Browse the repository at this point in the history
  • Loading branch information
Robosturm committed Dec 13, 2023
1 parent c23d203 commit bad26c2
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,8 @@ set(${PROJECT_NAME}_SRCS
network/networkgame.cpp network/networkgame.h
network/matchmakingcoordinator.h network/matchmakingcoordinator.cpp
network/mapfileserver.h network/mapfileserver.cpp
network/replayrecordfileserver.h network/replayrecordfileserver.cpp
network/replayrecordfileserver.h network/replayrecordfileserver.cpp
network/filepeer.h network/filepeer.cpp
network/JsonKeys.h

# game
Expand Down
1 change: 1 addition & 0 deletions general.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -2069,5 +2069,6 @@
<file>templates/serverscript/matchMaking/automatchmaker.json</file>
<file>resources/scripts/building/field_base.js</file>
<file>resources/scripts/actions/ACTION_FOCUSMAP.js</file>
<file>maps/2_player/Where Giants Have Fallen.map</file>
</qresource>
</RCC>
Binary file added maps/2_player/Where Giants Have Fallen.map
Binary file not shown.
1 change: 0 additions & 1 deletion mapsupport/refactorMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,6 @@ void GameMap::rotateY90()
Mainapp::getInstance()->continueRendering();
}


void GameMap::flipY()
{
Mainapp::getInstance()->pauseRendering();
Expand Down
5 changes: 3 additions & 2 deletions menue/editormenue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ EditorMenue::EditorMenue()
m_Topbar->addItem(tr("Export AWDS Aws"), "EXPORTAWDSAWS", 3, tr("Exports the map to an AWS Map Editor file"));
m_Topbar->addItem(tr("Import AW4 Aw4"), "IMPORTAW4AW4", 3, tr("Deletes the current map and imports an AW 4 map editor file."));
m_Topbar->addItem(tr("Import AW by Web"), "IMPORTAWBYWEB", 3, tr("Deletes the current map and imports an Advance Wars by Web Map from https://awbw.amarriner.com/"));
m_Topbar->finishCreation();
addChild(m_Topbar);

ObjectManager* pObjectManager = ObjectManager::getInstance();
oxygine::ResAnim* pAnim = pObjectManager->getResAnim("panel");
Expand Down Expand Up @@ -191,6 +189,9 @@ EditorMenue::EditorMenue()
}
});

m_Topbar->finishCreation();
addChild(m_Topbar);

// connecting stuff
connect(this, &EditorMenue::sigLeftClick, this, &EditorMenue::onMapClickedLeft, Qt::QueuedConnection);
connect(this, &EditorMenue::sigLeftClickDown, this, &EditorMenue::onMapClickedLeftDown, Qt::QueuedConnection);
Expand Down
22 changes: 22 additions & 0 deletions network/filepeer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "network/filepeer.h"

FilePeer::FilePeer(MainServer* pOwner, const QString & filePath, qint64 socketId)
: m_pOwner{pOwner},
m_file{filePath},
m_connectSocket{socketId}
{
}


void FilePeer::startUpload()
{
m_file.open(QIODevice::ReadOnly);

}

void FilePeer::startDownload()
{
m_file.remove();
m_file.open(QIODevice::WriteOnly);

}
26 changes: 26 additions & 0 deletions network/filepeer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

#include <QObject>
#include <QFile>
class MainServer;

class FilePeer : public QObject
{
Q_OBJECT
public:
explicit FilePeer(MainServer* pOwner, const QString & filePath, qint64 socketId);

void startUpload();
void startDownload();
signals:

public slots:
//void onRequestNextData();

private:
MainServer* m_pOwner;
QFile m_file;
QDataStream m_fileStream{&m_file};
qint64 m_connectSocket;
};

4 changes: 2 additions & 2 deletions network/mainserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void MainServer::startDatabase()
SQL_MAPWIDTH + " INTEGER, " +
SQL_MAPHEIGHT + " INTEGER, " +
SQL_MAPFLAGS + " BIGINT," +
SQL_MAPAUTHOR + " TEXT, " +
SQL_MAPAUTHOR + " TEXT" +
+ ")");
if (sqlQueryFailed(query))
{
Expand Down Expand Up @@ -262,7 +262,7 @@ bool MainServer::sqlQueryFailed(const QSqlQuery &query)
bool failed = !query.isActive() && type != QSqlError::NoError;
if (failed)
{
CONSOLE_PRINT("Sql query failed with " + error.text(), GameConsole::eERROR);
CONSOLE_PRINT("Sql query failed with " + error.text() + " Query: " + query.lastQuery(), GameConsole::eERROR);
}
return failed;
}
Expand Down
5 changes: 2 additions & 3 deletions network/replayrecordfileserver.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "replayrecordfileserver.h"
#include "network/replayrecordfileserver.h"

ReplayRecordFileserver::ReplayRecordFileserver(QObject *parent)
: QObject{parent}
ReplayRecordFileserver::ReplayRecordFileserver()
{

}
2 changes: 1 addition & 1 deletion network/replayrecordfileserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ReplayRecordFileserver : public QObject
{
Q_OBJECT
public:
explicit ReplayRecordFileserver(QObject *parent = nullptr);
explicit ReplayRecordFileserver();

signals:

Expand Down
2 changes: 1 addition & 1 deletion resources/scripts/units/cruiser.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var Constructor = function()

this.getDescription = function()
{
return qsTr("<r>Naval Unit. Strong against air units and submarines. </r><div c='#00ff00'>Transports X 2</div><r> Helis.</r>");
return qsTr("<r>Naval Unit. Strong against air units and submarines. </r><div c='#00ff00'>Transports X 2</div><r> Helis. Cruisers can get remove mines and take no damge from them.</r>");
};

this.getUnitType = function()
Expand Down

0 comments on commit bad26c2

Please sign in to comment.