void C4ObjectInfoCore::Default(C4ID n_id, C4DefList *pDefs, const char *cpNames) { // Def C4Def *pDef=NULL; if (pDefs) pDef = pDefs->ID2Def(n_id); // Defaults id=n_id; Participation=1; Rank=0; Experience=0; Rounds=0; DeathCount=0; Birthday=0; TotalPlayingTime=0; SCopy("Clonk",Name,C4MaxName); SCopy("Clonk",TypeName,C4MaxName); sRankName.Copy("Clonk"); sNextRankName.Clear(); NextRankExp=0; DeathMessage[0]='\0'; *PortraitFile=0; Age=0; ExtraData.Reset(); // Type if (pDef) SCopy(pDef->GetName(),TypeName,C4MaxName); // Name if (cpNames) { // Name file reference if (SSearchNoCase(cpNames,C4CFN_Names)) SCopy(GetAName(cpNames),Name,C4MaxName); // Name list else { SCopySegment(cpNames,Random(SCharCount(0x0A,cpNames)),Name,0x0A,C4MaxName+1); SClearFrontBack(Name); SReplaceChar(Name,0x0D,0x00); } if (!Name[0]) SCopy("Clonk",Name,C4MaxName); } #ifdef C4ENGINE if (pDefs) UpdateCustomRanks(pDefs); #endif // Physical Physical.Default(); if (pDef) Physical = pDef->Physical; Physical.PromotionUpdate(Rank); // Old format }
// --------------------------------------------------------------------------- // // ----------- void bToolTextEdition::clic(CGPoint pt, int count){ _bTrace_("bToolTextEdition::clic",true); bStdToolPres::clic(pt,count); bArray* ga; bArray runs(sizeof(bGenericXMLBaseElement*)); bGenericXMLBaseElement *run,*gm,*elt; bGenericGeoElement* o=NULL; int i,n=_gapp->layersAccessCtx()->count(); CGPoint p; bGenericStyle* _styl; int _fld; set_obj(NULL); get_clic(&p); for(i=n;i>0;i--){ _styl=_gapp->layersAccessCtx()->get(i); if(!_styl){ continue; } ga=_styl->objsatpoint(&p,true); if(!ga){ continue; } if(ga->count()<=0){ delete ga; continue; } if(ga->count()>1){ delete ga; break; } ga->get(1,&o); delete ga; break; } if(!o){ _styl=NULL; return; } bGenericUnit* scl=_gapp->scaleMgr()->get(); _styl->get_styleruns(runs,o,scl->coef(),1); char val[_values_length_max_]; bGenericType *tp=_gapp->typesMgr()->get(o->getType()); _fld=0; for(int i=1;i<=runs.count();i++){ runs.get(i,&run); gm=_gapp->classMgr()->NthElement(run,1,"text"); if(!gm){ continue; } elt=_gapp->classMgr()->NthElement(gm,1,"field"); if(!elt){ continue; } elt->getvalue(val); _fld=tp->fields()->get_index(val); break; } if(!_fld){ _te_("no text field"); _styl=NULL; return; } set_obj(o); o->getValue(_fld,val); if(GetAName(val,"",true)){ CGRect bnds; _styl->rect(o,&bnds); _gapp->mapIntf()->inval(bnds); bEventLog log(_gapp, getbundle(), kTextEditionMessageID, GetSignature(this)); o->setValue(_fld,&val); log.close(); _styl->rect(o,&bnds); _gapp->mapIntf()->inval(bnds); } set_obj(NULL); }