} /*宗教删除规则*/ public int CityAddBuilding(uint city_id, uint peo_id, uint building_id) { uint rel_belong; uint obj_id; int index = lc_ObjGather.GetRelNameMap("STU_CITY_BUILDING"); lc_City city = GetObject <lc_City>(city_id); lc_Building building = GetObject <lc_Building>(building_id); lc_Seer seer = GetObject <lc_Seer>(peo_id); if (peo_id != 0) { if (seer.m_wealth < building.m_cost) { return(0); } seer.m_wealth -= building.m_cost; } if (building.m_belong) { STU_PEO_REL stu_peo_rel = GetRelShip <STU_PEO_REL>(peo_id); rel_belong = stu_peo_rel.rel_id; } else { rel_belong = 0; } STU_CITY_BUILDING stu_city_build = new STU_CITY_BUILDING(city_id, building.obj_id, rel_belong); objgather.relship_list[index].Add(stu_city_build); foreach (var chgnum in building.chglist) { int typeindex = lc_ObjGather.GetObjNameMap(chgnum.objtype); switch (chgnum.objtype) { case "BUILDING": obj_id = building.obj_id; break; case "RELIGION": obj_id = stu_city_build.rel_belong_id; break; default: return(-1); } lc_Object obj = objgather.obj_list[typeindex].Find(delegate(lc_Object temp) { return(temp.obj_id == obj_id); }); obj.ChangeVar <int>(chgnum.varname, chgnum.chgnum); } return(1); } /*城市增加建筑*/
public STU_CITY_BUILDING(STU_CITY_BUILDING temp) : base(temp) { this.city_id = temp.city_id; this.building_id = temp.building_id; this.rel_belong_id = temp.rel_belong_id; }