这篇教程C++ CASSERT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ CASSERT函数的具体用法?C++ CASSERT怎么用?C++ CASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CASSERT函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: DeleteMissionvoid DeleteMission(CampaignOptions *co){ CASSERT( co->MissionIndex < (int)co->Setting.Missions.size, "invalid mission index"); MissionTerminate(CampaignGetCurrentMission(co)); CArrayDelete(&co->Setting.Missions, co->MissionIndex); if (co->MissionIndex >= (int)co->Setting.Missions.size) { co->MissionIndex = MAX(0, (int)co->Setting.Missions.size - 1); }}
开发者ID:Wuzzy2,项目名称:cdogs-sdl,代码行数:12,
示例2: CBitmapSurface_Compositestatic CStatusCBitmapSurface_Composite(CSurface *_this, CUInt32 x, CUInt32 y, CUInt32 width, CUInt32 height, pixman_image_t *src, pixman_image_t *mask, pixman_operator_t op){ /* declarations */ CBitmap *image; /* assertions */ CASSERT((_this != 0)); CASSERT((src != 0)); CASSERT((mask != 0)); /* get the image */ image = ((CBitmapSurface *)_this)->image; /* perform the composite synchronously */ CMutex_Lock(image->lock); { /* ensure the image data isn't locked */ if(image->locked) { CMutex_Unlock(image->lock); return CStatus_InvalidOperation_ImageLocked; } /* perform the composite */ pixman_composite (op, src, mask, image->image, 0, 0, 0, 0, x, y, width, height); } CMutex_Unlock(image->lock); /* return successfully */ return CStatus_OK;}
开发者ID:bencz,项目名称:DotGnu,代码行数:40,
示例3: NetInputPollvoid NetInputPoll(NetInput *n){ if (n->channel.sock == NULL) { return; } switch (n->channel.state) { case CHANNEL_STATE_CLOSED: CASSERT(false, "Unexpected channel state closed"); return; case CHANNEL_STATE_DISCONNECTED: if (!TryRecvSynAndSendSynAck(n)) { return; } n->channel.state = CHANNEL_STATE_WAIT_HANDSHAKE; // fallthrough case CHANNEL_STATE_WAIT_HANDSHAKE: // listen for ACK if (!NetInputRecvNonBlocking(&n->channel, TryParseAck, &n->channel)) { return; } n->channel.state = CHANNEL_STATE_CONNECTED; // fallthrough case CHANNEL_STATE_CONNECTED: RecvCmd(n); break; default: CASSERT(false, "Unknown channel state"); break; }}
开发者ID:kodephys,项目名称:cdogs-sdl,代码行数:39,
示例4: CPath_EnsureCapacity/*/|*| Ensure the capacity of point and type lists of this path.|*||*| _this - this path|*| count - the total minimum capacity required|*||*| Returns status code./*/static CStatusCPath_EnsureCapacity(CPath *_this, CUInt32 minimum){ /* assertions */ CASSERT((_this != 0)); /* ensure capacity */ _EnsurePathCapacity(_this, minimum); /* return successfully */ return CStatus_OK;}
开发者ID:bencz,项目名称:DotGnu,代码行数:21,
示例5: LogModuleSetLevelvoid LogModuleSetLevel(const LogModule m, const LogLevel l){ switch (m) { case LM_MAIN: llMain = l; break; case LM_NET: llNet = l; break; case LM_INPUT: llInput = l; break; case LM_ACTOR: llActor = l; break; default: CASSERT(false, "Unknown log module"); break; }}
开发者ID:depoorterp,项目名称:cdogs-sdl,代码行数:13,
示例6: WKV_destructorWPRIVATE void * WKV_destructor (void * _self){ struct WKV * const self = _self; /* preconditions */ CASSERT (self); if (VALUE) destroy (VALUE), VALUE = NIL; return (self);}
开发者ID:andbrain,项目名称:warc-tools,代码行数:13,
示例7: CBrush_OnChange/* Handle a change signal. */CINTERNAL voidCBrush_OnChange(CBrush *_this){ /* assertions */ CASSERT((_this != 0)); /* destroy the current pattern, as needed */ if(_this->pattern.image != 0) { pixman_image_destroy(_this->pattern.image); _this->pattern.image = 0; }}
开发者ID:bencz,项目名称:DotGnu,代码行数:14,
示例8: CASSERT/* cook up a Binary key */void SymmetricKeyInfoProvider::CssmKeyToBinary( CssmKey *paramKey, // ignored CSSM_KEYATTR_FLAGS &attrFlags, // IN/OUT BinaryKey **binKey){ CASSERT(mKey.keyClass() == CSSM_KEYCLASS_SESSION_KEY); SymmetricBinaryKey *symBinKey = new SymmetricBinaryKey( mKey.KeyHeader.LogicalKeySizeInBits); copyCssmData(mKey, symBinKey->mKeyData, symBinKey->mAllocator); *binKey = symBinKey;}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:14,
示例9: CPath_Fill/* Fill this path to trapezoids. */CINTERNAL CStatusCPath_Fill(CPath *_this, CTrapezoids *trapezoids){ /* declarations */ CFillMode fillMode; /* assertions */ CASSERT((_this != 0)); CASSERT((trapezoids != 0)); /* get the fill mode */ fillMode = (_this->winding ? CFillMode_Winding : CFillMode_Alternate); /* fill the path */ CStatus_Check (CTrapezoids_Fill (trapezoids, _this->points, _this->types, _this->count, fillMode)); /* return successfully */ return CStatus_OK;}
开发者ID:bencz,项目名称:DotGnu,代码行数:23,
示例10: CBrush_GetPattern/* Get a pattern for this brush. */CINTERNAL CStatusCBrush_GetPattern(CBrush *_this, CPattern *pattern){ /* assertions */ CASSERT((_this != 0)); CASSERT((pattern != 0)); /* create a pattern, as needed */ if(_this->pattern.image == 0) { CStatus_Check (_this->_class->CreatePattern (_this, &(_this->pattern))); } /* get the pattern */ *pattern = _this->pattern; /* return successfully */ return CStatus_OK;}
开发者ID:bencz,项目名称:DotGnu,代码行数:23,
示例11: LogModuleGetLevelLogLevel LogModuleGetLevel(const LogModule m){ switch (m) { case LM_MAIN: return llMain; case LM_NET: return llNet; case LM_INPUT: return llInput; case LM_ACTOR: return llActor; default: CASSERT(false, "Unknown log module"); return LL_ERROR; }}
开发者ID:depoorterp,项目名称:cdogs-sdl,代码行数:13,
示例12: wordAppendvoid wordAppend(char *str, word_ptr w_grp){ word_ptr wptr, wtmp; CASSERT(str != NULL && w_grp != NULL, "wordAppend: NULL argument(s)/n"); wptr = w_grp->next_anagram; /* the first actual word in this group */ CASSERT(wptr != NULL, "no word in a group!/n"); wtmp = newnode(); wtmp->str = strdup(str); CASSERT(wtmp->str, "Out of memory!/n"); wtmp->next = NULL; wtmp->prev_anagram = NULL; wtmp->next_anagram = wptr; wptr->prev_anagram = wtmp; w_grp->next_anagram = wtmp;}
开发者ID:knightr,项目名称:352Assgn10,代码行数:22,
示例13: DeathmatchFinalScoresDrawstatic void DeathmatchFinalScoresDraw(void *data){ UNUSED(data); // This will only draw once const int w = gGraphicsDevice.cachedConfig.Res.x; const int h = gGraphicsDevice.cachedConfig.Res.y; GraphicsBlitBkg(&gGraphicsDevice); // Work out the highest kills int maxKills = 0; for (int i = 0; i < (int)gPlayerDatas.size; i++) { const PlayerData *p = CArrayGet(&gPlayerDatas, i); if (p->kills > maxKills) { maxKills = p->kills; } } // Draw players and their names spread evenly around the screen. CASSERT( gPlayerDatas.size >= 2 && gPlayerDatas.size <= 4, "Unimplemented number of players for deathmatch");#define LAST_MAN_TEXT "Last man standing!" for (int i = 0; i < (int)gPlayerDatas.size; i++) { const Vec2i pos = Vec2iNew( w / 4 + (i & 1) * w / 2, gPlayerDatas.size == 2 ? h / 2 : h / 4 + (i / 2) * h / 2); const PlayerData *p = CArrayGet(&gPlayerDatas, i); DisplayCharacterAndName(pos, &p->Char, p->name); // Kills char s[16]; sprintf(s, "Kills: %d", p->kills); FontStrMask( s, Vec2iNew(pos.x - FontStrW(s) / 2, pos.y + 20), p->kills == maxKills ? colorGreen : colorWhite); // Last man standing? if (p->Lives > 0) { FontStrMask( LAST_MAN_TEXT, Vec2iNew(pos.x - FontStrW(LAST_MAN_TEXT) / 2, pos.y + 30), colorGreen); } }}
开发者ID:Wuzzy2,项目名称:cdogs-sdl,代码行数:51,
示例14: CASSERTvoidAsyncLoop::executeSocketAction( SocketHandle socket, SocketActionMask actionMask ) // nofail{ CASSERT( SA_POLL_IN == CURL_CSELECT_IN ); CASSERT( SA_POLL_OUT == CURL_CSELECT_OUT ); CASSERT( SA_POLL_ERR == CURL_CSELECT_ERR ); CASSERT( sizeof( curl_socket_t ) == sizeof( SocketHandle ) ); try { int stillRunning = 0; CURLMcode multiCurlCode = curl_multi_socket_action( m_multiCurl, ( curl_socket_t ) socket, actionMask, &stillRunning ); raiseIfError( multiCurlCode ); } catch( ... ) { // We cannot fail this method, handle the error and continue. handleBackgroundError(); }}
开发者ID:Bhushan1002,项目名称:SFrame,代码行数:23,
示例15: CHatchBrush_Clone/* Clone this hatch brush. */static CStatusCHatchBrush_Clone(CBrush *_this, CBrush **_clone){ /* declarations */ CHatchBrush *brush; CHatchBrush **clone; /* assertions */ CASSERT((_this != 0)); CASSERT((_clone != 0)); /* get this as a hatch brush */ brush = (CHatchBrush *)_this; /* get the clone as a hatch brush */ clone = (CHatchBrush **)_clone; /* create the clone */ return CHatchBrush_Create (clone, brush->style, brush->foreground, brush->background);}
开发者ID:bencz,项目名称:DotGnu,代码行数:24,
示例16: CASSERTGunDescription *IdGunDescription(const int i){ CASSERT( i >= 0 && i < (int)gGunDescriptions.Guns.size + (int)gGunDescriptions.CustomGuns.size, "Gun index out of bounds"); if (i < (int)gGunDescriptions.Guns.size) { return CArrayGet(&gGunDescriptions.Guns, i); } return CArrayGet( &gGunDescriptions.CustomGuns, i - gGunDescriptions.Guns.size);}
开发者ID:depoorterp,项目名称:cdogs-sdl,代码行数:14,
示例17: PlayerSelectionDrawstatic void PlayerSelectionDraw(void *data){ const PlayerSelectionData *pData = data; GraphicsBlitBkg(&gGraphicsDevice); const int w = gGraphicsDevice.cachedConfig.Res.x; const int h = gGraphicsDevice.cachedConfig.Res.y; int idx = 0; for (int i = 0; i < (int)gPlayerDatas.size; i++, idx++) { const PlayerData *p = CArrayGet(&gPlayerDatas, i); if (!p->IsLocal) { idx--; continue; } if (p->inputDevice != INPUT_DEVICE_UNSET) { MenuDisplay(&pData->menus[idx].ms); } else { Vec2i center = Vec2iZero(); const char *prompt = "Press Fire to join..."; const Vec2i offset = Vec2iScaleDiv(FontStrSize(prompt), -2); switch (GetNumPlayers(false, false, true)) { case 1: // Center of screen center = Vec2iNew(w / 2, h / 2); break; case 2: // Side by side center = Vec2iNew(idx * w / 2 + w / 4, h / 2); break; case 3: case 4: // Four corners center = Vec2iNew( (idx & 1) * w / 2 + w / 4, (idx / 2) * h / 2 + h / 4); break; default: CASSERT(false, "not implemented"); break; } FontStr(prompt, Vec2iAdd(center, offset)); } }}
开发者ID:depoorterp,项目名称:cdogs-sdl,代码行数:49,
示例18: MissionTrySetTilebool MissionTrySetTile(Mission *m, Vec2i pos, unsigned short tile){ if (pos.x < 0 || pos.x >= m->Size.x || pos.y < 0 || pos.y >= m->Size.y) { return false; } CASSERT(m->Type == MAPTYPE_STATIC, "cannot set tile for map type"); switch (tile) { case MAP_WALL: // Check that there are no incompatible doors if (HasDoorOrientedAt(m, Vec2iNew(pos.x - 1, pos.y), 0) || HasDoorOrientedAt(m, Vec2iNew(pos.x + 1, pos.y), 0) || HasDoorOrientedAt(m, Vec2iNew(pos.x, pos.y - 1), 1) || HasDoorOrientedAt(m, Vec2iNew(pos.x, pos.y + 1), 1)) { // Can't place this wall return false; } break; case MAP_DOOR: { // Check that there is a clear passage through this door int isHClear = IsClear(GetTileAt(m, Vec2iNew(pos.x - 1, pos.y))) && IsClear(GetTileAt(m, Vec2iNew(pos.x + 1, pos.y))); int isVClear = IsClear(GetTileAt(m, Vec2iNew(pos.x, pos.y - 1))) && IsClear(GetTileAt(m, Vec2iNew(pos.x, pos.y + 1))); if (!isHClear && !isVClear) { return false; } // Check that there are no incompatible doors if (HasDoorOrientedAt(m, Vec2iNew(pos.x - 1, pos.y), 0) || HasDoorOrientedAt(m, Vec2iNew(pos.x + 1, pos.y), 0) || HasDoorOrientedAt(m, Vec2iNew(pos.x, pos.y - 1), 1) || HasDoorOrientedAt(m, Vec2iNew(pos.x, pos.y + 1), 1)) { // Can't place this door return false; } } break; } const int idx = pos.y * m->Size.x + pos.x; *(unsigned short *)CArrayGet(&m->u.Static.Tiles, idx) = tile; return true;}
开发者ID:alexmustafa,项目名称:cdogs-sdl,代码行数:49,
示例19: NetInputSendMsgvoid NetInputSendMsg( NetInput *n, const int peerIndex, ServerMsg msg, const void *data){ if (!n->server) { return; } CASSERT( peerIndex >= 0 && peerIndex < (int)n->peers.size, "invalid peer index"); // Find the peer and send for (int i = 0; i < (int)n->peers.size; i++) { ENetPeer **peer = CArrayGet(&n->peers, i); if ((int)(*peer)->data == peerIndex) { enet_peer_send(*peer, 0, MakePacket(msg, data)); enet_host_flush(n->server); return; } } CASSERT(false, "Cannot find peer by id");}
开发者ID:evktalo,项目名称:cdogs-sdl,代码行数:24,
示例20: CPath_Initializestatic voidCPath_Initialize(CPath *_this){ /* assertions */ CASSERT((_this != 0)); /* initialize the path */ _this->capacity = 0; _this->count = 0; _this->points = 0; _this->types = 0; _this->winding = 0; _this->newFigure = 1; _this->hasCurves = 0;}
开发者ID:bencz,项目名称:DotGnu,代码行数:15,
示例21: CFiller_ResetCINTERNAL voidCFiller_Reset(CFiller *_this){ /* assertions */ CASSERT((_this != 0)); /* reset the trapezoids */ _this->trapezoids = 0; /* reset the polygon */ CPolygonX_Reset(&(_this->polygon)); /* reset the point array */ CPointArray_Count(_this->array) = 0;}
开发者ID:bencz,项目名称:DotGnu,代码行数:15,
示例22: pb_ostream_from_bufferENetPacket *NetEncode(const GameEventType e, const void *data){ uint8_t buffer[1024]; pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof buffer); const pb_field_t *fields = GameEventGetEntry(e).Fields; const bool status = (data && fields) ? pb_encode(&stream, fields, data) : true; CASSERT(status, "Failed to encode pb"); int msgId = (int)e; ENetPacket *packet = enet_packet_create( &msgId, NET_MSG_SIZE + stream.bytes_written, ENET_PACKET_FLAG_RELIABLE); memcpy(packet->data + NET_MSG_SIZE, buffer, stream.bytes_written); return packet;}
开发者ID:cxong,项目名称:cdogs-sdl,代码行数:15,
示例23: CBitmapSurface_Finalizestatic voidCBitmapSurface_Finalize(CSurface *_this){ /* declarations */ CBitmapSurface *surface; /* assertions */ CASSERT((_this != 0)); /* get this as a bitmap surface */ surface = (CBitmapSurface *)_this; /* finalize the bitmap surface */ CImage_Destroy((CImage **)&(surface->image));}
开发者ID:bencz,项目名称:DotGnu,代码行数:15,
示例24: CBitmapSurface_GetDpiYstatic CStatusCBitmapSurface_GetDpiY(CSurface *_this, CFloat *dpiY){ /* declarations */ CBitmap *image; /* assertions */ CASSERT((_this != 0)); CASSERT((dpiY != 0)); /* get the image */ image = ((CBitmapSurface *)_this)->image; /* get the vertical resolution, synchronously */ CMutex_Lock(image->lock); { *dpiY = image->dpiY; } CMutex_Unlock(image->lock); /* return successfully */ return CStatus_OK;}
开发者ID:bencz,项目名称:DotGnu,代码行数:24,
示例25: GetBulletDrawContextstatic CPicDrawContext GetBulletDrawContext(const int id){ const TMobileObject *obj = CArrayGet(&gMobObjs, id); CASSERT(obj->isInUse, "Cannot draw non-existent mobobj"); // Calculate direction based on velocity const direction_e dir = RadiansToDirection(Vec2iToRadians(obj->vel)); const Pic *pic = CPicGetPic(&obj->tileItem.CPic, dir); CPicDrawContext c; c.Dir = dir; if (pic != NULL) { c.Offset = Vec2iNew( pic->size.x / -2, pic->size.y / -2 - obj->z / Z_FACTOR); } return c;}
开发者ID:NSYXin,项目名称:cdogs-sdl,代码行数:16,
示例26: CheckCampaignDefCompletestatic void CheckCampaignDefComplete(menu_t *menu, void *data){ UNUSED(data); if (gCampaign.IsLoaded) { if (gCampaign.IsError) { // Failed to load campaign; signal that we want to abort MenuSystem *ms = data; ms->hasAbort = true; } CASSERT(gCampaign.IsClient, "campaign is not client"); // Hack to force the menu to exit menu->type = MENU_TYPE_RETURN; }}
开发者ID:depoorterp,项目名称:cdogs-sdl,代码行数:16,
示例27: DestructibleMapObjectIndexint DestructibleMapObjectIndex(const MapObject *mo){ if (mo == NULL) { return 0; } CA_FOREACH(const char *, name, gMapObjects.Destructibles) const MapObject *d = StrMapObject(*name); if (d == mo) { return _ca_index; } CA_FOREACH_END() CASSERT(false, "cannot find destructible map object"); return -1;}
开发者ID:carstene1ns,项目名称:cdogs-sdl,代码行数:16,
示例28: HitItemFuncstatic bool HitItemFunc(TTileItem *ti, void *data){ HitItemData *hData = data; if (!CanHit(hData->Obj->flags, hData->Obj->ActorUID, ti)) { goto bail; } int targetUID = -1; switch (ti->kind) { case KIND_CHARACTER: hData->HitType = HIT_FLESH; targetUID = ((const TActor *)CArrayGet(&gActors, ti->id))->uid; break; case KIND_OBJECT: hData->HitType = HIT_OBJECT; targetUID = ((const TObject *)CArrayGet(&gObjs, ti->id))->uid; break; default: CASSERT(false, "cannot damage target kind"); break; } if (hData->Obj->soundLock > 0 || !HasHitSound( hData->Obj->bulletClass->Power, hData->Obj->flags, hData->Obj->PlayerUID, ti->kind, targetUID, hData->Obj->bulletClass->Special, true)) { hData->HitType = HIT_NONE; } Damage( hData->Obj->vel, hData->Obj->bulletClass->Power, hData->Obj->flags, hData->Obj->PlayerUID, hData->Obj->ActorUID, ti->kind, targetUID, hData->Obj->bulletClass->Special); if (hData->Obj->soundLock <= 0) { hData->Obj->soundLock += SOUND_LOCK_MOBILE_OBJECT; } if (hData->Obj->specialLock <= 0) { hData->Obj->specialLock += SPECIAL_LOCK; }bail: // Whether to produce multiple hits from the same TMobileObject return hData->MultipleHits;}
开发者ID:NSYXin,项目名称:cdogs-sdl,代码行数:47,
注:本文中的CASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CAST_AI函数代码示例 C++ CASE_RETURN_STRING函数代码示例 |