http://apps.hi.baidu.com/share/detail/20397333
现在介绍下植物大战僵尸的存档:
用户的存档被存放在userdata目录下的userX.dat中(以二进制的方式存放),第一个用户的存档时user1.dat,第二个用户的存档时user2.dat,以此类推
存档中部分数据信息如下:
前10个字节代表金钱
第473个字节代表肥料数,最小为232,此时肥料数为0
第477个字节代表农药数,最小为232,此时农药数为0
第521个字节代表巧克力数,最小为232,此时巧克力数为0
第529个字节代表智慧古树的肥料,最小232
第213个字节代表古树高度
每种植物占用88个字节,其中:
第1字节: 植物种类
范围: [0, 47]
第九字节: 植物所在列
范围: [0, 7]
第13字节: 植物所在行
范围: [0, 3]
以下是存档修改的源代码:
#include
#include
#define TOTAL 5044
#define START 820
#define SIZE 88
int info(void);
int getChoice(void);
int main(int argc, char *argv[])
{
int data[TOTAL] = {
12,0,0,0,34,0,0,0,100,247,0,0,2,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,10,0,0,
0,10,0,0,0,10,0,0,0,10,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
0,2,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,4,0,0,0,1,0,0,0,1,0,0,0,1,0,0,
0,10,0,0,0,1,0,0,0,1,0,0,0,5,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,4,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,141,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,
0,2,0,0,0,2,0,0,0,6,0,0,0,3,0,0,0,1,0,0,0,3,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,2,0,0,
0,2,0,0,0,3,0,0,0,3,0,0,0,25,0,0,0,0,0,0,0,0,0,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