Skip to content

Commit

Permalink
For testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich committed Feb 16, 2024
1 parent b43b55e commit 6b45e7b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
37 changes: 20 additions & 17 deletions lib/netplay/autorevision_netplay.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions src/droid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down Expand Up @@ -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())
{
Expand All @@ -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)
{
Expand Down
10 changes: 10 additions & 0 deletions src/structuredef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
};

Expand Down

0 comments on commit 6b45e7b

Please sign in to comment.