Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion Archipelago.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,15 @@ void AP_BulkSetServerData(AP_SetServerDataRequest* request) {
req_t["default"] = *((int*)request->default_value);
}
break;
case AP_DataType::Int64:
for (int i = 0; i < request->operations.size(); i++) {
req_t["operations"][i]["operation"] = request->operations[i].operation;
req_t["operations"][i]["value"] = *((int64_t*)request->operations[i].value);
}
if (request->default_value != nullptr) {
req_t["default"] = *((int64_t*)request->default_value);
}
break;
case AP_DataType::Double:
for (int i = 0; i < request->operations.size(); i++) {
req_t["operations"][i]["operation"] = request->operations[i].operation;
Expand Down Expand Up @@ -614,6 +623,7 @@ void AP_SetNotify(std::map<std::string,AP_DataType> keylist, bool requestCurrent
setDefaultRequest.want_reply = true;
switch (keytypepair.second) {
case AP_DataType::Int:
case AP_DataType::Int64:
case AP_DataType::Double:
setDefaultRequest.operations = {{"default", &zero}};
setDefaultRequest.default_value = &zero;
Expand Down Expand Up @@ -860,6 +870,9 @@ bool parse_response(std::string msg, std::string &request) {
case AP_DataType::Int:
*((int*)target->value) = root[i]["keys"][itr].asInt();
break;
case AP_DataType::Int64:
*((int64_t*)target->value) = root[i]["keys"][itr].asInt64();
break;
case AP_DataType::Double:
*((double*)target->value) = root[i]["keys"][itr].asDouble();
break;
Expand Down Expand Up @@ -899,7 +912,13 @@ bool parse_response(std::string msg, std::string &request) {
setreply.value = &int_val;
setreply.original_value = &int_orig_val;
break;
case AP_DataType::Double:
case AP_DataType::Int64:
int_val = root[i]["value"].asInt64();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int_val is 32bit, I dont see how this works?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats why its still draft, i still got to test it

int_orig_val = root[i]["original_value"].asInt64();
setreply.value = &int_val;
setreply.original_value = &int_orig_val;
break;
case AP_DataType::Double:
dbl_val = root[i]["value"].asDouble();
dbl_orig_val = root[i]["original_value"].asDouble();
setreply.value = &dbl_val;
Expand Down
2 changes: 1 addition & 1 deletion Archipelago.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ enum struct AP_RequestStatus {
};

enum struct AP_DataType {
Raw, Int, Double
Raw, Int, Double, Int64
};

struct AP_GetServerDataRequest {
Expand Down