本文整理汇总了C++中Thing::Inside方法的典型用法代码示例。如果您正苦于以下问题:C++ Thing::Inside方法的具体用法?C++ Thing::Inside怎么用?C++ Thing::Inside使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thing
的用法示例。
在下文中一共展示了Thing::Inside方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Place
int Structure::Place(Cell *targ) {
int alt=-100000, malt = 0;
if(stgr[struct_type][material][2][0][0] == NULL) return 0;
switch(struct_type) {
case(STRUCT_RAMP):
case(STRUCT_WALL): {
if(targ->Terrain() ==TERRAIN_LOWWATER || targ->Terrain() ==TERRAIN_WATER
|| targ->Terrain() == TERRAIN_OCEAN) return 0;
}break;
case(STRUCT_BRIDGE): {
int ctr;
flying = 1;
for(ctr=0; ctr<12 && alt<=-100000; ctr+=2) {
Thing *tmpt = targ->Next(ctr)->Inside(0);
while(tmpt != NULL) {
if(tmpt->Type() == THING_STRUCT &&
((Structure*)tmpt)->StructType() == STRUCT_BRIDGE) {
alt = ((Structure*)tmpt)->altitude;
// printf("Set relative bridge alt to %d.\r\n", alt);
}
tmpt = tmpt->Inside(0);
}
}
if(alt <= -100000 && targ->Terrain() !=TERRAIN_LOWWATER
&& targ->Terrain() !=TERRAIN_WATER
&& targ->Terrain() != TERRAIN_OCEAN) {
Thing *tmpt = targ;
while(tmpt->Inside(0) != NULL) tmpt = tmpt->Inside(0);
if(tmpt->Type() == THING_CELL || tmpt->Type() == THING_STRUCT) {
alt = tmpt->Height();
break;
}
return 0;
}
if(alt <= -100000) return 0;
}break;
}
if(alt <= -100000) alt = targ->Height();
else malt = alt-targ->Height();
if(malt < 0) return 0;
// printf("Attempting to claim for struct!\r\n");
if(!(targ->Claim(this, alt, height, 0, malt))) return 0;
// printf("Attempting to enter for struct!\r\n");
if(!(targ->Enter(this, alt, height, 0, malt))) {
targ->UnClaim(this);
return 0;
}
// printf("Success!\r\n");
targ->UnClaim(this);
location[0] = targ;
Changed[thingnum] = 1;
if(struct_type == STRUCT_BRIDGE) {
altitude = alt;
// printf("Placing Struct at altitude %d\r\n", altitude);
}
InitNeighbors();
return 1;
}