-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: orderlist Importing / Exporting. #679
base: jgrpp
Are you sure you want to change the base?
Conversation
the system is now fully operational, imporing and exporting should work. |
auto& headJson = json["head"]; | ||
for (unsigned int i = 0; auto &SD : SD_data) { | ||
|
||
headJson["scheduled-dispatch"][i++] = nlohmann::json::parse(SD.ToJSONString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Serialising a JSON string and then immediately parsing it suggests that a string is not really the right return type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to avoid having to include the json library in the headers, but I guess you are right.
Should it be changed to just use a json object then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would likely be better, I agree that including the JSON library everywhere is not ideal, but I can resolve that later on
src/order_cmd.cpp
Outdated
if (extraJson.contains("dispatch-index")) | ||
extraJson["dispatch-index"].get_to(new_order.extra->dispatch_index); | ||
|
||
if (extraJson.contains("xdata")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These bypass all the order flag and value validation, so likely some changes are needed here. Something for me to look into later probably.
src/fios_gui.cpp
Outdated
@@ -367,9 +474,9 @@ struct SaveLoadWindow : public Window { | |||
this->querystrings[WID_SL_FILTER] = &this->filter_editbox; | |||
this->filter_editbox.cancel_button = QueryString::ACTION_CLEAR; | |||
|
|||
/* pause is only used in single-player, non-editor mode, non-menu mode. It | |||
/* pause is only used in single-player, non-editor mode, non-menu mode, when not operationg on orderlists. It |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are quite a lot of spelling errors like this
ds.UpdateScheduledDispatch(nullptr); | ||
SetTimetableWindowsDirty(v, STWDF_SCHEDULED_DISPATCH); | ||
if (scheduleJson == nullptr) { | ||
if (p2 == 0) return CMD_ERROR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check shouldn't be within DC_EXEC because text and exec runs should return the same command result (except where flagged otherwise).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what solution do you suggest? Should I move it outside of DC_EXEC by checking that condition twice?
I.E. something like
if(scheduleJson == nullptr && p2 == 0) return CMD_ERROR;
…splay station names in output json
No description provided.