Skip to content

Commit

Permalink
Upgrade to qt5.12. Too many changes ...
Browse files Browse the repository at this point in the history
  • Loading branch information
GokuMK committed Oct 18, 2018
1 parent e88ce6f commit 403f0e6
Show file tree
Hide file tree
Showing 99 changed files with 241,195 additions and 157,897 deletions.
2 changes: 1 addition & 1 deletion ActLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ int ActLib::LoadAllAct(QString gameRoot){
return 0;
}

void ActLib::GetUnsavedInfo(std::vector<QString>& items){
void ActLib::GetUnsavedInfo(QVector<QString>& items){
Activity * e;
for (int i = 0; i < ActLib::jestact; i++){
e = ActLib::Act[i];
Expand Down
2 changes: 1 addition & 1 deletion ActLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ActLib {
static QVector<QString> GetServiceInUseList(QString n);
static int AddPath(QString path, QString name);
static int LoadAllAct(QString gameRoot);
static void GetUnsavedInfo(std::vector<QString> &items);
static void GetUnsavedInfo(QVector<QString> &items);
static void UpdateServiceChanges(QString serviceNameId);
static void SaveAll();
private:
Expand Down
1 change: 1 addition & 0 deletions ActivityObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "TRitem.h"
#include "Activity.h"
#include "TerrainLib.h"
#include <math.h>

ActivityObject::~ActivityObject() {
}
Expand Down
2 changes: 1 addition & 1 deletion ActivityTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ void ActivityTools::actPlayEnabled(){
}

void ActivityTools::actSaveEnabled(){
std::vector<QString> unsavedItems;
QVector<QString> unsavedItems;
ActLib::GetUnsavedInfo(unsavedItems);
if(unsavedItems.size() == 0){
qDebug() << "nic do zapisania";
Expand Down
14 changes: 7 additions & 7 deletions CELoadWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ CELoadWindow::CELoadWindow() {
vlist->addRow("Rolling Stock:", &trainsNumber);
info->setLayout(vlist);
mainLayout->addWidget(info);
/*nowa = new QWidget();
QHBoxLayout *vbox1 = new QHBoxLayout;
vbox1->addWidget(myLabel3);
vbox1->addWidget(nowaTrasa);
vbox1->setContentsMargins(0,0,0,0);
nowa->setLayout(vbox1);
mainLayout->addWidget(nowa);*/
//nowa = new QWidget();
//QHBoxLayout *vbox1 = new QHBoxLayout;
//vbox1->addWidget(myLabel3);
//vbox1->addWidget(nowaTrasa);
//vbox1->setContentsMargins(0,0,0,0);
//nowa->setLayout(vbox1);
//mainLayout->addWidget(nowa);

QWidget* box = new QWidget();
QHBoxLayout *vbox = new QHBoxLayout;
Expand Down
8 changes: 8 additions & 0 deletions Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "GLMatrix.h"
#include "Game.h"
#include "GeoCoordinates.h"
#include "GameObj.h"
#include "GLUU.h"

Camera::Camera(float* pt) {
pozT = pt;
Expand Down Expand Up @@ -91,6 +93,12 @@ float Camera::getRotY() {
void Camera::update(float fps) {
}

void Camera::renderHud(GLUU *gluu){

if(cameraObject != NULL)
cameraObject->renderHud();
}

void Camera::setCameraObject(GameObj* o){
cameraObject = o;
playerRot[0] = M_PI;
Expand Down
2 changes: 2 additions & 0 deletions Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

class PreciseTileCoordinate;
class GameObj;
class GLUU;

class Camera {
public:
Expand Down Expand Up @@ -51,6 +52,7 @@ class Camera {
virtual void keyDown(QKeyEvent * e);
virtual void keyUp(QKeyEvent * e);
virtual void update(float fps);
virtual void renderHud(GLUU *gluu);
virtual void setCameraObject(GameObj* o);
virtual PreciseTileCoordinate* getCurrentPos();
float * pozT;
Expand Down
1 change: 1 addition & 0 deletions ComplexLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "GLMatrix.h"
#include "Vector3f.h"
#include <QDebug>
#include <math.h>

ComplexLinePoint::ComplexLinePoint(){

Expand Down
5 changes: 3 additions & 2 deletions ConEditorWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

ConEditorWindow::ConEditorWindow() : QMainWindow() {
Game::shadowsEnabled = 0;
Game::fogDensity = 0;
Vec3::set((float*)Game::sunLightDirection,-1.0,0.0,0.0);
aboutWindow = new AboutWindow(this);
englib = new EngLib();
Expand Down Expand Up @@ -892,8 +893,8 @@ void ConEditorWindow::replaceAllAllEnabled(){

void ConEditorWindow::closeEvent( QCloseEvent *event )
{
std::vector<int> unsavedConIds;
std::vector<int> unsavedActIds;
QVector<int> unsavedConIds;
QVector<int> unsavedActIds;
con1->getUnsaed(unsavedConIds);
con1->getUnsaedAct(unsavedActIds);
if(unsavedConIds.size()+unsavedActIds.size() == 0){
Expand Down
4 changes: 2 additions & 2 deletions ConListWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ void ConListWidget::deleteCurrentCon(){
delete e;
}

void ConListWidget::getUnsaed(std::vector<int> &unsavedConIds){
void ConListWidget::getUnsaed(QVector<int> &unsavedConIds){
unsavedConIds.clear();
//Game::currentEngLib = englib;
Consist * e;
Expand All @@ -285,7 +285,7 @@ void ConListWidget::getUnsaed(std::vector<int> &unsavedConIds){
}
}

void ConListWidget::getUnsaedAct(std::vector<int>& unsavedActIds){
void ConListWidget::getUnsaedAct(QVector<int>& unsavedActIds){
unsavedActIds.clear();
//Game::currentEngLib = englib;
Activity * e;
Expand Down
4 changes: 2 additions & 2 deletions ConListWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class ConListWidget : public QWidget {
void fillConList(QString n);
void newConsist();
void newConsist(Consist * con);
void getUnsaed(std::vector<int> &unsavedConIds);
void getUnsaedAct(std::vector<int> &unsavedActIds);
void getUnsaed(QVector<int> &unsavedConIds);
void getUnsaedAct(QVector<int> &unsavedActIds);
void findConsistsByEng(int id);
bool isActivity();
int getCurrentActivityId();
Expand Down
22 changes: 18 additions & 4 deletions Consist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "TextObj.h"
#include "TDB.h"
#include "TerrainLib.h"
#include "SimpleHud.h"


std::unordered_map<int, TextObj*> Consist::txtNumbers;
Expand Down Expand Up @@ -363,14 +364,14 @@ void Consist::deteleSelected(){
void Consist::appendEngItem(int id, int pos, bool flip){
Eng * eng = Game::currentEngLib->eng[id];
if(eng == NULL) return;
std::vector<int>::iterator it;

EngItem* newE;
if(pos == 0){
engItems.emplace(engItems.begin());
engItems.insert(0, EngItem());
newE = &engItems[0];
selectedIdx++;
} else if(pos == 2){
engItems.emplace_back();
engItems.push_back(EngItem());
newE = &engItems[engItems.size()-1];
} else if(pos == 1){
if(selectedIdx > engItems.size() - 1 )
Expand All @@ -380,7 +381,7 @@ void Consist::appendEngItem(int id, int pos, bool flip){
if(selectedIdx < -1 )
selectedIdx = -1;
qDebug() << "selectedIdx "<< selectedIdx;
engItems.emplace(engItems.begin()+selectedIdx+1);
engItems.insert(selectedIdx+1, EngItem());
newE = &engItems[selectedIdx+1];
} else {
return;
Expand Down Expand Up @@ -722,6 +723,10 @@ void Consist::setTrainSpeed(float val){
float Consist::getTrainSpeed(){
return trainSpeed;
}

float Consist::getTrainDistanceTravelled(){
return trainTotalDistance;
}

void Consist::updateSim(float deltaTime){
if (loaded != 1)
Expand All @@ -738,6 +743,7 @@ void Consist::updateSim(float deltaTime){

trainSpeed = engItems[0].engPointer->getCurrentSpeed();
float deltaMove = trainSpeed*deltaTime;
trainTotalDistance = engItems[0].engPointer->getTotalDistanceDownPath();

for(int i = 0; i < engItems.size(); i++){
//engItems[i].engPointer->move(-55.5*deltaTime);
Expand All @@ -746,6 +752,14 @@ void Consist::updateSim(float deltaTime){

}

void Consist::renderHud(){
if(hud == NULL)
hud = new SimpleHud();
hud->setAttribute("speed", trainSpeed);
hud->setAttribute("dist", trainTotalDistance);
hud->render();
}

void Consist::getCameraPosition(float *out){
if (loaded != 1)
return;
Expand Down
7 changes: 6 additions & 1 deletion Consist.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class FileBuffer;
class QTextStream;
class GLUU;
class Activity;
class SimpleHud;

class Consist : public GameObj {
public:
Expand Down Expand Up @@ -69,7 +70,7 @@ class Consist : public GameObj {
int posInit = false;
int selectedIdx = -1;
float textColor[3];
std::vector<EngItem> engItems;
QVector<EngItem> engItems;
Consist(QString p, QString n);
Consist(QString src, QString p, QString n);
void load();
Expand Down Expand Up @@ -100,6 +101,7 @@ class Consist : public GameObj {
void initOnTrack(float *posTXZ, int direction, QMap<int, int> *junctionDirections = NULL);
bool getWagonWorldPosition(int id, float *posTW);
void updateSim(float deltaTime);
void renderHud();
void getCameraPosition(float *out);
void renderOnTrack(GLUU* gluu, float * playerT, int selectionColor);
void render(int selectionColor = 0, bool renderText = false);
Expand All @@ -110,13 +112,16 @@ class Consist : public GameObj {
QString getFirstEngName();
void setTrainSpeed(float val);
float getTrainSpeed();
float getTrainDistanceTravelled();

private:
bool newConsist = false;
bool modified = false;
bool defaultValue = false;
bool maxVelocityFixed = false;
float trainSpeed = 0.0;
float trainTotalDistance = 0.0;
SimpleHud *hud = NULL;

void replaceEngItem(int id, int pos);
};
Expand Down
13 changes: 7 additions & 6 deletions Coords.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <unordered_map>
#include <QMap>
#include <QPair>
#include <QVector>

class OglObj;
class GLUU;
Expand All @@ -28,17 +29,17 @@ class Coords {
float lon;
int type;
OglObj* oglObj = NULL;
std::vector<int> tileX;
std::vector<int> tileZ;
std::vector<int> x;
std::vector<int> y;
std::vector<int> z;
QVector<int> tileX;
QVector<int> tileZ;
QVector<int> x;
QVector<int> y;
QVector<int> z;
};
//struct Line {
//
//};

std::vector<Marker> markerList;
QVector<Marker> markerList;
std::unordered_map<std::string, TextObj*> nameGl;
//std::vector<Line> lineList;

Expand Down
4 changes: 2 additions & 2 deletions CoordsGpx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CoordsGpx::CoordsGpx(QString path) {

if (name.toUpper() == ("WPT")) {
placemark = true;
markerList.emplace_back();
markerList.push_back(Marker());
float lat = 0;
float lon = 0;
if(attr.size() == 2){
Expand All @@ -79,7 +79,7 @@ CoordsGpx::CoordsGpx(QString path) {
}
} else if (name.toUpper() == ("TRK")) {
placemark = true;
markerList.emplace_back();
markerList.push_back(Marker());
} else if (name.toUpper() == ("TRKPT")) {
float lat = 0;
float lon = 0;
Expand Down
4 changes: 2 additions & 2 deletions CoordsKml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ CoordsKml::CoordsKml(QString path) {

if (name.toUpper() == ("PLACEMARK")) {
placemark = true;
markerList.emplace_back();
markerList.push_back(Marker());
} else if (name.toUpper() == ("PLACEMARK")) {
placemark = true;
markerList.emplace_back();
markerList.push_back(Marker());
} else if (name.toUpper() == ("COORDINATES")) {
if(placemark)
coordinates = true;
Expand Down
2 changes: 1 addition & 1 deletion CoordsMkr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CoordsMkr::CoordsMkr(QString path) {
while (!((sh = ParserX::NextTokenInside(data).toLower()) == "")) {
//qDebug() << sh;
if (sh == ("marker")) {
markerList.emplace_back();
markerList.push_back(Marker());
markerList.back().lon = ParserX::GetNumber(data);
markerList.back().lat = ParserX::GetNumber(data);
markerList.back().name = ParserX::GetString(data);
Expand Down
4 changes: 2 additions & 2 deletions CoordsRoutePlaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CoordsRoutePlaces::CoordsRoutePlaces(TDB *tdb, QString place) {
if (n->stationName.length() > 0 && place == "stations"){
if(stations[n->stationName] == false){
stations[n->stationName] = true;
markerList.emplace_back();
markerList.push_back(Marker());
markerList.back().name = n->stationName;
markerList.back().type = 0;
markerList.back().tileX.push_back(n->trItemRData[3]);
Expand All @@ -55,7 +55,7 @@ CoordsRoutePlaces::CoordsRoutePlaces(TDB *tdb, QString place) {
if (n->type == "sidingitem" && n->platformName.length() > 0 && place == "sidings"){
if(stations[n->platformName] == false){
stations[n->platformName] = true;
markerList.emplace_back();
markerList.push_back(Marker());
markerList.back().name = n->platformName;
markerList.back().type = 0;
markerList.back().tileX.push_back(n->trItemRData[3]);
Expand Down
17 changes: 10 additions & 7 deletions Eng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,10 @@ void Eng::drawBorder3d(){
void Eng::updateSim(float deltaTime){
static float acceleration = 0;
static float lastSpeed = 0;
// Use True for fake acceleration sound
static bool fakesound = true;

if(!Game::useNetworkEng){
if(!Game::useNetworkEng || fakesound){
// Local Sound Speed test:
static SoundDefinitionGroup::Stream::Curve curve1("SpeedControlled");
static SoundDefinitionGroup::Stream::Curve curve2("SpeedControlled");
Expand All @@ -590,17 +592,17 @@ void Eng::updateSim(float deltaTime){
curve = &curve1;
}

static float acc = 0.1;
if(soundVariables != NULL)
acc = curve->getValue(soundVariables);
acceleration = curve->getValue(soundVariables);

currentSpeed += acc*deltaTime;
currentSpeed += acceleration*deltaTime;

// Static speed
currentSpeed = 37;
//currentSpeed = 40;

// Network Speed
} else {
}
if(Game::useNetworkEng) {
static IghCoordinate* igh = new IghCoordinate();
static LatitudeLongitudeCoordinate* latlon = new LatitudeLongitudeCoordinate();
static PreciseTileCoordinate* coords = new PreciseTileCoordinate();
Expand All @@ -624,8 +626,9 @@ void Eng::updateSim(float deltaTime){
networkEng->writeData(data);
}

if(currentSpeed != lastSpeed)
if(currentSpeed != lastSpeed && !fakesound){
acceleration = (currentSpeed - lastSpeed) / (deltaTime);
}

//qDebug() << acceleration << currentSpeed << lastSpeed;
if(soundVariables != NULL){
Expand Down
Loading

0 comments on commit 403f0e6

Please sign in to comment.