Skip to content

Commit

Permalink
Fix: Savegame queued droid orders
Browse files Browse the repository at this point in the history
The `index` and `rtrType` properties were not being saved or loaded.
  • Loading branch information
past-due authored and pull[bot] committed Jan 27, 2024
1 parent 27106ac commit 1037357
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/game.cpp
Expand Up @@ -2387,6 +2387,8 @@ static void getIniDroidOrder(WzConfig &ini, WzString const &key, DroidOrder &ord
order.pos = ini.vector2i(key + "/pos");
order.pos2 = ini.vector2i(key + "/pos2");
order.direction = ini.value(key + "/direction").toInt();
order.index = ini.value(key + "/index").toUInt();
order.rtrType = (RTR_DATA_TYPE)ini.value(key + "/rtrType", RTR_TYPE_NO_RESULT).toInt();
getIniBaseObject(ini, key + "/obj", order.psObj);
getIniStructureStats(ini, key + "/stats", order.psStats);
}
Expand Down Expand Up @@ -2421,6 +2423,8 @@ static inline void setIniDroidOrder(nlohmann::json &jsonObj, WzString const &key
jsonObj[keyStr + "/pos"] = order.pos;
jsonObj[keyStr + "/pos2"] = order.pos2;
jsonObj[keyStr + "/direction"] = order.direction;
jsonObj[keyStr + "/index"] = order.index;
jsonObj[keyStr + "/rtrType"] = order.rtrType;
setIniBaseObject(jsonObj, key + "/obj", order.psObj);
setIniStructureStats(jsonObj, key + "/stats", order.psStats);
}
Expand Down
1 change: 1 addition & 0 deletions src/orderdef.h
Expand Up @@ -158,6 +158,7 @@ enum RTR_DATA_TYPE
RTR_TYPE_REPAIR_FACILITY,
RTR_TYPE_DROID,
RTR_TYPE_HQ,
// If modifying, only *add* entries at end! (or savegame loading will break)
};

/** Struct that stores data of an order.
Expand Down

0 comments on commit 1037357

Please sign in to comment.