| 839 | |
| 840 | |
| 841 | void CellEngine::LoadRuleData( |
| 842 | const char *stream) |
| 843 | { |
| 844 | QUAD magic; |
| 845 | |
| 846 | if (stream == NULL) { |
| 847 | ruleSize = 0; |
| 848 | neighborhood = 0; |
| 849 | } else { |
| 850 | |
| 851 | // XXX: Make this byte order independent!!! |
| 852 | |
| 853 | magic = *(long *)stream; |
| 854 | magic = SWAPLONG(magic); |
| 855 | if (magic != (QUAD)0xCAC0CAC0) return; |
| 856 | stream += sizeof(long); |
| 857 | |
| 858 | neighborhood = *(long *)stream; |
| 859 | neighborhood = SWAPLONG(neighborhood); |
| 860 | stream += sizeof(long); |
| 861 | |
| 862 | ruleSize = *(long *)stream; |
| 863 | ruleSize = SWAPLONG(ruleSize); |
| 864 | stream += sizeof(long); |
| 865 | } |
| 866 | |
| 867 | if ((rule != NULL) && |
| 868 | (!ruleStatic)) { |
| 869 | delete [] rule; |
| 870 | rule = NULL; |
| 871 | ruleStatic = 0; |
| 872 | } // if |
| 873 | |
| 874 | if (ruleSize != 0) { |
| 875 | rule = new Byte[ruleSize]; |
| 876 | memcpy(rule, stream, ruleSize); |
| 877 | ruleStatic = 0; |
| 878 | } // if |
| 879 | } |
| 880 | |
| 881 | |
| 882 | void CellEngine::LoadStaticRuleData( |
nothing calls this directly
no outgoing calls
no test coverage detected