Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
23 changes: 22 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 All @@ -886,6 +899,8 @@ bool parse_response(std::string msg, std::string &request) {
if (setreplyfunc) {
int int_val;
int int_orig_val;
int64_t int64_val;
int64_t int64_orig_val;
double dbl_val;
double dbl_orig_val;
std::string raw_val;
Expand All @@ -899,7 +914,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:
int64_val = root[i]["value"].asInt64();
int64_orig_val = root[i]["original_value"].asInt64();
setreply.value = &int64_val;
setreply.original_value = &int64_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