|
|
@ -2860,9 +2860,22 @@ static command_result GetVersionInfo(color_ostream & stream, const EmptyMessage
|
|
|
|
return CR_OK;
|
|
|
|
return CR_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int lastSentReportID = -1;
|
|
|
|
|
|
|
|
|
|
|
|
static command_result GetReports(color_ostream & stream, const EmptyMessage * in, RemoteFortressReader::Status * out)
|
|
|
|
static command_result GetReports(color_ostream & stream, const EmptyMessage * in, RemoteFortressReader::Status * out)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int i = 0; i < world->status.reports.size(); i++)
|
|
|
|
//First find the last report we sent, so it doesn't get resent.
|
|
|
|
|
|
|
|
int lastSentIndex = -1;
|
|
|
|
|
|
|
|
for (int i = world->status.reports.size() - 1; i >= 0; i--)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
auto local_rep = world->status.reports[i];
|
|
|
|
|
|
|
|
if (local_rep->id <= lastSentReportID)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
lastSentIndex = i;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = lastSentIndex + 1; i < world->status.reports.size(); i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auto local_rep = world->status.reports[i];
|
|
|
|
auto local_rep = world->status.reports[i];
|
|
|
|
if (!local_rep)
|
|
|
|
if (!local_rep)
|
|
|
@ -2880,6 +2893,7 @@ static command_result GetReports(color_ostream & stream, const EmptyMessage * in
|
|
|
|
send_rep->set_id(local_rep->id);
|
|
|
|
send_rep->set_id(local_rep->id);
|
|
|
|
send_rep->set_year(local_rep->year);
|
|
|
|
send_rep->set_year(local_rep->year);
|
|
|
|
send_rep->set_time(local_rep->time);
|
|
|
|
send_rep->set_time(local_rep->time);
|
|
|
|
|
|
|
|
lastSentReportID = local_rep->id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return CR_OK;
|
|
|
|
return CR_OK;
|
|
|
|
}
|
|
|
|
}
|