maket socket

This commit is contained in:
2024-04-16 19:52:04 +05:00
parent 8ad7c2e9e6
commit 9213c4fa57
29 changed files with 200 additions and 41 deletions
+75 -1
View File
@@ -4,10 +4,12 @@
#include "cppGI.h"
#include "Kismet/GameplayStatics.h"
#include "Misc/paths.h"
#include "commands_model.h"
#include "Engine/levelstreamingdynamic.h"
/*for working tarray::Contains*/
CSocket* soc;
/*for working tarray::Contains*/
bool operator==(const Fcppcoords& c1, const Fcppcoords& c2) {
return c1.flat == c2.flat &&
c1.floor == c2.floor &&
@@ -94,6 +96,7 @@ void UcppGI::cppLvlManage(UObject* WorldContextObject, Fcppcoords currentCoords,
return;
}
void UcppGI::cppCoordsEq(Fcppcoords coords, Fcppcoords coords1, bool relevantMinus2, bool fastEq, bool& flat_, bool& type_, bool& zone_, bool& house_, bool& section_, bool& floor_, bool& fullEq)
{
bool* outLvl[6] = { &flat_, &type_, &zone_, &house_, &section_, &floor_ };
@@ -118,3 +121,74 @@ void UcppGI::cppCoordsEq(Fcppcoords coords, Fcppcoords coords1, bool relevantMin
}
}
void UcppGI::avoidAutoState()
{
if (!soc)return;
DECLARE_CMD(CMD_NOP, cmd);
sendCommand(*soc, cmd);
}
void UcppGI::makeSocket(FString ip, int port)
{
char* ipc=NULL;
wcstombs(ipc, *ip, ip.Len());
soc = new CSocket(ipc, port);
}
void UcppGI::setColor(uint8 code, FColor color)
{
if (!soc)return;
DECLARE_CMD(CMD_SET_COLOR, cmd);
cmd.code = code;
cmd.r = color.R, cmd.g=color.G, cmd.b=color.B;
sendCommand(*soc, cmd);
}
void UcppGI::setLight(int house, int floor, int strip, uint8 state)
{
if (!soc)return;
if (strip < 0) {
if (floor < 0) {
if (house < 0) {
DECLARE_CMD(CMD_SET_ALL_STATE, cmd);
cmd.state = state;
sendCommand(*soc, cmd);
return;
}
DECLARE_CMD(CMD_SET_BUILDING_STATE, cmd);
cmd.state = state;
cmd.building = house;
sendCommand(*soc, cmd);
return;
}
DECLARE_CMD(CMD_SET_FLOOR_STATE, cmd);
cmd.state = state;
cmd.building = house;
cmd.floor = floor;
sendCommand(*soc, cmd);
return;
}
DECLARE_CMD(CMD_SET_ROOM_STATE, cmd);
cmd.state = state;
cmd.building = house;
cmd.floor = floor;
cmd.strip = strip;
sendCommand(*soc, cmd);
}
void UcppGI::setPartState(uint8 part, uint8 state)
{
if (!soc)return;
DECLARE_CMD(CMD_SET_PART_MODE, cmd);
cmd.mode = state;
cmd.part = part;
sendCommand(*soc, cmd);
}