Skip to content

Commit

Permalink
1.0.0beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
SiekamCebule committed Sep 29, 2023
1 parent 730d2c4 commit c411b6d
Show file tree
Hide file tree
Showing 11 changed files with 783 additions and 373 deletions.
4 changes: 2 additions & 2 deletions source/UI/Competition/CompetitionManagerWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ void CompetitionManagerWindow::autoSimulateJumps()

void CompetitionManagerWindow::checkRecords(JumpData &jump, bool multipleRecords)
{
if(jump.getCompetition()->getRulesPointer()->getHillRecordBreaking() == true){
if(jump.getCompetition()->getRulesPointer()->getHillRecordBreaking() == true && (jump.getLanding().getType() == Landing::TelemarkLanding || jump.getLanding().getType() == Landing::BothLegsLanding)){
if(roundDoubleToHalf(jump.getDistance()) == roundDoubleToHalf(jump.getHill()->getRecord()) && multipleRecords == false)
{
QMessageBox::information(this, "Wyrównanie rekordu skoczni", tr("%1 wyrównał rekord skoczni %2, wynoszący %3m").arg(jump.getJumper()->getTextInfo()).arg(jump.getHill()->getHillText()).arg(QString::number(jump.getHill()->getRecord(), 'f', 1)), QMessageBox::Ok);
Expand All @@ -1121,7 +1121,7 @@ void CompetitionManagerWindow::checkRecords(JumpData &jump, bool multipleRecords
}
}

if(jump.getHill()->getHillType() == Hill::Flying){
if(jump.getHill()->getHillType() == Hill::Flying && (jump.getLanding().getType() == Landing::TelemarkLanding || jump.getLanding().getType() == Landing::BothLegsLanding)){
if(roundDoubleToHalf(jump.getDistance()) == roundDoubleToHalf(jump.getJumper()->getPersonalBest()) && multipleRecords == false)
{
QMessageBox::information(this, "Wyrównanie rekordu życiowego", tr("%1 wyrównał swój własny rekord życiowy, skacząc %2m").arg(jump.getJumper()->getTextInfo()).arg(QString::number(jump.getDistance(), 'f', 1)), QMessageBox::Ok);
Expand Down
24 changes: 21 additions & 3 deletions source/UI/EditorWidgets/CompetitionRulesEditorWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,24 @@ w drużynie</string>
</item>
<item row="12" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_jumpsImportance">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>208</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>208</width>
<height>21</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QWidget{
background-color: rgb(222, 221, 218);
Expand Down Expand Up @@ -547,7 +565,7 @@ width: 5px;
<x>0</x>
<y>0</y>
<width>314</width>
<height>262</height>
<height>263</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
Expand All @@ -574,7 +592,7 @@ width: 5px;
<x>0</x>
<y>0</y>
<width>296</width>
<height>178</height>
<height>179</height>
</rect>
</property>
<attribute name="label">
Expand All @@ -587,7 +605,7 @@ width: 5px;
<x>0</x>
<y>0</y>
<width>296</width>
<height>160</height>
<height>179</height>
</rect>
</property>
<attribute name="label">
Expand Down
2 changes: 2 additions & 0 deletions source/UI/Seasons/SimulationSaveManagerWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ void SimulationSaveManagerWindow::on_pushButton_jumperStats_clicked()
statsWindow.setJumper(jumper);
statsWindow.getRangeComboBoxes()->setSeasonsList(&simulationSave->getSeasonsReference());
statsWindow.getRangeComboBoxes()->setupComboBoxes();
statsWindow.getRangeComboBoxes()->setupConnections();
statsWindow.getClassificationsCheckBoxes()->setClassificationsList(&simulationSave->getActualSeason()->getCalendarReference().getClassificationsReference());
statsWindow.getClassificationsCheckBoxes()->setupCheckBoxes();
statsWindow.fillWindow();
Expand All @@ -774,6 +775,7 @@ void SimulationSaveManagerWindow::on_pushButton_clicked()
SimulationRatingsWindow statsWindow(simulationSave, this);
statsWindow.getRangeComboBoxes()->setSeasonsList(&simulationSave->getSeasonsReference());
statsWindow.getRangeComboBoxes()->setupComboBoxes();
statsWindow.getRangeComboBoxes()->setupConnections();
statsWindow.getClassificationsCheckBoxes()->setClassificationsList(&simulationSave->getActualSeason()->getCalendarReference().getClassificationsReference());
statsWindow.getClassificationsCheckBoxes()->setupCheckBoxes();
statsWindow.setFilteredJumpers(simulationSave->getJumpersReference());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ CompetitionsRangeComboBoxesWidget::CompetitionsRangeComboBoxesWidget(QWidget *pa
ui(new Ui::CompetitionsRangeComboBoxesWidget)
{
ui->setupUi(this);

connect(ui->comboBox_firstCompetition, &QComboBox::currentIndexChanged, this, &CompetitionsRangeComboBoxesWidget::changed);
connect(ui->comboBox_secondCompetition, &QComboBox::currentIndexChanged, this, &CompetitionsRangeComboBoxesWidget::changed);
}

CompetitionsRangeComboBoxesWidget::~CompetitionsRangeComboBoxesWidget()
{
delete ui;
}

void CompetitionsRangeComboBoxesWidget::setupConnections()
{
connect(ui->comboBox_firstCompetition, &QComboBox::currentIndexChanged, this, &CompetitionsRangeComboBoxesWidget::changed);
connect(ui->comboBox_secondCompetition, &QComboBox::currentIndexChanged, this, &CompetitionsRangeComboBoxesWidget::changed);
}

void CompetitionsRangeComboBoxesWidget::setupComboBoxes()
{
ui->comboBox_firstCompetition->clear();
Expand Down Expand Up @@ -65,40 +68,53 @@ void CompetitionsRangeComboBoxesWidget::setupComboBoxes()
ui->comboBox_secondCompetition->setCurrentIndex(ui->comboBox_secondCompetition->count() - 1);
}

/*
* Sezon 2023 (0)
* K1 (1)
* K2 (2)
* Sezon 2024 (3)
* K1 (4)
* K2 (5)
* Sezon 2025 (6)
* K1 (7)
* K2 (8)
*/
CompetitionInfo *CompetitionsRangeComboBoxesWidget::getCompetition(int which)
{
qDebug()<<which;
int index = 0;
switch(which)
{
case 1:
index = ui->comboBox_firstCompetition->currentIndex() - 1;
index = ui->comboBox_firstCompetition->currentIndex();
break;
case 2:
index = ui->comboBox_secondCompetition->currentIndex() - 1;
index = ui->comboBox_secondCompetition->currentIndex();
break;
}
if(index == -1)
index = 0;
int i=0;
if(index >= 0){
//Teraz odejmijmy index za każdy sezon
for(auto & season : *seasonsList)
{
if(index >= season.getCalendarReference().getCompetitionsReference().count())
if(index > season.getCalendarReference().getCompetitionsReference().count())
{
index -= season.getCalendarReference().getCompetitionsReference().count();
index -= 1;
i++;
continue;
}
else
{
qDebug()<<season.getCalendarReference().getCompetitionsReference()[index]->getHill()->getName();
if(index > 0)
index--;
return season.getCalendarReference().getCompetitionsReference()[index];
}
}
}
return nullptr;

//sezon1 ma 68
//index 67
}

QVector<Season> *CompetitionsRangeComboBoxesWidget::getSeasonsList() const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CompetitionsRangeComboBoxesWidget : public QWidget
explicit CompetitionsRangeComboBoxesWidget(QWidget *parent = nullptr);
~CompetitionsRangeComboBoxesWidget();

void setupConnections();
void setupComboBoxes();
CompetitionInfo * getCompetition(int which);

Expand Down
6 changes: 3 additions & 3 deletions source/UI/Seasons/Stats/SimulationRatingsWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ background-color: rgb(241, 200, 255);
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_rankings">
<attribute name="title">
Expand Down Expand Up @@ -485,8 +485,8 @@ background-color: rgb(241, 200, 255);
<rect>
<x>0</x>
<y>0</y>
<width>1774</width>
<height>826</height>
<width>380</width>
<height>437</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_28">
Expand Down
2 changes: 1 addition & 1 deletion source/UI/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <random>

extern IDGenerator globalIDGenerator;
const QString appVersion = "1.0.0";
const QString appVersion = "1.0.0beta1";

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
Expand Down
3 changes: 3 additions & 0 deletions source/competitions/CompetitionInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ QVector<CompetitionInfo *> CompetitionInfo::getSpecificTypeCompetitions(QVector<

QVector<CompetitionInfo *> CompetitionInfo::getCompetitionsByStartAndEnd(QVector<CompetitionInfo *> competitions, CompetitionInfo *start, CompetitionInfo *end)
{
qDebug()<<start->getHill()->getName()<<", "<<start;
qDebug()<<end;
qDebug()<<end->getHill()->getName()<<", "<<end;
qDebug()<<"indexof start: "<<competitions.indexOf(start);
qDebug()<<"indexof end: "<<competitions.indexOf(end);
competitions.remove(0, competitions.indexOf(start));
Expand Down
4 changes: 2 additions & 2 deletions source/form-generator/JumperFormGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void JumperFormGenerator::generateJumperFormTendence()

double base = 0;

double deviation = 4 + ((settings.getTendenceVariability() - 5) / 1.25); //1.666666666666667);
double deviation = 2.80 + ((settings.getTendenceVariability() - 5) / 1.785714285714286); //1.666666666666667);

double random = 0;
if(settings.getTendenceVariability() > 0)
Expand Down Expand Up @@ -57,7 +57,7 @@ void JumperFormGenerator::generateJumperForm()
double oldForm = jumper->getJumperSkillsPointer()->getForm();
double formChange = 0;

formChange += tendence->getTendence() * 3.7;
formChange += tendence->getTendence() * 4;
formChange *= 1 + ((settings.getFormVariability() - 5) / 5);

double distanceFromAverage = abs(oldForm - 50);
Expand Down
44 changes: 27 additions & 17 deletions source/simulator/JumpSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,16 +709,19 @@ double JumpSimulator::getRandomForJumpSimulation(short parameter, Jumper *jumper
double base = 0;
double dev = 0;
double random = 0;
dev = 4.30;
double newDev = dev - double((double(skills->getJumpsEquality()) / 1.4)) - (skills->getLevelOfCharacteristic("takeoff-height") / 6) - ((jumpsImportance - 5) / 3.75);
double addition = -((dev / newDev) - 1);
dev = 5.7;
double newDev = dev;
newDev -= (double(skills->getJumpsEquality()) / 2.3);
newDev -= (skills->getLevelOfCharacteristic("takeoff-height") / 6);
newDev -= ((skills->getForm() - 50) / 100);
newDev -= ((jumpsImportance - 5) / 3.4);

double addition = ((dev / newDev) - 1);
qDebug() << "addition: " << addition;
if (MyRandom::randomDouble(0, 1 + addition) <= 0.5) {
random = MyRandom::normalDistributionRandomHalf(base, dev, MyRandom::Positive);
} else {
dev -= (skills->getJumpsEquality() / 1.4);
dev -= (skills->getLevelOfCharacteristic("takeoff-height") / 6);
dev -= ((jumpsImportance - 5) / 3.75);
dev = newDev;
qDebug()<<"devt: "<<dev;
random = MyRandom::normalDistributionRandomHalf(base, dev, MyRandom::Negative);
}
Expand All @@ -732,31 +735,38 @@ double JumpSimulator::getRandomForJumpSimulation(short parameter, Jumper *jumper
double base = 0;
double dev = 0;
double random = 0;
dev = 4.30;
dev = 5.7;
switch (skills->getFlightStyle()) {
case JumperSkills::VStyle:
dev -= 0.2;
dev -= 0.23;
break;
case JumperSkills::ModernVStyle:
dev -= 0.1;
dev -= 0.115;
break;
case JumperSkills::WideVStyle:
dev += 0.1;
dev += 0.115;
break;
case JumperSkills::HStyle:
dev += 0.2;
dev += 0.23;
break;
}
double newDev = dev - double((double(skills->getJumpsEquality()) / 1.4)) - (skills->getLevelOfCharacteristic("flight-height") / 6) - ((jumpsImportance - 5) / 3.75);
//newDev -= (((jumpsImportance - 5) / 3.75) * ((jumpsImportance - 10) * skills->getLevelOfCharacteristic("more-important-jumps")));
double addition = -((dev / newDev) - 1);
double newDev = dev;
qDebug()<<"dev: "<<newDev;
newDev -= (double(skills->getJumpsEquality()) / 2.3);
qDebug()<<"dev after equality: "<<newDev;
newDev -= (skills->getLevelOfCharacteristic("flight-height") / 6);
qDebug()<<"dev after flight height: "<<newDev;
newDev -= ((skills->getForm() - 50) / 100);
qDebug()<<"dev after form"<<newDev;
newDev -= ((jumpsImportance - 5) / 3.4);
qDebug()<<"dev after jumps jumps importance"<<newDev;

double addition = ((dev / newDev) - 1);
qDebug() << "addition: " << addition;
if (MyRandom::randomDouble(0, 1 + addition) <= 0.5) {
random = MyRandom::normalDistributionRandomHalf(base, dev, MyRandom::Positive);
} else {
dev -= (skills->getJumpsEquality() / 1.4);
dev -= (skills->getLevelOfCharacteristic("flight-height") / 6);
dev -= ((jumpsImportance - 5) / 3.75);
dev = newDev;
qDebug()<<"devf: "<<dev;
random = MyRandom::normalDistributionRandomHalf(base, dev, MyRandom::Negative);
}
Expand Down
Loading

0 comments on commit c411b6d

Please sign in to comment.