Michcol94
Member
- Joined
- Sep 2, 2021
- Messages
- 105
- Reaction score
- 18
I added everything that had to do with the tfs 1.5 engine to tfs 1.5 by nekiro downgrade 8.6 and it gives me an error in the code, I don't know why and how to solve it, please help
error in Visual Studio :
If you want to transform a modern TFS lambda expression back to a legacy style (as in TFS 1.5 by Nekiro), you must use a direct member function call instead of a lambda expression. Assuming you have a method in the Game class that handles the modal window response, the transformation might look something like this:
In a newer version of TFS, using a lambda expression, it could look like this:
In the older style of TFS 1.5 by Nekiro, you must use a direct method call with the appropriate arguments. Example:
In this case, addGameTask is a method that takes a pointer to a member function of the Game class and the arguments to be passed to that function. The &Game:layerAnswerModalWindow parameter is a pointer to the Game member function to be called.
It is important to note that such a conversion requires that the playerAnswerModalWindow method is defined in the Game class and can be called this way. If your TFS version doesn't have this method, you'll need to implement it first.
Additionally, the syntax of addGameTask may vary depending on the specific setup of your TFS server, so make sure you adapt it to the requirements of your environment.
C++:
void ProtocolGame::parseModalWindowAnswer(NetworkMessage& msg)
{
uint32_t id = msg.get<uint32_t>();
uint8_t button = msg.getByte();
uint8_t choice = msg.getByte();
g_dispatcher.addTask(
[=, playerID = player->getID()]() { g_game.playerAnswerModalWindow(playerID, id, button, choice); });
}
// error linie [=, playerID = player->getID()]() { g_game.playerAnswerModalWindow(playerID, id, button, choice); });
error C2664 „void Dispatcher::addTask(Task *)”: argument cannot be converted 1 z „ProtocolGame:arseModalWindowAnswer::<lambda_aeffd7d866a31bc265328313ceec14a2>” down „Task *” theforgottenserver C:\Users\Majke\Desktop\GRA\LEGACY-DRAGON-BALL-0.277\source — kopia modalwindow\src\protocolgame.cpp 1113
Post automatically merged:
If you want to transform a modern TFS lambda expression back to a legacy style (as in TFS 1.5 by Nekiro), you must use a direct member function call instead of a lambda expression. Assuming you have a method in the Game class that handles the modal window response, the transformation might look something like this:
In a newer version of TFS, using a lambda expression, it could look like this:
C++:g_dispatcher.addTask( [=, playerID = player->getID()]() { g_game.playerAnswerModalWindow(playerID, id, button, choice); });
In the older style of TFS 1.5 by Nekiro, you must use a direct method call with the appropriate arguments. Example:
C++:addGameTask(&Game:layerAnswerModalWindow, player->getID(), id, button, choice);
In this case, addGameTask is a method that takes a pointer to a member function of the Game class and the arguments to be passed to that function. The &Game:layerAnswerModalWindow parameter is a pointer to the Game member function to be called.
It is important to note that such a conversion requires that the playerAnswerModalWindow method is defined in the Game class and can be called this way. If your TFS version doesn't have this method, you'll need to implement it first.
Additionally, the syntax of addGameTask may vary depending on the specific setup of your TFS server, so make sure you adapt it to the requirements of your environment.
Last edited: