MCPcopy Create free account
hub / github.com/SimHacker/micropolis / LoadStaticRuleData

Method LoadStaticRuleData

MicropolisCore/src/CellEngine/src/cellengine.cpp:882–910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

880
881
882void CellEngine::LoadStaticRuleData(
883 const char *stream)
884{
885 QUAD magic;
886
887 if (stream == NULL) {
888 ruleSize = 0;
889 neighborhood = 0;
890 } else {
891
892 // XXX: Make this byte order independent!!!
893
894 magic = *(long *)stream;
895 magic = SWAPLONG(magic);
896 if (magic != (LONG)0xCAC0CAC0) return;
897 stream += sizeof(long);
898
899 neighborhood = *(long *)stream;
900 neighborhood = SWAPLONG(neighborhood);
901 stream += sizeof(long);
902
903 ruleSize = *(long *)stream;
904 ruleSize = SWAPLONG(ruleSize);
905 stream += sizeof(long);
906 }
907
908 rule = (Byte *)stream;
909 ruleStatic = 1;
910}
911
912
913void CellEngine::SetRuleTable(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected