本文整理汇总了C++中csArray类的典型用法代码示例。如果您正苦于以下问题:C++ csArray类的具体用法?C++ csArray怎么用?C++ csArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了csArray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SetVerify
void pawsSummaryWindow::SetVerify( csArray<psCharVerificationMesg::Attribute> stats,
csArray<psCharVerificationMesg::Attribute> skills )
{
statsList->Clear();
skillsList->Clear();
for ( size_t x = 0; x < skills.GetSize(); x++ )
{
if (skills[x].value)
{
pawsListBoxRow* row = skillsList->NewRow();
pawsTextBox* name = (pawsTextBox*)row->GetColumn(0);
name->SetText( skills[x].name );
pawsTextBox* val = (pawsTextBox*)row->GetColumn(1);
val->FormatText( "%d", skills[x].value );
}
}
for ( size_t x = 0; x < stats.GetSize(); x++ )
{
if (stats[x].value)
{
pawsListBoxRow* row = statsList->NewRow();
pawsTextBox* name = (pawsTextBox*)row->GetColumn(0);
name->SetText( stats[x].name );
pawsTextBox* val = (pawsTextBox*)row->GetColumn(1);
val->FormatText( "%d", stats[x].value );
}
}
serverStatus->SetText(PawsManager::GetSingleton().Translate("Verification complete"));
}
开发者ID:garinh,项目名称:planeshift,代码行数:34,代码来源:pawssummary.cpp
示例2: LoadChildWidgets
bool PawsManager::LoadChildWidgets( const char* widgetFile, csArray<pawsWidget *> &loadedWidgets )
{
bool errors=false;
loadedWidgets.DeleteAll();
csString fullPath = localization->FindLocalizedFile(widgetFile);
csRef<iDocumentNode> topNode = ParseWidgetFile( fullPath );
if (!topNode) return false;
csRef<iDocumentNodeIterator> iter = topNode->GetNodes();
while ( iter->HasNext() )
{
csRef<iDocumentNode> node = iter->Next();
if ( node->GetType() != CS_NODE_ELEMENT )
continue;
// This is a widget so read it's factory to create it.
pawsWidget * widget = LoadWidget(node);
if (widget)
loadedWidgets.Push(widget);
else
errors = true;
}
return (!errors);
}
开发者ID:garinh,项目名称:planeshift,代码行数:26,代码来源:pawsmanager.cpp
示例3: CS_ASSERT
void csBSPTree::Build (csTriangle* triangles, csPlane3* planes,
size_t num_triangles, const csVector3* vertices,
const csArray<int>& triidx)
{
CS_ASSERT (triidx.GetSize () > 0);
if (triidx.GetSize () == 1)
{
splitters.Push (triidx[0]);
return;
}
size_t idx = FindBestSplitter (triangles, planes, num_triangles, vertices,
triidx);
CS_ASSERT (idx != (size_t)-1);
splitters.Push (triidx[idx]);
csArray<int> left;
csArray<int> right;
size_t i;
split_plane = planes[triidx[idx]];
for (i = 0 ; i < triidx.GetSize () ; i++)
if (i != idx)
{
int idxi = triidx[i];
csTriangle& trj = triangles[idxi];
int cla = ClassifyPlane (split_plane, vertices[trj.a]);
int clb = ClassifyPlane (split_plane, vertices[trj.b]);
int clc = ClassifyPlane (split_plane, vertices[trj.c]);
if ((cla == -clb && cla != 0) ||
(cla == -clc && cla != 0) ||
(clb == -clc && clb != 0))
{
// There is a split.
left.Push (idxi);
right.Push (idxi);
}
else
{
if (cla == -1 || clb == -1 || clc == -1)
left.Push (idxi);
else if (cla == 1 || clb == 1 || clc == 1)
right.Push (idxi);
else
splitters.Push (idxi);
}
}
if (left.GetSize () > 0)
{
child1 = TreeNodes()->Alloc ();
child1->Build (triangles, planes, num_triangles, vertices, left);
}
if (right.GetSize () > 0)
{
child2 = TreeNodes()->Alloc ();
child2->Build (triangles, planes, num_triangles, vertices, right);
}
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:57,代码来源:bsptree.cpp
示例4: AddEnoughRecords
void psNetMsgProfiles::AddEnoughRecords(csArray<psOperProfile*> & arr, int neededIndex, const char * desc)
{
while (neededIndex >= (int)arr.GetSize())
{
csStringFast<100> fullDesc = GetMsgTypeName((int)arr.GetSize()) + "-" + csStringFast<100>(desc);
psOperProfile * newProf = new psOperProfile(fullDesc);
arr.Push(newProf);
profs.Push(newProf);
}
}
开发者ID:diana-coman,项目名称:Eulora-client,代码行数:10,代码来源:netprofile.cpp
示例5: GetAllGMEventsForPlayer
int GMEventManager::GetAllGMEventsForPlayer (PID playerID,
csArray<int>& completedEvents,
int& runningEventAsGM,
csArray<int>& completedEventsAsGM)
{
int runningEvent = -1, id, index=0;
GMEvent* gmEvent;
completedEvents.DeleteAll();
completedEventsAsGM.DeleteAll();
if ((gmEvent = GetGMEventByGM(playerID, RUNNING, index)))
{
runningEventAsGM = gmEvent->id;
}
else
{
runningEventAsGM = -1;
}
index = 0;
do
{
gmEvent = GetGMEventByGM(playerID, COMPLETED, index);
if (gmEvent)
{
id = gmEvent->id;
completedEventsAsGM.Push(id);
}
}
while (gmEvent);
index = 0;
gmEvent = GetGMEventByPlayer(playerID, RUNNING, index);
if (gmEvent)
runningEvent = gmEvent->id;
index = 0;
do
{
gmEvent = GetGMEventByPlayer(playerID, COMPLETED, index);
if (gmEvent)
{
id = gmEvent->id;
completedEvents.Push(id);
}
}
while (gmEvent);
return (runningEvent);
}
开发者ID:garinh,项目名称:planeshift,代码行数:51,代码来源:gmeventmanager.cpp
示例6: WriteProgram
void csPixelShaderParser::WriteProgram (
const csArray<csPSProgramInstruction>& instrs,
csString& str) const
{
for(size_t i = 0; i < instrs.GetSize (); i++)
{
const csPSProgramInstruction& instr = instrs.Get (i);
csString line;
GetInstructionLine (instr, line);
str << line;
str << '\n';
}
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:14,代码来源:ps1_parser.cpp
示例7: SetUV
void csFurStrand::SetUV( const csArray<csGuideFur> &guideFurs,
const csArray<csGuideFurLOD> &guideFursLOD )
{
csVector2 strandUV(0);
for ( size_t j = 0 ; j < GUIDE_HAIRS_COUNT ; j ++ )
if (guideHairsRef[j].index < guideFurs.GetSize() )
strandUV += guideHairsRef[j].distance *
guideFurs.Get(guideHairsRef[j].index).uv;
else
strandUV += guideHairsRef[j].distance *
guideFursLOD.Get(guideHairsRef[j].index - guideFurs.GetSize()).uv;
uv = strandUV;
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:15,代码来源:furdata.cpp
示例8: ParseMaterialPalette
bool csTerrainObjectLoader::ParseMaterialPalette (iDocumentNode *node,
iLoaderContext *ldr_context, csArray<iMaterialWrapper*>& palette)
{
csRef<iDocumentNodeIterator> it = node->GetNodes ();
while (it->HasNext ())
{
csRef<iDocumentNode> child = it->Next ();
if (child->GetType () != CS_NODE_ELEMENT) continue;
const char *value = child->GetValue ();
csStringID id = xmltokens.Request (value);
switch (id)
{
case XMLTOKEN_MATERIAL:
{
const char* matname = child->GetContentsValue ();
csRef<iMaterialWrapper> mat = ldr_context->FindMaterial (matname);
if (!mat)
{
synldr->ReportError (
"crystalspace.terrain.object.loader.materialpalette",
child, "Couldn't find material '%s'!", matname);
return false;
}
palette.Push (mat);
break;
}
default:
synldr->ReportError (
"crystalspace.terrain.object.loader.materialpalette",
child, "Unknown token in materials list!");
}
}
return true;
}
开发者ID:garinh,项目名称:cs,代码行数:34,代码来源:terrainldr.cpp
示例9: Update
void csFurStrand::Update( const csArray<csGuideFur> &guideFurs,
const csArray<csGuideFurLOD> &guideFursLOD, float controlPointsLOD)
{
for ( size_t i = 0 ; i < GetControlPointsCount(controlPointsLOD); i++ )
{
controlPoints[i] = csVector3(0);
for ( size_t j = 0 ; j < GUIDE_HAIRS_COUNT ; j ++ )
if ( guideHairsRef[j].index < guideFurs.GetSize() )
controlPoints[i] += guideHairsRef[j].distance *
(guideFurs.Get(guideHairsRef[j].index).controlPoints[i]);
else
controlPoints[i] += guideHairsRef[j].distance * (guideFursLOD.Get
(guideHairsRef[j].index - guideFurs.GetSize()).controlPoints[i]);
}
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:16,代码来源:furdata.cpp
示例10: CalculatePointSegment
bool csBox3::ProjectOutline (const csVector3& origin,
int axis, float where, csArray<csVector2>& poly) const
{
int idx = CalculatePointSegment (origin);
const Outline &ol = outlines[idx];
int num_array = MIN (ol.num, 6);
int i;
for (i = 0 ; i < num_array ; i++)
{
csVector3 isect;
if (!csIntersect3::SegmentAxisPlane (origin, GetCorner (ol.vertices[i]),
axis, where, isect))
return false;
csVector2 v;
switch (axis)
{
case CS_AXIS_X:
v.x = isect.y;
v.y = isect.z;
break;
case CS_AXIS_Y:
v.x = isect.x;
v.y = isect.z;
break;
case CS_AXIS_Z:
v.x = isect.x;
v.y = isect.y;
break;
}
poly.Push (v);
}
return true;
}
开发者ID:garinh,项目名称:cs,代码行数:34,代码来源:box.cpp
示例11: FindBestSplitter
size_t csBSPTree::FindBestSplitter (csTriangle* triangles, csPlane3* planes,
size_t /*num_triangles*/, const csVector3* vertices,
const csArray<int>& triidx)
{
size_t i, j;
float mincost = 1000000.0;
size_t minidx = (size_t)-1;
for (i = 0 ; i < triidx.GetSize () ; i++)
{
int cnt_splits = 0;
int cnt_left = 0;
int cnt_right = 0;
csPlane3& pl = planes[triidx[i]];
for (j = 0 ; j < triidx.GetSize () ; j++)
if (i != j)
{
csTriangle& trj = triangles[triidx[j]];
int cla = ClassifyPlane (pl, vertices[trj.a]);
int clb = ClassifyPlane (pl, vertices[trj.b]);
int clc = ClassifyPlane (pl, vertices[trj.c]);
if ((cla == -clb && cla != 0) ||
(cla == -clc && cla != 0) ||
(clb == -clc && clb != 0))
{
// There is a split.
cnt_splits++;
}
else
{
if (cla == -1 || clb == -1 || clc == -1)
cnt_left++;
else if (cla == 1 || clb == 1 || clc == 1)
cnt_right++;
}
}
float split = float (cnt_splits) / float (triidx.GetSize ());
float balance = float (ABS (cnt_left-cnt_right)) / float (triidx.GetSize ());
float cost = 10.0 * split + balance;
if (cost < mincost)
{
minidx = i;
mincost = cost;
}
}
return minidx;
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:46,代码来源:bsptree.cpp
示例12: GetModifiers
bool LootRandomizer::GetModifiers(uint32_t itemID,
csArray<psGMSpawnMods::ItemModifier>& mods)
{
csHash<LootModifier*, uint32_t>::GlobalIterator it =
LootModifiersById.GetIterator();
while(it.HasNext())
{
LootModifier* lootModifier = it.Next();
if(!lootModifier->IsAllowed(itemID))
{
continue;
}
psGMSpawnMods::ItemModifier mod;
mod.name = lootModifier->name;
mod.id = lootModifier->id;
mod.type = lootModifier->mod_id;
mods.Push(mod);
}
return mods.GetSize() != 0;
}
开发者ID:huigou,项目名称:planeshift,代码行数:22,代码来源:lootrandomizer.cpp
示例13: Generate
void csFurStrand::Generate( size_t controlPointsCount,
const csArray<csGuideFur> &guideFurs,
const csArray<csGuideFurLOD> &guideFursLOD )
{
// Allocate control points
this -> controlPointsCount = controlPointsCount;
controlPoints = new csVector3[ controlPointsCount ];
for ( size_t i = 0 ; i < controlPointsCount ; i ++ )
{
controlPoints[i] = csVector3(0);
for ( size_t j = 0 ; j < GUIDE_HAIRS_COUNT ; j ++ )
if ( guideHairsRef[j].index < guideFurs.GetSize() )
controlPoints[i] += guideHairsRef[j].distance *
guideFurs.Get(guideHairsRef[j].index).controlPoints[i];
else
controlPoints[i] += guideHairsRef[j].distance *
guideFursLOD.Get(guideHairsRef[j].index -
guideFurs.GetSize()).controlPoints[i];
}
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:23,代码来源:furdata.cpp
示例14: CalculateCPLife
int CharCreationManager::CalculateCPLife(csArray<uint32_t> &events)
{
int cpCost = 0;
for(size_t li = 0; li < events.GetSize(); li++)
{
CharCreationManager::LifeEventChoiceServer* event;
event = psserver->charCreationManager->FindLifeEvent(events[li]);
if(event)
{
cpCost+=event->cpCost;
}
}
return cpCost;
}
开发者ID:huigou,项目名称:planeshift,代码行数:16,代码来源:creationmanager.cpp
示例15: Multicast
void NetManager::Multicast (MsgEntry* me, const csArray<PublishDestination>& multi, int except, float range)
{
for (size_t i=0; i<multi.GetSize(); i++)
{
if (multi[i].client==except) // skip the exception client to avoid circularity
continue;
Client *c = clients.Find(multi[i].client);
if (c && c->IsReady() )
{
if (range == 0 || multi[i].dist < range)
{
me->clientnum = multi[i].client;
SendMessage(me); // This copies the mem block, so we can reuse.
}
}
}
}
开发者ID:garinh,项目名称:planeshift,代码行数:18,代码来源:netmanager.cpp
示例16: UpdateAssets
bool AssetManager::UpdateAssets (const csArray<BaseAsset>& update)
{
// @@@ Removing assets is not yet supported. At least they will not get unloaded.
// The assets table will be updated however. So a Save/Load will remove the asset.
csRefArray<iAsset> newassets;
// @@@ Remove the collection for removed assets!
for (size_t i = 0 ; i < update.GetSize () ; i++)
{
const BaseAsset& a = update[i];
iAsset* currentAsset = HasAsset (a);
if (currentAsset)
{
newassets.Push (currentAsset);
}
else
{
csString normpath = a.GetNormalizedPath ();
csString file = a.GetFile ();
csString mount = a.GetMountPoint ();
csString colName;
colName.Format ("__col__%d__", colCounter++);
iCollection* collection = engine->CreateCollection (colName);
if (!LoadAsset (normpath, file, mount, collection))
return false;
RegisterModification ();
csRef<IntAsset> asset;
asset.AttachNew (new IntAsset (file, a.IsWritable ()));
asset->SetMountPoint (mount);
asset->SetNormalizedPath (normpath);
asset->SetCollection (collection);
newassets.Push (asset);
}
}
assets = newassets;
return true;
}
开发者ID:Dracophoenix1,项目名称:ares,代码行数:41,代码来源:assetmanager.cpp
示例17: CalculateCPChoices
int CharCreationManager::CalculateCPChoices(csArray<uint32_t> &choices, int fatherMod, int motherMod)
{
int cpCost = 0;
for(size_t ci = 0; ci < choices.GetSize(); ci++)
{
CharCreationManager::CreationChoice* choice = FindChoice(choices[ci]);
if(choice)
{
if(choice->choiceArea == FATHER_JOB)
{
cpCost+= choice->cpCost*fatherMod;
}
else if(choice->choiceArea == MOTHER_JOB)
{
cpCost+= choice->cpCost*motherMod;
}
else
cpCost+= choice->cpCost;
}
}
return cpCost;
}
开发者ID:huigou,项目名称:planeshift,代码行数:23,代码来源:creationmanager.cpp
示例18: strlen
void CanvasCommonBase::csGLPixelFormatPicker::ReadPickerValue (
const char* valuesStr, csArray<int>& values)
{
if ((valuesStr != 0) && (*valuesStr != 0))
{
CS_ALLOC_STACK_ARRAY(char, myValues, strlen (valuesStr) + 1);
strcpy (myValues, valuesStr);
char* currentVal = myValues;
while ((currentVal != 0) && (*currentVal != 0))
{
char* comma = strchr (currentVal, ',');
if (comma != 0) *comma = 0;
char dummy;
int val;
if (sscanf (currentVal, "%d%c", &val, &dummy) == 1)
{
values.Push (val);
}
currentVal = comma ? comma + 1 : 0;
}
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:23,代码来源:glcanvascommon.cpp
示例19: MsgEntry
psCharUploadMessage::psCharUploadMessage(bool verify, const char* name, const char* lastname, int race, int gender,
csArray<uint32_t> choices, int motherMod, int fatherMod, csArray<uint32_t> lifeEvents,
int selectedFace, int selectedHairStyle, int selectedBeardStyle,
int selectedHairColour, int selectedSkinColour, const char* bio, const char* path )
{
msg.AttachNew(new MsgEntry( sizeof(bool) +
strlen(name) * sizeof(char) + 1 +
strlen(lastname) * sizeof(char) + 1 +
sizeof(int32_t) * 11 +
sizeof(int32_t) * choices.GetSize() +
sizeof(int32_t) * lifeEvents.GetSize() +
strlen(bio) * sizeof(char) + 1 +
strlen(path) * sizeof(char) + 1));
msg->SetType(MSGTYPE_CHAR_CREATE_UPLOAD);
msg->Add( verify );
msg->Add( name );
msg->Add( lastname );
msg->Add( (int32_t)race );
msg->Add( (int32_t)gender );
msg->Add( (int32_t)selectedFace );
msg->Add( (int32_t)selectedHairStyle );
msg->Add( (int32_t)selectedBeardStyle );
msg->Add( (int32_t)selectedHairColour );
msg->Add( (int32_t)selectedSkinColour );
msg->Add( (int32_t) choices.GetSize() );
for ( size_t choiceIndex = 0; choiceIndex < choices.GetSize(); choiceIndex++ )
msg->Add( (int32_t)choices[choiceIndex] );
msg->Add( (int32_t) lifeEvents.GetSize() );
for ( size_t lifeIndex = 0; lifeIndex < lifeEvents.GetSize(); lifeIndex++ )
msg->Add( (int32_t)lifeEvents[lifeIndex] );
msg->Add( (int32_t) motherMod );
msg->Add( (int32_t) fatherMod );
msg->Add( bio );
msg->Add( path );
valid = !(msg->overrun);
}
开发者ID:Chettie,项目名称:Eulora-client,代码行数:43,代码来源:charmessages.cpp
示例20: AddPetitions
void pawsPetitionGMWindow::AddPetitions(csArray<psPetitionInfo> &petitions)
{
// figure out the selected petition
if (petitionList->GetRowCount() <= 0)
petitionList->Select(NULL);
int selRow = petitionList->GetSelectedRowNum();
if (selRow != -1)
{
csString escalation = petitionList->GetTextCellValue(selRow, PGMCOL_LVL);
if (escalation.GetData() != NULL)
selectedPet.escalation = atoi(escalation.GetData());
else
selectedPet.escalation = -1;
selectedPet.assignedgm = petitionList->GetTextCellValue(selRow, PGMCOL_GM);
selectedPet.player = petitionList->GetTextCellValue(selRow, PGMCOL_PLAYER);
selectedPet.status = petitionList->GetTextCellValue(selRow, PGMCOL_STATUS);
selectedPet.created = petitionList->GetTextCellValue(selRow, PGMCOL_CREATED);
selectedPet.petition = petitionList->GetTextCellValue(selRow, PGMCOL_PETITION);
selectedPet.online = petitionList->GetTextCellValue(selRow, PGMCOL_ONLINE) == "yes";
}
else
{
selectedPet.escalation = -1;
}
petitionList->Select(NULL);
// Clear the list box and add the user's petitions
petitionList->Clear();
psPetitionInfo info;
petCount = 0;
for (size_t i = 0; i < petitions.GetSize(); i++)
{
info = petitions.Get(i);
petCount++;
// Set the data for this row:
petitionList->NewRow(i);
SetText(i, PGMCOL_LVL, "%d", info.escalation);
SetText(i, PGMCOL_GM, "%s", info.assignedgm.GetDataSafe());
SetText(i, PGMCOL_PLAYER, "%s", info.player.GetData());
SetText(i, PGMCOL_ONLINE, "%s", (info.online ? "yes" : "no"));
SetText(i, PGMCOL_STATUS, "%s", info.status.GetData());
SetText(i, PGMCOL_CREATED, "%s", info.created.GetData());
SetText(i, PGMCOL_PETITION, "%s", info.petition.GetData());
// reselect the petition
if (selectedPet.escalation != -1)
{
if (selectedPet.created == info.created
&& selectedPet.player == info.player)
{
petitionList->Select(petitionList->GetRow(i));
}
}
}
// make absolutely sure that there are petitions
if (petCount <= 0)
{
petitionList->NewRow(0);
SetText(0, 1, PawsManager::GetSingleton().Translate("No Petitions"));
}
}
开发者ID:randomcoding,项目名称:PlaneShift-PSAI,代码行数:65,代码来源:pawspetitiongmwindow.cpp
注:本文中的csArray类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论