MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / WriteToRAM

Method WriteToRAM

Source/Scripting/scriptparams.cpp:525–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525void ScriptParam::WriteToRAM(std::vector<char> &data) const {
526 int int_type = type_;
527 memwrite(&int_type, sizeof(int), 1, data);
528 switch (int_type) {
529 case INT:
530 memwrite(&i_val_, sizeof(int), 1, data);
531 break;
532 case FLOAT:
533 memwrite(&f_val_, sizeof(float), 1, data);
534 break;
535 case STRING:
536 case JSON:
537 int str_len = str_val_.size();
538 memwrite(&str_len, sizeof(int), 1, data);
539 memwrite(&str_val_[0], sizeof(char), str_len, data);
540 break;
541 }
542 editor_.WriteToRAM(data);
543}
544
545std::string ScriptParam::AsString() const {
546 std::ostringstream oss;

Callers 1

WriteScriptParamsToRAMFunction · 0.80

Calls 2

memwriteFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected