MCPcopy Create free account
hub / github.com/MergHQ/CRYENGINE / WriteValue

Method WriteValue

Code/CryEngine/CryAction/Network/ScriptSerialize.cpp:516–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

514}
515
516bool CScriptSerialize::WriteValue(const char* name, EScriptSerializeType type, TSerialize ser, IScriptTable* pTable)
517{
518 bool ok = false;
519 switch (type)
520 {
521 case eSST_Bool:
522 {
523 bool temp = false;
524 if (ok = pTable->GetValue(name, temp))
525 ser.Value(name, temp /*, 'bool'*/);
526 else if (!pTable->HaveValue(name))
527 {
528 ser.Value(name, temp);
529 ok = true;
530 }
531 }
532 break;
533 case eSST_Float:
534 {
535 float temp = 0;
536 if (ok = pTable->GetValue(name, temp))
537 ser.Value(name, temp);
538 else if (!pTable->HaveValue(name))
539 {
540 ser.Value(name, temp);
541 ok = true;
542 }
543 }
544 break;
545 case eSST_Int8:
546 {
547 int temp1;
548 int8 temp2 = 0;
549 if (ok = pTable->GetValue(name, temp1))
550 {
551 if (temp1 < -128 || temp1 > 127)
552 ok = false;
553 else
554 {
555 temp2 = temp1;
556 ser.Value(name, temp2, 'i8');
557 }
558 }
559 else if (!pTable->HaveValue(name))
560 {
561 ser.Value(name, temp2, 'i8');
562 ok = true;
563 }
564 }
565 break;
566 case eSST_Int16:
567 {
568 int temp1;
569 int16 temp2 = 0;
570 if (ok = pTable->GetValue(name, temp1))
571 {
572 if (temp1 < -32768 || temp1 > 32767)
573 ok = false;

Callers 1

SerializeFunctionMethod · 0.45

Calls 4

stringClass · 0.85
GetValueMethod · 0.45
ValueMethod · 0.45
HaveValueMethod · 0.45

Tested by

no test coverage detected