mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-26 10:30:54 +00:00
Fixed: Strict aliasing warnings
This commit is contained in:
parent
34520c8f29
commit
e30ba1d186
4 changed files with 43 additions and 15 deletions
|
@ -2041,17 +2041,21 @@ NLMISC_COMMAND(entity, "Create an entity on the user or just remove it if Form n
|
|||
node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E"+toString("%d", slot)+":P"+toString("%d", CLFECOMMON::PROPERTY_ORIENTATION), false);
|
||||
if(node)
|
||||
{
|
||||
float dir = (float)atan2(UserEntity->front().y, UserEntity->front().x);
|
||||
prop = (sint64 *)(&dir);
|
||||
node->setValue64(*prop);
|
||||
union C64BitsRot
|
||||
{
|
||||
sint64 i64;
|
||||
float f;
|
||||
};
|
||||
|
||||
C64BitsRot rot;
|
||||
rot.f = (float)atan2(UserEntity->front().y, UserEntity->front().x);
|
||||
node->setValue64(rot.i64);
|
||||
}
|
||||
// Set Mode
|
||||
node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E"+toString("%d", slot)+":P"+toString("%d", CLFECOMMON::PROPERTY_MODE), false);
|
||||
if(node)
|
||||
{
|
||||
MBEHAV::EMode m = MBEHAV::NORMAL;
|
||||
prop = (sint64 *)&m;
|
||||
node->setValue64(*prop);
|
||||
node->setValue64((sint64)MBEHAV::NORMAL);
|
||||
EntitiesMngr.updateVisualProperty(0, slot, CLFECOMMON::PROPERTY_MODE);
|
||||
}
|
||||
// Set Visual Properties
|
||||
|
@ -2842,8 +2846,17 @@ NLMISC_COMMAND(orient, "Orient an entity", "Slot: [1-254] orient(degree) [dt(tic
|
|||
fromString(args[2], dt);
|
||||
// Write the position in the DB.
|
||||
float fRot= (float)(rot*Pi/180.f);
|
||||
uint64 val= *(uint32*)(&fRot);
|
||||
IngameDbMngr.setProp("Entities:E" + toString(slot) + ":P"+toString(CLFECOMMON::PROPERTY_ORIENTATION), val);
|
||||
|
||||
union C64BitsRot
|
||||
{
|
||||
sint64 i64;
|
||||
float f;
|
||||
};
|
||||
|
||||
C64BitsRot r;
|
||||
r.f = fRot;
|
||||
|
||||
IngameDbMngr.setProp("Entities:E" + toString(slot) + ":P"+toString(CLFECOMMON::PROPERTY_ORIENTATION), r.i64);
|
||||
// Update the position.
|
||||
EntitiesMngr.updateVisualProperty(NetMngr.getCurrentServerTick()+dt, slot, CLFECOMMON::PROPERTY_ORIENTATION);
|
||||
}
|
||||
|
|
|
@ -2584,8 +2584,16 @@ void CEntityManager::logPropertyChange(CLFECOMMON::TCLEntityId who, const CStage
|
|||
// Orientation
|
||||
else if(propLoged[i]==CLFECOMMON::PROPERTY_ORIENTATION)
|
||||
{
|
||||
float rot= *(float*)(&value);
|
||||
valStr= toString("%d", sint32(rot*180/Pi));
|
||||
union C64BitsRot
|
||||
{
|
||||
sint64 i64;
|
||||
float f;
|
||||
};
|
||||
|
||||
C64BitsRot rot;
|
||||
rot.i64 = value;
|
||||
|
||||
valStr= toString("%d", sint32(rot.f*180/Pi));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4905,11 +4905,10 @@ CEntityCL *CEditor::createEntity(uint slot, const NLMISC::CSheetId &sheetId, con
|
|||
node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E"+toString("%d", slot)+":P"+toString("%d", CLFECOMMON::PROPERTY_MODE), false);
|
||||
if(node)
|
||||
{
|
||||
MBEHAV::EMode m = MBEHAV::NORMAL;
|
||||
prop = (sint64 *)&m;
|
||||
node->setValue64(*prop);
|
||||
node->setValue64((sint64)MBEHAV::NORMAL);
|
||||
EntitiesMngr.updateVisualProperty(0, slot, CLFECOMMON::PROPERTY_MODE);
|
||||
}
|
||||
|
||||
// Set Visual Properties
|
||||
SPropVisualA visualA;
|
||||
//visualA.PropertySubData.LTrail = 1;
|
||||
|
|
|
@ -789,10 +789,18 @@ bool CUserEntity::mode(MBEHAV::EMode m)
|
|||
case MBEHAV::COMBAT:
|
||||
case MBEHAV::COMBAT_FLOAT:
|
||||
{
|
||||
union C64BitsRot
|
||||
{
|
||||
sint64 i64;
|
||||
float f;
|
||||
};
|
||||
|
||||
C64BitsRot rot;
|
||||
|
||||
// Compute the angle
|
||||
const string propName = toString("SERVER:Entities:E%d:P%d", _Slot, CLFECOMMON::PROPERTY_ORIENTATION);
|
||||
sint64 ang = NLGUI::CDBManager::getInstance()->getDbProp(propName)->getValue64();
|
||||
_TargetAngle = *(float *)(&ang);
|
||||
rot.i64 = NLGUI::CDBManager::getInstance()->getDbProp(propName)->getValue64();
|
||||
_TargetAngle = rot.f;
|
||||
|
||||
// Initialize controls for the combat.
|
||||
UserControls.startCombat();
|
||||
|
|
Loading…
Reference in a new issue