本文整理汇总了C++中DynamicArray::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicArray::Size方法的具体用法?C++ DynamicArray::Size怎么用?C++ DynamicArray::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicArray
的用法示例。
在下文中一共展示了DynamicArray::Size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RasterPaths
void RasterPaths( DynamicArray<Room>& rooms, Map& map, Map::BlockType block_type )
{
for( int i = 0; i < (int)rooms.Size()-1; i++ )
{
Room r0 = rooms[i];
Room r1 = rooms[i+1];
HCorridor( map, r0.x, r1.x, r0.y, block_type );
VCorridor( map, r0.y, r1.y, r1.x, block_type );
}
}
示例2: RasterRooms
void RasterRooms( DynamicArray<Room>& rooms, Map& map, Map::BlockType block_type )
{
for( int i = 0; i < ((int)rooms.Size()); i++ )
{
printf("NG\n");
Room r = rooms[i];
for( int x = r.x - r.w/2; x < r.x + r.w/2; x++ )
for( int y = r.y - r.h/2; y < r.y + r.h/2; y++ )
{
map.Set( x, y, block_type );
}
}
}
示例3: ConstructRoomMap
Map ConstructRoomMap( Map map, DynamicArray<Room>& rooms )
{
Map ret(map);
mapgen::Fill( ret, 0 );
for( int i = 0; i < (int)rooms.Size(); i++ )
{
for( int x = rooms[i].Left(); x < rooms[i].Right(); x++ )
for( int y = rooms[i].Top(); y < rooms[i].Bot(); y++ )
{
ret.Set( x, y, i+1 );
}
}
RasterPaths( rooms, ret, 9 );
return ret;
}
示例4: GenRooms
// pasarle el mapdata.rooms
void GenRooms( RNG& rng, mapgen::RoomGenConfig cfg, DynamicArray<Room>& list_rooms)
{
int w, h;
w = cfg.map_width;
h = cfg.map_height;
Map map(w, h);
Fill(map, Map::BLOCK_SOLID);
int room_halfw = cfg.room_max_width / 2;
int room_halfh = cfg.room_max_height / 2;
for( int i = 0; i < cfg.num_rooms; i++ )
{
int room_x = rng.uniform( room_halfw+3, w - room_halfw-3 );
int room_y = rng.uniform( room_halfh+3, h - room_halfh-3 );
int room_w = rng.uniform( cfg.room_min_width, cfg.room_max_width );
int room_h = rng.uniform( cfg.room_min_height, cfg.room_max_height );
Room r(room_x, room_y, room_w, room_h);
bool valid_room = true;
if( cfg.overlap_control )
{
for( int j = 0; j < ((int)list_rooms.Size()); j++ )
{
if( r.Intersects( list_rooms[j] ) )
{
valid_room = false;
i--;
break;
}
}
// set valid_room to false if overlaps with any existing room in list_rooms
}
if( valid_room )
{
printf("ROOM %d\n", i);
r.Debug();
list_rooms.Add(r);
}
}
}