From 6b45e7b8fb7ab4ca896c6c43e450fd7ea94b1ef7 Mon Sep 17 00:00:00 2001 From: Nikolay Borodin Date: Fri, 16 Feb 2024 20:06:13 +0200 Subject: [PATCH] For testing --- lib/netplay/autorevision_netplay.cmake | 37 ++++++++++++++------------ src/droid.cpp | 7 +++-- src/structuredef.h | 10 +++++++ 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/lib/netplay/autorevision_netplay.cmake b/lib/netplay/autorevision_netplay.cmake index beabc873648..d79c404b904 100644 --- a/lib/netplay/autorevision_netplay.cmake +++ b/lib/netplay/autorevision_netplay.cmake @@ -63,23 +63,26 @@ unset(NETCODE_VERSION_MINOR) # - NETCODE_VERSION_MAJOR: 0x1000 # - NETCODE_VERSION_MINOR: 1 -if(DEFINED VCS_TAG AND NOT "${VCS_TAG}" STREQUAL "") - # We're on an exact tag / tagged release - VALIDATE_INTEGER(VCS_TAG_TAG_COUNT) - set(NETCODE_VERSION_MAJOR "0x4000") - set(NETCODE_VERSION_MINOR ${VCS_TAG_TAG_COUNT}) -else() - if("${VCS_BRANCH}" STREQUAL "master") - # master branch build - VALIDATE_INTEGER(VCS_COMMIT_COUNT) - set(NETCODE_VERSION_MAJOR "0x10a0") - set(NETCODE_VERSION_MINOR ${VCS_COMMIT_COUNT}) - else() - # any other builds (other branches, forks, etc) - set(NETCODE_VERSION_MAJOR "0x1000") - set(NETCODE_VERSION_MINOR 1) - endif() -endif() +# if(DEFINED VCS_TAG AND NOT "${VCS_TAG}" STREQUAL "") +# # We're on an exact tag / tagged release +# VALIDATE_INTEGER(VCS_TAG_TAG_COUNT) +# set(NETCODE_VERSION_MAJOR "0x4000") +# set(NETCODE_VERSION_MINOR ${VCS_TAG_TAG_COUNT}) +# else() +# if("${VCS_BRANCH}" STREQUAL "master") +# # master branch build +# VALIDATE_INTEGER(VCS_COMMIT_COUNT) +# set(NETCODE_VERSION_MAJOR "0x10a0") +# set(NETCODE_VERSION_MINOR ${VCS_COMMIT_COUNT}) +# else() +# # any other builds (other branches, forks, etc) +# set(NETCODE_VERSION_MAJOR "0x1000") +# set(NETCODE_VERSION_MINOR 1) +# endif() +# endif() + +set(NETCODE_VERSION_MAJOR "0x4000") +set(NETCODE_VERSION_MINOR "85") ################################## # Debug output diff --git a/src/droid.cpp b/src/droid.cpp index e27e8ae234f..663a4bc628a 100644 --- a/src/droid.cpp +++ b/src/droid.cpp @@ -1872,7 +1872,7 @@ void assignObjectToGroup(UDWORD playerNumber, UDWORD groupNumber, bool clearGrou if (groupNumber < UBYTE_MAX) { /* Run through all the structures */ - for (STRUCTURE *psStruct : apsStructLists[playerNumber]) + for (auto psStruct = apsStructLists[playerNumber]; psStruct != nullptr; psStruct = psStruct->psNext) { if (psStruct->selected && psStruct->isFactory()) { @@ -1927,12 +1927,11 @@ void assignObjectToGroup(UDWORD playerNumber, UDWORD groupNumber, bool clearGrou void removeObjectFromGroup(UDWORD playerNumber) { - DROID *psDroid; unsigned removedCount = 0; ASSERT_OR_RETURN(, playerNumber < MAX_PLAYERS, "Invalid player: %" PRIu32 "", playerNumber); - for (STRUCTURE *psStruct : apsStructLists[playerNumber]) + for (auto psStruct = apsStructLists[playerNumber]; psStruct != nullptr; psStruct = psStruct->psNext) { if (psStruct->selected && psStruct->isFactory()) { @@ -1941,7 +1940,7 @@ void removeObjectFromGroup(UDWORD playerNumber) } } - for (DROID* psDroid : apsDroidLists[playerNumber]) + for (auto psDroid = apsDroidLists[playerNumber]; psDroid != nullptr; psDroid = psDroid->psNext) { if (psDroid->selected) { diff --git a/src/structuredef.h b/src/structuredef.h index e2000a64392..4508b0fd588 100644 --- a/src/structuredef.h +++ b/src/structuredef.h @@ -306,6 +306,16 @@ struct STRUCTURE : public BASE_OBJECT iIMDBaseShape *prebuiltImd; UBYTE productToGroup = UBYTE_MAX; + bool isFactory() const + { + ASSERT_OR_RETURN(false, pStructureType != nullptr, "Invalid structureType!"); + + return type == OBJ_STRUCTURE && ( + pStructureType->type == REF_FACTORY || + pStructureType->type == REF_CYBORG_FACTORY || + pStructureType->type == REF_VTOL_FACTORY); + } + inline Vector2i size() const { return pStructureType->size(rot.direction); } };