Skip to content

Commit

Permalink
MeOS version 3.5.860
Browse files Browse the repository at this point in the history
  • Loading branch information
erikmelin committed Apr 21, 2018
1 parent 5327dee commit b53348f
Show file tree
Hide file tree
Showing 26 changed files with 2,629 additions and 204 deletions.
52 changes: 39 additions & 13 deletions code/TabAuto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,20 +987,46 @@ void PunchMachine::process(gdioutput &gdi, oEvent *oe, AutoSyncType ast)
{
#ifndef MEOSDB
SICard sic(ConvertedTimeStatus::Hour24);
oe->generateTestCard(sic);
SportIdent &si = TabSI::getSI(gdi);
if (!sic.empty()) {
if (!radio) si.addCard(sic);
}
else gdi.addInfoBox("", L"Failed to generate card.", interval*2);

if (radio && !sic.empty()) {
pRunner r=oe->getRunnerByCardNo(sic.CardNumber, 0, false);
if (r && r->getCardNo()) {
sic.CardNumber=r->getCardNo();
sic.punchOnly=true;
sic.nPunch=1;
sic.Punch[0].Code=radio;

if (radio == 0) {
oe->generateTestCard(sic);
if (!sic.empty()) {
if (!radio) si.addCard(sic);
}
else gdi.addInfoBox("", L"Failed to generate card.", interval * 2);
}
else {
SICard sic(ConvertedTimeStatus::Hour24);
vector<pRunner> rr;
oe->getRunners(0, 0, rr);
vector<pRunner> cCand;
vector<pFreePunch> pp;
for (auto r : rr) {
if (r->getStatus() == StatusUnknown && r->startTimeAvailable()) {
auto pc = r->getCourse(false);
if (radio < 10 || pc->hasControlCode(radio)) {
pp.clear();
oe->getPunchesForRunner(r->getId(), pp);
bool hit = false;
for (auto p : pp) {
if (p->getTypeCode() == radio)
hit = true;
}
if (!hit)
cCand.push_back(r);
}
}
}
if (cCand.size() > 0) {
int ix = rand() % cCand.size();
pRunner r = cCand[ix];
sic.convertedTime = ConvertedTimeStatus::Done;
sic.CardNumber = r->getCardNo();
sic.punchOnly = true;
sic.nPunch = 1;
sic.Punch[0].Code = radio;
sic.Punch[0].Time = 600 + rand() % 1200 + r->getStartTime();
si.addCard(sic);
}
}
Expand Down
17 changes: 11 additions & 6 deletions code/TabClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ int TabClass::multiCB(gdioutput &gdi, int type, void *data)
wstring st=gdi.getText("StartTime");

int nst = oe->convertAbsoluteTime(st);
if (warnDrawStartTime(gdi, nst)) {
if (nst >= 0 && warnDrawStartTime(gdi, nst, true)) {
nst = 3600;
st = oe->getAbsTime(nst);
}
Expand Down Expand Up @@ -876,9 +876,11 @@ int TabClass::classCB(gdioutput &gdi, int type, void *data)
}
else
specs[ci.classId].push_back(cds);

maxST = max(cds.firstStart + drawInfo.nFields * drawInfo.baseInterval * ci.interval, maxST);
}

if (warnDrawStartTime(gdi, maxST))
if (warnDrawStartTime(gdi, maxST, false))
return 0;

for (map<int, vector<ClassDrawSpecification> >::iterator it = specs.begin();
Expand Down Expand Up @@ -1409,7 +1411,7 @@ int TabClass::classCB(gdioutput &gdi, int type, void *data)
else if (bi.id=="DoDrawBefore")
dtype = oEvent::remainingBefore;
else {
if (warnDrawStartTime(gdi, t))
if (warnDrawStartTime(gdi, t, false))
return 0;
}
//bool pairwise = false;
Expand Down Expand Up @@ -4181,11 +4183,14 @@ void TabClass::setLockForkingState(gdioutput &gdi, bool poolState, bool lockStat

bool TabClass::warnDrawStartTime(gdioutput &gdi, const wstring &firstStart) {
int st = oe->getRelativeTime(firstStart);
return warnDrawStartTime(gdi, st);
return warnDrawStartTime(gdi, st, false);
}

bool TabClass::warnDrawStartTime(gdioutput &gdi, int time) {
if (!hasWarnedStartTime && time > 3600 * 8 && !oe->useLongTimes()) {
bool TabClass::warnDrawStartTime(gdioutput &gdi, int time, bool absTime) {
if (absTime)
time = oe->getRelativeTime(formatTimeHMS(time));

if (!hasWarnedStartTime && (time > 3600 * 11 && !oe->useLongTimes())) {
bool res = gdi.ask(L"warn:latestarttime#" + itow(time/3600));
if (res)
hasWarnedStartTime = true;
Expand Down
2 changes: 1 addition & 1 deletion code/TabClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class TabClass :

void pursuitDialog(gdioutput &gdi);

bool warnDrawStartTime(gdioutput &gdi, int time);
bool warnDrawStartTime(gdioutput &gdi, int time, bool absTime);
bool warnDrawStartTime(gdioutput &gdi, const wstring &firstStart);

void static clearPage(gdioutput &gdi, bool autoRefresh);
Expand Down
18 changes: 16 additions & 2 deletions code/TabCompetition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,13 @@ int TabCompetition::competitionCB(gdioutput &gdi, int type, void *data)
else if (bi.id=="DoFreeImport") {
fi.addEntries(oe, entries);
entryText.clear();

// Update qualification/final
vector<pClass> cls;
oe->getClasses(cls, false);
for (pClass c : cls) {
c->updateFinalClasses(0, false);
}
loadPage(gdi);
}
else if (bi.id=="Startlist") {
Expand Down Expand Up @@ -2377,7 +2384,8 @@ void TabCompetition::loadAboutPage(gdioutput &gdi) const
"\n\nDanish Translation by Michael Leth Jess and Chris Bagge"
"\n\nRussian Translation by Paul A. Kazakov and Albert Salihov"
"\n\nOriginal French Translation by Jerome Monclard"
"\n\nAdaption to French conditions and extended translation by Pierre Gaufillet");
"\n\nAdaption to French conditions and extended translation by Pierre Gaufillet"
"\n\nCzech Translation by Marek Kustka");

gdi.dropLine();
gdi.addString("", 0, "Det här programmet levereras utan någon som helst garanti. Programmet är ");
Expand Down Expand Up @@ -2514,7 +2522,7 @@ bool TabCompetition::loadPage(gdioutput &gdi)
gdi.dropLine(1.2);
gdi.addCheckbox("LongTimes", "Aktivera stöd för tider över 24 timmar", CompetitionCB, oe->useLongTimes());

if (oe->isClient()) {
if (false && oe->isClient()) {
gdi.popX();
gdi.disableInput("ZeroTime");
gdi.disableInput("LongTimes");
Expand Down Expand Up @@ -3502,6 +3510,12 @@ TabCompetition::FlowOperation TabCompetition::saveEntries(gdioutput &gdi, bool r
}
}

// Update qualification/final
vector<pClass> cls;
oe->getClasses(cls, false);
for (pClass c : cls) {
c->updateFinalClasses(0, false);
}
return FlowContinue;
}

Expand Down
5 changes: 4 additions & 1 deletion code/TabCourse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ wstring TabCourse::encodeCourse(const wstring &in, bool firstStart, bool lastFin
out.reserve(in.length() * 2);
wstring bf;
for (size_t i = 0; i < newC.size(); ++i) {
if (i == 0) {
if (i == 0 && (newC.size() > 1 || firstStart)) {
out += lang.tl("Start");
if (firstStart)
out += L"(" + itow(newC[i]) + L")";
Expand All @@ -1141,6 +1141,9 @@ wstring TabCourse::encodeCourse(const wstring &in, bool firstStart, bool lastFin
out += dash;

if (i+1 == newC.size()) {
if (i == 0) {
out = lang.tl("Start") + dash;
}
if (lastFinish)
out += lang.tl("Mål") + L"(" + itow(newC[i]) + L")";
else
Expand Down
31 changes: 15 additions & 16 deletions code/TabSI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ void TabSI::logCard(gdioutput &gdi, const SICard &card)
extern SportIdent *gSI;
extern pEvent gEvent;

void LoadRunnerPage(gdioutput &gdi);


int SportIdentCB(gdioutput *gdi, int type, void *data) {
TabSI &tsi = dynamic_cast<TabSI &>(*gdi->getTabs().get(TSITab));

Expand Down Expand Up @@ -1580,17 +1577,6 @@ bool TabSI::loadPage(gdioutput &gdi) {

gdi.addInput("C" + itos(i+1), itow(c), 3, 0, L"#C" + itow(i+1));
}
/*
gdi.addInput("C1", "33", 5, 0, "#C1");
gdi.addInput("C2", "34", 5, 0, "#C2");
gdi.addInput("C3", "45", 5, 0, "#C3");
gdi.addInput("C4", "50", 5, 0, "#C4");
gdi.addInput("C5", "61", 5, 0, "#C5");
gdi.addInput("C6", "62", 5, 0, "#C6");
gdi.addInput("C7", "67", 5, 0, "#C7");
gdi.addInput("C8", "100", 5, 0, "#C8");
*/

gdi.dropLine();
gdi.addButton("Save", "Bricka", SportIdentCB);
Expand Down Expand Up @@ -1666,7 +1652,7 @@ bool TabSI::loadPage(gdioutput &gdi) {
gdi.dropLine(2);
gdi.setRestorePoint("SIPageLoaded");

if (mode==ModeReadOut) {
if (mode == ModeReadOut) {
gdi.addButton("Import", "Importera från fil...", SportIdentCB);

gdi.setRestorePoint("Help");
Expand All @@ -1677,7 +1663,7 @@ bool TabSI::loadPage(gdioutput &gdi) {

gdi.dropLine();
}
else if (mode==ModeAssignCards) {
else if (mode == ModeAssignCards) {
gdi.dropLine(1);
showAssignCard(gdi, true);
}
Expand Down Expand Up @@ -3867,6 +3853,19 @@ void TabSI::handleAutoComplete(gdioutput &gdi, AutoCompleteInfo &info) {
directEntryGUI.updateFees(gdi, cls, getThisYear() - year);
}
}
if (r) {
if (gdi.hasField("Club") && r->dbe().clubNo) {
if (gdi.getText("Club").empty()) {
auto pclub = oe->getRunnerDatabase().getClub(r->dbe().clubNo);
if (pclub)
gdi.setText("Club", pclub->getName());
}
}
if (gdi.hasField("CardNo") && r->dbe().cardNo) {
if (gdi.getText("CardNo").empty())
gdi.setText("CardNo", r->dbe().cardNo);
}
}
}
}
gdi.clearAutoComplete("");
Expand Down
7 changes: 4 additions & 3 deletions code/TabSI.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ class csvparser;
struct AutoCompleteRecord;

class TabSI : public TabBase, AutoCompleteHandler {
public:
enum SIMode {
public:
enum SIMode {
ModeReadOut,
ModeAssignCards,
ModeCheckCards,
ModeEntry,
ModeCardData
};


void setMode(SIMode m) { mode = m; }
private:
/** Try to automatcally assign a class to runner (if none is given)
Return true if runner has a class on exist */
Expand Down
1 change: 0 additions & 1 deletion code/cp1250.lng

This file was deleted.

1 change: 0 additions & 1 deletion code/cp1255.lng

This file was deleted.

Loading

0 comments on commit b53348f

Please sign in to comment.