/*复制瓶罐*/ Bottle* Bottle::copyBottle(char *_mapId) { char newIntId[LONG_MID_VALUE_LENGTH + 1] = {'\0'}; //新地图id; Bottle* newBottle; /* 追加地图id,为了保证副本道具id的唯一性*/ strncpy(newIntId,_mapId,strlen(_mapId)); strncat(newIntId,"_",strlen("_")); strncat(newIntId,id,strlen(id)); newBottle = new Bottle(typeId,lifeVal,hurt,brushStyle,bloodPre,magicPre,name,dropNum,dropStage,photoId); newBottle->setPiexPt(pt); newBottle->setInstId(newIntId); return newBottle; }
/*复制瓶罐<重载函数,在读取地图配置文件里面用>*/ Bottle* Bottle::copyBottle(Point _pt) { char _id[MONSTER_MID_LENGTH + 1] = {'\0'}; Bottle* newBottle; newBottle = new Bottle(typeId,lifeVal,hurt,brushStyle,bloodPre,magicPre,name,dropNum,dropStage,photoId); strncpy(_id,typeId,strlen(typeId)); strncat(_id,"_",strlen("_")); count++; appendNum(_id,count,4); newBottle->setPiexPt(_pt); newBottle->setInstId(_id); return newBottle; }