Not sure if it's a software issue or my incredible programming skills.
I'm using UE4.27 and Rider for UE 2021.2.1 for C++ project. Recently I got some strange bug or something else: some changes in the code do not affect the program in any way. For example, there are old logs (Unable to get Owner Actor, AttackMontageN) that still work fine and new logs (NewLog) that didn't work, but there are no errors while building, crashes or anything like this:
void UMeleeAttackAbility::CommitExecute(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo,
const FGameplayAbilityActivationInfo ActivationInfo)
{
Super::CommitExecute(Handle, ActorInfo, ActivationInfo);
const auto Owner = ActorInfo->OwnerActor.Get();
if (!Owner)
{
UE_LOG(LogPRAbilitySystemBase, Error, TEXT("Unable to get Owner Actor"))
K2_EndAbility();
}
UE_LOG(LogPRAbilitySystemBase, Warning, TEXT("NewLog"));
const int MontageIndex = rand() % 3;
switch(MontageIndex)
{
case 0:
UE_LOG(LogPRAbilitySystemBase, Warning, TEXT("AttackMontage1"));
AttackMontage = AttackMontage1;
break;
case 1:
UE_LOG(LogPRAbilitySystemBase, Warning, TEXT("AttackMontage2"));
AttackMontage = AttackMontage2;
break;
case 2:
UE_LOG(LogPRAbilitySystemBase, Warning, TEXT("AttackMontage3"));
AttackMontage = AttackMontage3;
break;
default:
break;
}
UE_LOG(LogPRAbilitySystemBase, Warning, TEXT("NewLog"));
//...
}
I reverted to one very old commit where this code is completely different, but the results in the logs and character behavior are still the same. Also I'm tried to rebuild current project (in Advanced Build Actions) and do some other obvious things such restarting UE4/Rider, etc. Is it Rider problem or it can be something else?
Related
Tell me how I can understand what is in the handler Client.Update. Is the message coming from me?
For some reason, it happens that I look at the From_id and From.Id, there is my ID, then for some reason, there is not.
As I understand it, it shows my ID when I write in a chat, and if in private messages with a friend, it shows his ID.
I'm trying to catch the ID through a common example.
private static void DisplayMessage(MessageBase messageBase, bool edit = false)
{
if (edit) Console.Write("(Edit): ");
switch (messageBase)
{
case Message m: Console.WriteLine($"{Peer(m.from_id) ?? m.post_author} in {Peer(m.peer_id)}> {m.message}"); break;
case MessageService ms: Console.WriteLine($"{Peer(ms.from_id)} in {Peer(ms.peer_id)} [{ms.action.GetType().Name[13..]}]"); break;
}
}
The message.flags should contain the flag Flags.out_ for your outgoing messages.
So at work I inherited a massive project taking 1553 messages from an airplane and translating them to a completely different message type. My problem is that I need to use the data from 2 different messages, which are processed completely separately, together.
This is how I inherited it: there's a completely different process for processing the 2Rx message (which has the "plane altitude" data) and the 17Rx message (which has the "structure altitude" data).
I tried to simplify as much of the code that's relevant as possible, but this is the first experience I've had with coding and I've had no programming education, so please tell me if there's something I can do to make it more clear (for example I don't fully understand the Process1553 function).
My job is to do the actual conversions: in my example the altitude data for both the plane and a ground structure is being received in meters and needs to be sent out as feet. However, I ALSO need to send out data comparing the 2 altitudes (well, I'm actually converting Lat/Long/Alt to North/East/Down, but for simplicity let's just say I need the difference in altitudes of the plane and the structure).
void AirplaneComm::Process1553()
{
M1553RawMsgClass *currentMessage;
//check for new messages
while(incomingMessages->size()>0)
{
//grab the message from the top of the stack
currentMessage=(M1553RawMsgClass*)incomingMessages->front();
//pop the stack
incomingMessages->pop_front();
//We are only interested in R messages
if(currentMessage->MessageType()==M1553RawMsgClass::RECEIVE_MSG)
{
M1553RxMsgClass newRxMessage(*currentMessage);
switch (newRxMessage.RxMsgType())
{
case M1553RxMsgClass::RX_2: {
ProcessRx2Msg(newRxMessage);
break;}
// .... more messages
case M1553RxMsgClass::RX_17: {
ProcessRx17Msg(newRxMessage);
break;}
default:
// No processing for this message
break;
}
}
//clean up
if(currentMessage)
{
delete currentMessage;
}
}
}
void AirplaneComm::ProcessRx2Msg(M1553RxMsgClass incoming2Rmessage)
{
M1760Rx2MsgClass newMessage(incoming2Rmessage); //M1760 classes "get" data from
//the 1553 messages and "set"
//it to send as serial
WordType platformAltitudeMeters = newMessage.GetPlatAltitude(); //received altitude in meters
double platformAltitudeFeet = platformAltitudeMeters * 3.2808; //converted to feet
mSerial.SetPlatAltitude(platformAltitudeFeet); //sets the altitude info
}
void AirplaneComm::ProcessRx17Msg(M1553RxMsgClass incoming17Rmessage)
{
M1760Rx17MsgClass newMessage(incoming17Rmessage);
WordType structureAltitudeMeters = newMessage.GetStructAltitude(); //received altitude in meters
double structureAltitudeFeet = structureAltitudeMeters * 3.2808; //converted to feet
mSerial.SetStructAltitude(structureAltitudeFeet); //sets the altitude info
}
So as far as I can tell, the "switch" function takes each "case" individually. I tried creating a new 2Rx AND 17Rx process ("ProcessRx2MsgRx17Msg") assigning those messages (Rx2Msg, Rx17Msg) to variables I declared in each "case":
switch (newRxMessage.RxMsgType())
{
case M1553RxMsgClass::RX_2:
ProcessRx2Msg(newRxMessage);
M1553RxMsgClass Rx2Msg; //M1553RxMsgClass is a variable type taking
Rx2Msg = newRxMessage; //the whole message
break;}
case M1553RxMsgClass::RX_17:
ProcessRx17Msg(newRxMessage);
M1553RxMsgClass Rx17Msg = newRxMessage;
break;
default:
// No processing for this message
break;
ProcessRx2MsgRx17Msg(Rx2Msg, Rx17Msg);
}
but when I did that, it claimed that I was jumping switch labels. I get that this means they are in the same "scope" (ok, I googled it) but when I put brackets around each "case":
case M1553RxMsgClass::RX_2: {
ProcessRx2Msg(newRxMessage);
M1553RxMsgClass Rx2Msg;
Rx2Msg = newRxMessage;
break;}
case M1553RxMsgClass::RX_17: {
ProcessRx17Msg(newRxMessage);
M1553RxMsgClass Rx17Msg = newRxMessage;
break;}
default:
// No processing for this message
break;
ProcessRx2MsgRx17Msg(Rx2Msg, Rx17Msg);
}
but then my ProcessRx2MsgRx17Msg doesn't recognize "Rx2Msg" or "Rx17Msg".
I also considered making "ProcessRx2Msg" a function that could return a value instead of a void function so that I could use it in "ProcessRx17Msg", but I actually need multiple variables from each message (latitude, longitude, and altitude).
So, is it even possible to accomplish what I want with the way it's set up since I inherited it? Also, sorry if I used the wrong terms for certain things.
EDIT: Thank you JarMan and SoronelHaetir. This is how I ended up getting it to work:
void AirplaneComm::Process1553()
{
M1553RawMsgClass *currentMessage;
static M1553RxMsgClass Rx2Msg, Rx17Msg;
//check for new messages
while(incomingMessages->size()>0)
{
//grab the message from the top of the stack
currentMessage=(M1553RawMsgClass*)incomingMessages->front();
//pop the stack
incomingMessages->pop_front();
//We are only interested in R messages
if(currentMessage->MessageType()==M1553RawMsgClass::RECEIVE_MSG)
{
M1553RxMsgClass newRxMessage(*currentMessage);
switch (newRxMessage.RxMsgType())
{
case M1553RxMsgClass::RX_2:
ProcessRx2Msg(newRxMessage);
Rx2Msg = newRxMessage;
break;
// .... more messages
case M1553RxMsgClass::RX_17:
ProcessRx17Msg(newRxMessage);
Rx17Msg = newRxMessage;
ProcessRx2MsgRx17Msg(Rx2Msg, Rx17Msg);
break;
default:
// No processing for this message
break;
}
}
//clean up
if(currentMessage)
{
delete currentMessage;
}
}
}
Then, I was able to use ProcessRx2MsgRx17Msg to convert the airplane geodetic data from Rx2 AND the structure geodetic data from Rx17 to North/East/Down coordinates.
If you need to process data from multiple messages you will have to alter the earlier message processing to save the needed data somewhere then when the later message comes in refer to both the later message parameters as well as the saved message parameters from the earlier message(s). The saved data will need a lifetime longer than the single function call (whether you make it static to the message processing function or global is up to the design choices your organization uses).
I'm writing tests with Googletest in Eclipse Oxygen 4.7.0 and I'm using Value-Parameterization. There is some weird behavior going on that I cannot explain so I hoped someone here might know what is going on.
The fixture class for value-parameterization should create 256 tests for each TEST_P. However, upon running the test for the first time after booting my computer, at least one TEST_P creates less tests than it should. Sometimes it is only 40, sometimes it is 180 or any number just not 256. The tests that do run pass and I don't get an error message. When I hit run again, all tests run as they should.
Here is what the fixture, one TEST_P and the instantiation look like:
typedef struct mystruct
{
mystruct()
{
myparam = new FooStruct;
bool1 = true;
bool2 = true;
bool3 = false;
bool4 = true;
bool5 = true;
bool6 = true;
uint8_t1 = 0;
uint8_t2 = 2;
uint8_t3 = 2;
int32_t1 = 0;
int32_t2 = 0;
int32_t3 = 0;
int32_t4 = 0;
}
~mystruct()
{
delete myparam;
myparam = NULL;
}
void setInt32_t(int32_t newint1, int32_t newint2, int32_t newint3, int32_t newint4)
{
int32_t1 = newint1;
int32_t2 = newint2;
int32_t3 = newint3;
int32_t4 = newint4;
}
FooStruct *myparam;
bool bool1, bool2, bool3, bool4, bool5, bool6;
uint8_t uint8_t1, uint8_t2, uint8_t3;
int32_t int32_t1, int32_t2, int32_t3, int32_t4;
}MYSTRUCT_T;
class MyTest : public testing::TestWithParam
< ::std::tr1::tuple<uint8_t, uint8_t, uint8_t, bool, bool, bool, bool> >
{
public:
MYSTRUCT_T *testparams;
protected:
virtual void SetUp()
{
_Initializer();
testparams = new mystruct();
testparams->uint8_t1 = ::std::tr1::get<0>(GetParam());
testparams->uint8_t2 = ::std::tr1::get<1>(GetParam());
testparams->uint8_t3 = ::std::tr1::get<2>(GetParam());
testparams->bool1 = ::std::tr1::get<3>(GetParam());
testparams->bool2 = ::std::tr1::get<4>(GetParam());
testparams->bool3 = ::std::tr1::get<5>(GetParam());
testparams->bool4 = ::std::tr1::get<6>(GetParam());
//bool5 and bool6 are unused here
}
virtual void TearDown()
{
delete testparams;
}
};
TEST_P(MyTest, NameOfTheTest)
{
testparams->bool1
? (testparams->uint8_t3 == 2)
? testparams->setInt32_t(0, 0, 0, 0)
: testparams->limits(1, 1, 1, 1)
: (testparams->uint8_t3 == 2)
? testparams->setInt32_t(2, 2, 2, 2)
: testparams->setInt32_t(3, 3, 3, 3);
int bar = 0;
_SetParam(testparams);
if(!_CheckAndSetParam(testparams, bar))
{
FAIL();
return;
}
_DoSomething(bar);
EXPECT_EQ(0, Global_Var[bar].status());
int32_t baz = 1;
_DoMore(bar, baz, testparams->bool2);
EXPECT_EQ(1, Global_Var[bar].status());
}
using testing::Bool;
using testing::Values;
using testing::Range;
INSTANTIATE_TEST_CASE_P(InstantiationName, MyTest,
::testing::Combine(Range((uint8_t)0, (uint8_t) 4), Range((uint8_t)0, (uint8_t)2), Range((uint8_t)2, (uint8_t)4), Bool(), Bool(), Bool(), Bool()));
I am utterly clueless as to why this keeps happening. A colleague just cloned the repository and on his machine the tests ran without a problem first try.
If any further detail or more information about my computer is needed, I am happy to provide it.
EDIT: I now noticed that there is an error that is being displayed when this behaviour occurs. Above the Console there is a small status bar (I don't know what it is called or how to best describe it) that continuously shows which test is currently running. When the tests get interrupted it says there: "I/O error: Pipe closed". Unfortunately, I couldn't find anything so far regarding that output. So the question is still unanswered
Another Edit : Coming back because the issue has arisen again when I thought it was already solved. I haven't read too much about pipe usage in the GoogleTest Documentation but will do now as I remember seeing it being mentioned at some point. Maybe that will lead me to a clue. The reason, however, I am editing this question again is to describe what I see when the error occurs.
Only one thing is constant among the crashes: the error type which is
I/O Error: : Pipe closed
Here is how I can invoke it: I edit something in the .cpp where the tests sit and start a run/debug. If there were changes and a build is made, there will likely be a crash.
The crash will after any amount of tests run which seems random. Usually, it happens after around 1800-2600 tests (out of ~2800). With an increasing amount of tests, there seems to be an increased chance in the run crashing. So I assume there will be a point where I can't run the tests anymore because this error will definitely happen.
In the C/C++ Unit view I see all the tests that ran. All of them have the green check even the last one that seems to make the run crash- at least most of the time. Sometimes it shows the blue "play"-button as if the test were still running, yet in the debug view it states "terminated".
That is about everything I know so far and have observed so any help is greatly appreciated.
I have some code which successfully iterates over a list of wi-fi networks, and provides feedback about available networks. The essential calls shown here...
WlanOpenHandle(WLAN_API_VERSION, NULL, &dwVersion, &hSession);
PWLAN_INTERFACE_INFO_LIST pInterfaceInfoList = NULL;
WlanEnumInterfaces(hSession, NULL, &pInterfaceInfoList);
for(int i ...)
{
PWLAN_AVAILABLE_NETWORK_LIST pAvailableNetworkList = NULL;
WlanGetAvailableNetworkList(hSession, &interfaceGUID,
WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_ADHOC_PROFILES |
WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_MANUAL_HIDDEN_PROFILES,
NULL, &pAvailableNetworkList);
for(int j ...)
{
WLAN_AVAILABLE_NETWORK network = pAvailableNetworkList->Network[j];
:
}
}
This all works fine, and inside the inner loop I'm able to access all of the attributes that I need, such as signal strength, security flags, etc via the network data structure.
One thing that I am not able to obtain is information regarding connection status, such as AUTHENTICATING or AUTHENTICATION_FAILED, etc, so I have tried to introduce another call inside the loop as follows...
CM_CONNECTION_DETAILS connectionDetails;
memset(&connectionDetails, 0, sizeof(CM_CONNECTION_DETAILS));
connectionDetails.Version = CM_CURRENT_VERSION;
const char* ccp = reinterpret_cast<const char*>(network.dot11Ssid.ucSSID);
mbstowcs(connectionDetails.szName, &ccp[0], network.dot11Ssid.uSSIDLength);
DWORD dwCount = sizeof(CM_CONNECTION_DETAILS);
CM_RESULT cmr = CmGetConnectionDetailsByName(connectionDetails.szName,
&connectionDetails, &dwCount);
if (cmr == CMRE_SUCCESS)
{
:
}
Upon calling the CmGetConnectionDetailsByName() function, the details inside the CM_CONNECTION_DETAILS structure look correct (name and version), but the function returns with CMRE_INVALID_CONNECTION and the structure is not populated.
I haven't been able to find any examples of this call being successful (only a couple of references to the call returning the same CMRE_INVALID_CONNECTION code).
Does anyone have any experience of using the call successfully, or alternatively suggest a better way to find out the connection status of a network (ie if AUTHENTICATION is in progress or if AUTHENTICATION failed, etc)?
[I'm using Visual Studio 2013 C++ (native Windows app, not MFC), the target is 32-bit and Unicode, running on Windows Compact 2013]
The function below doesn't quite give me the fine control that I was looking for, but it does at least give me the opportunity to find out the state a particular interface. This means that I can find out if the interface is currently in the process or authenticating, and depending whether the final state is connected or disconnected, I can find out if authentication was successful or not.
WLAN_INTERFACE_STATE getNetworkState(HANDLE hSession, GUID* pGUID, std::wstring& wsState, bool bReportState=true)
{
WLAN_INTERFACE_STATE result = wlan_interface_state_not_ready;
DWORD dwDataSize;
void* pData;
DWORD dwErrorCode = WlanQueryInterface(hSession, pGUID, wlan_intf_opcode_interface_state, NULL, &dwDataSize, &pData, NULL);
if (dwErrorCode == ERROR_SUCCESS && pData != NULL)
{
WLAN_INTERFACE_STATE* pState = reinterpret_cast<WLAN_INTERFACE_STATE*>(pData);
if (pState != NULL)
{
switch (*pState)
{
case wlan_interface_state_not_ready: wsState = L"NOT_READY"; break;
case wlan_interface_state_connected: wsState = L"CONNECTED"; break;
case wlan_interface_state_ad_hoc_network_formed: wsState = L"AD_HOC_NETWORK_FORMED"; break;
case wlan_interface_state_disconnecting: wsState = L"DISCONNECTING"; break;
case wlan_interface_state_disconnected: wsState = L"DISCONNECTED"; break;
case wlan_interface_state_associating: wsState = L"ASSOCIATING"; break;
case wlan_interface_state_discovering: wsState = L"DISCOVERING"; break;
case wlan_interface_state_authenticating: wsState = L"AUTHENTICATING"; break;
}
result = *pState;
}
WlanFreeMemory(pData);
}
return result;
}
A limitation of this check, is that it doesn't readily support multiple connections on the same interface, This query doesn't allow us to query to which of the connections the status refers.
If I arrive at a better solution, I will report it here.
In the Xcode 5 (and probably 4) project settings -
How can we find out what 'Compiler Default' actually resolves to for the Apple LLVM - Language - C++ setting?
According to the "Quick Help Inspector" in Xcode 5.0.2, the current "Compiler Default" is "GNU++98", which corresponds to the compiler option "-std=gnu++98".
It can also be seen in the compiler source code (http://clang.llvm.org/doxygen/CompilerInvocation_8cpp_source.html, line 01057):
01033 if (LangStd == LangStandard::lang_unspecified) {
01034 // Based on the base language, pick one.
01035 switch (IK) {
01036 case IK_None:
01037 case IK_AST:
01038 case IK_LLVM_IR:
01039 llvm_unreachable("Invalid input kind!");
01040 case IK_OpenCL:
01041 LangStd = LangStandard::lang_opencl;
01042 break;
01043 case IK_CUDA:
01044 LangStd = LangStandard::lang_cuda;
01045 break;
01046 case IK_Asm:
01047 case IK_C:
01048 case IK_PreprocessedC:
01049 case IK_ObjC:
01050 case IK_PreprocessedObjC:
01051 LangStd = LangStandard::lang_gnu99;
01052 break;
01053 case IK_CXX:
01054 case IK_PreprocessedCXX:
01055 case IK_ObjCXX:
01056 case IK_PreprocessedObjCXX:
01057 LangStd = LangStandard::lang_gnucxx98;
01058 break;
01059 }
01060 }