本文整理汇总了C++中Floor::getTile方法的典型用法代码示例。如果您正苦于以下问题:C++ Floor::getTile方法的具体用法?C++ Floor::getTile怎么用?C++ Floor::getTile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floor
的用法示例。
在下文中一共展示了Floor::getTile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: move
void Swan::move(Floor& floor){
location deltaPos, current, next;
int input;
current = getPos();
do{
deltaPos.r = 0;
deltaPos.c = 0;
next = current;
input = rand()%4;
if(input == 0){
deltaPos.r--;
}
else if(input == 1){
deltaPos.c--;
}
else if(input == 2){
deltaPos.r++;
}
else if(input == 3){
deltaPos.c++;
}
next.r += deltaPos.r;
next.c += deltaPos.c;
}while(invalidMove(next, floor));
floor.setTile(current.r, current.c, getTileBelow());
if(getTileBelow() == 'P')
floor.setTile(current.r, current.c, ' ');
setTileBelow(floor.getTile(next.r, next.c));
setPos(next);
floor.setTile(next.r, next.c, 'S');
}
示例2: invalidMove
bool Swan::invalidMove(location next, Floor floor){
location floorSize = floor.getSize();
char nextTile = floor.getTile(next.r, next.c);
if(nextTile == '#'){
return true;
}
if(nextTile == 'D'){
return true;
}
if(nextTile == 'E'){
return true;
}
if(next.r<0 || next.c<0 || next.r>floorSize.r || next.c>floorSize.c){
return true;
}
return false;
}
示例3: recv_landscape
void KServer::recv_landscape( vce::VSint32 floorID, vce::VSint32 x1,vce::VSint32 y1,vce::VSint32 x2,vce::VSint32 y2)
{
if( !m_authenticationSuccess )return;
if( !m_pc )return;
Floor *fl = World::getFloor(floorID);
if(!fl)return;
TileType data[4000];
int ind = 0;
for(int y=y1; y < y2; y++ ){
for(int x=x1; x < x2; x++){
data[ind++] = fl->getTile(Coord(x,y)).typeID;
if( ind == ARRAYLEN(data)) break;
}
if( ind == ARRAYLEN(data)) break;
}
send_landscapeResult( floorID, x1,y1,x2,y2, data, ind );
}