本文整理汇总了C++中GET_INT函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_INT函数的具体用法?C++ GET_INT怎么用?C++ GET_INT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_INT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load_string
void C_THISCLASS::load_config(unsigned char *data, int len)
{
int pos=0;
if (data[pos] == 1)
{
pos++;
load_string(effect_exp[0],data,pos,len);
load_string(effect_exp[1],data,pos,len);
load_string(effect_exp[2],data,pos,len);
}
else
{
char buf[769];
if (len-pos >= 768)
{
memcpy(buf,data+pos,768);
pos+=768;
buf[768]=0;
effect_exp[2].assign(buf+512);
buf[512]=0;
effect_exp[1].assign(buf+256);
buf[256]=0;
effect_exp[0].assign(buf);
}
}
if (len-pos >= 4) { blend=GET_INT(); pos+=4; }
if (len-pos >= 4) { subpixel=GET_INT(); pos+=4; }
}
示例2: func_substring
CELL func_substring(CELL frame)
{
CELL string = FV0;
CELL start = FV1;
CELL end = FV2;
if (!STRINGP(string)) {
return make_exception("expects a string");
}
if (!INTP(start)) {
return make_exception("expects a non-negative start index");
}
if (!INTP(end)) {
return make_exception("expects a non-negative end index");
}
size_t len = GET_STRING(string)->len;
size_t starti = GET_INT(start);
size_t endi = GET_INT(end);
if (starti < 0 || starti > len) {
return make_exception("start index %d out of range [0,%d]", starti, len);
}
if (endi < starti || endi > len) {
return make_exception("end index %d out of range [%d,%d]", endi, starti, len);
}
gc_root_1("func_substring", string);
CELL result = make_string_raw(endi - starti);
gc_unroot();
memcpy(GET_STRING(result)->data, GET_STRING(string)->data + starti, endi - starti);
return result;
}
示例3: improve_skill
/* code for skill improvement through use */
void improve_skill(struct char_data *ch, int skill, int chance)
{
int percent = GET_SKILL(ch, skill);
int newpercent, max;
char skillbuf[MAX_STRING_LENGTH];
char mybuf[256];
max = max_lvl_skill[1][spells[find_skill_num_def(skill)].difficulty][(int) GET_LEVEL(ch)];
if (percent >= max || IS_NPC(ch))
return;
if (number(1, (chance * 50)) > (GET_WIS(ch) + GET_INT(ch)))
return;
newpercent = 1;
if (number(1, 120) <= GET_WIS(ch))
newpercent++;
if (number(1, 120) <= GET_INT(ch))
newpercent++;
percent += newpercent;
percent = MIN(percent, max);
SET_SKILL(ch, skill, percent);
if (newpercent) {
sprintf(mybuf, "SKILLIMPROVE: %s improved skill %s, int = %d, wis = %d, improved by = %d, now = %d", GET_NAME(ch), spells[find_skill_num_def(skill)].command, GET_INT(ch), GET_WIS(ch), newpercent, percent);
mudlog(mybuf, 'D', COM_IMMORT, TRUE);
sprintf(skillbuf, "{RYou feel your skill in {W%s {Rimproving.{x\r\n", spells[find_skill_num_def(skill)].command);
send_to_char(skillbuf, ch);
}
}
示例4: LFUN
CAMLprim value LFUN(sqr_nrm2_stub)(
value vSTABLE, value vN, value vOFSX, value vINCX, value vX)
{
CAMLparam1(vX);
integer GET_INT(N), GET_INT(INCX);
REAL res;
VEC_PARAMS(X);
caml_enter_blocking_section(); /* Allow other threads */
if (Bool_val(vSTABLE)) {
#ifndef LACAML_DOUBLE
res = scnrm2_(&N, X_data, &INCX);
#else
res = dznrm2_(&N, X_data, &INCX);
#endif
res *= res;
} else {
COMPLEX cres = FUN(dotc)(&N, X_data, &INCX, X_data, &INCX);
res = cres.r;
}
caml_leave_blocking_section(); /* Disallow other threads */
CAMLreturn(caml_copy_double(res));
}
示例5: process_player_kick_packet
// process a player kick packet
void process_player_kick_packet(ubyte *data, header *hinfo)
{
int player_num,from_player,ban,reason;
short player_id;
int offset = HEADER_LENGTH;
// get the address of the guy who is to be kicked
GET_SHORT(player_id);
GET_INT(ban);
GET_INT(reason);
player_num = find_player_id(player_id);
PACKET_SET_SIZE();
// only the server should ever receive a request to kick a guy
Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER);
// determine who sent the packet
from_player = find_player_id(hinfo->id);
// check to see if this guy is allowed to make such a request
if((from_player == -1) || !multi_kick_can_kick(&Net_players[from_player]) ){
nprintf(("Network","Received a kick request from an invalid player!!\n"));
}
// otherwise, process the request fully
else {
// make sure we have a valid player to kick
if(player_num == -1){
nprintf(("Network","Received request to kick an unknown player!\n"));
} else {
// will handle all the rest of the details
multi_kick_player(player_num,ban,reason);
}
}
}
示例6: GET_INT
void [email protected]()
{
int maxIndex = first + count - 1, i;
int maxTextureUnit = GET_INT(TRS_CTX_CTEXUNIT_MAX);
void* origUnit = GET(TRS_CTX_CTEXUNIT);
/* Save all the enabled arrays that are not bound to any buffers */
SAVE_ARRAY(GET_BOOL(TRS_CTX_VERTEX_ENABLED) && GET(TRS_CTX_VERTEX_BINDING) == 0, GET(TRS_CTX_VERTEX_POINTER), GET_INT(TRS_CTX_VERTEX_STRIDE), GET_INT(TRS_CTX_VERTEX_TYPE), GET_INT(TRS_CTX_VERTEX_SIZE));
SAVE_ARRAY(GET_BOOL(TRS_CTX_NORMAL_ENABLED) && GET(TRS_CTX_NORMAL_BINDING) == 0, GET(TRS_CTX_NORMAL_POINTER), GET_INT(TRS_CTX_NORMAL_STRIDE), GET_INT(TRS_CTX_NORMAL_TYPE), 3);
SAVE_ARRAY(GET_BOOL(TRS_CTX_COLOR_ENABLED) && GET(TRS_CTX_COLOR_BINDING) == 0, GET(TRS_CTX_COLOR_POINTER), GET_INT(TRS_CTX_COLOR_STRIDE), GET_INT(TRS_CTX_COLOR_TYPE), GET_INT(TRS_CTX_COLOR_SIZE));
SAVE_ARRAY(GET_BOOL(TRS_CTX_POINTSIZE_ENABLED) && GET(TRS_CTX_POINTSIZE_BINDING) == 0, GET(TRS_CTX_POINTSIZE_POINTER), GET_INT(TRS_CTX_POINTSIZE_STRIDE), GET_INT(TRS_CTX_POINTSIZE_TYPE), 1);
SAVE_ARRAY(GET_BOOL(TRS_CTX_MATRIXINDEX_ENABLED) && GET(TRS_CTX_MATRIXINDEX_BINDING) == 0, GET(TRS_CTX_MATRIXINDEX_POINTER), GET_INT(TRS_CTX_MATRIXINDEX_STRIDE), GET_INT(TRS_CTX_MATRIXINDEX_TYPE), GET_INT(TRS_CTX_MATRIXINDEX_SIZE));
SAVE_ARRAY(GET_BOOL(TRS_CTX_WEIGHT_ENABLED) && GET(TRS_CTX_WEIGHT_BINDING) == 0, GET(TRS_CTX_WEIGHT_POINTER), GET_INT(TRS_CTX_WEIGHT_STRIDE), GET_INT(TRS_CTX_WEIGHT_TYPE), GET_INT(TRS_CTX_WEIGHT_SIZE));
maxTextureUnit = TR_MAX(GL_TEXTURE0, maxTextureUnit);
for (i = GL_TEXTURE0; i < maxTextureUnit + 1; i++)
{
SET(TRS_CTX_CTEXUNIT, i);
SAVE_ARRAY(GET_BOOL(TRS_CTX_CTEXUNIT_TEXCOORD_ENABLED) && GET(TRS_CTX_CTEXUNIT_TEXCOORD_BINDING) == 0,
GET(TRS_CTX_CTEXUNIT_TEXCOORD_POINTER),
GET_INT(TRS_CTX_CTEXUNIT_TEXCOORD_STRIDE),
GET_INT(TRS_CTX_CTEXUNIT_TEXCOORD_TYPE),
GET_INT(TRS_CTX_CTEXUNIT_TEXCOORD_SIZE));
}
SET(TRS_CTX_CTEXUNIT, origUnit);
}
示例7: write_mobile_espec
int write_mobile_espec(mob_vnum mvnum, struct char_data *mob, FILE *fd)
{
if (GET_ATTACK(mob) != 0)
fprintf(fd, "BareHandAttack: %d\n", GET_ATTACK(mob));
if (GET_STR(mob) != 0)
fprintf(fd, "Str: %d\n", GET_STR(mob));
if (GET_ADD(mob) != 0)
fprintf(fd, "StrAdd: %d\n", GET_ADD(mob));
if (GET_DEX(mob) != 0)
fprintf(fd, "Dex: %d\n", GET_DEX(mob));
if (GET_INT(mob) != 0)
fprintf(fd, "Int: %d\n", GET_INT(mob));
if (GET_WIS(mob) != 0)
fprintf(fd, "Wis: %d\n", GET_WIS(mob));
if (GET_CON(mob) != 0)
fprintf(fd, "Con: %d\n", GET_CON(mob));
if (GET_CHA(mob) != 0)
fprintf(fd, "Cha: %d\n", GET_CHA(mob));
if(GET_CLASS(mob) != CLASS_NPC_OTHER)
fprintf(fd, "Class: %d\n", GET_CLASS(mob));
if(GET_RACE(mob) != RACE_NPC_OTHER)
fprintf(fd, "Race: %d\n", GET_RACE(mob));
if(GET_MOB_WEIGHT(mob))
fprintf(fd, "Weight: %d\n", GET_MOB_WEIGHT(mob));
fprintf(fd, "Size: %d\n", GET_MOB_SIZE(mob));
fputs("E\n", fd);
return TRUE;
}
示例8: func_integer_to_char
CELL func_integer_to_char(CELL frame)
{
if (!(INTP(FV0) && GET_INT(FV0) >= 0 && GET_INT(FV0) <= 255)) {
return make_exception("expects an <integer> in [0,255]");
}
return make_char(GET_INT(FV0));
}
示例9: LFUN
CAMLprim value LFUN(mat_axpy_stub)(
value vALPHA,
value vM, value vN,
value vXR, value vXC, value vX,
value vYR, value vYC, value vY)
{
CAMLparam2(vX, vY);
integer GET_INT(M), GET_INT(N);
if (M > 0 && N > 0) {
CREATE_NUMBER(ALPHA);
MAT_PARAMS(X);
MAT_PARAMS(Y);
INIT_NUMBER(ALPHA);
caml_enter_blocking_section();
if (rows_X == M && rows_Y == M) {
integer MN = M * N;
FUN(axpy)(&MN, &ALPHA, X_data, &integer_one, Y_data, &integer_one);
} else {
NUMBER *X_last = X_data + rows_X * N;
do {
FUN(axpy)(&M, &ALPHA, X_data, &integer_one, Y_data, &integer_one);
X_data += rows_X;
Y_data += rows_Y;
} while (X_data != X_last);
}
caml_leave_blocking_section();
}
CAMLreturn(Val_unit);
}
示例10: android_view_GraphicBuffer_lockCanvas
static jboolean android_view_GraphicBuffer_lockCanvas(JNIEnv* env, jobject,
jlong wrapperHandle, jobject canvas, jobject dirtyRect) {
GraphicBufferWrapper* wrapper =
reinterpret_cast<GraphicBufferWrapper*>(wrapperHandle);
if (!wrapper) {
return JNI_FALSE;
}
sp<GraphicBuffer> buffer(wrapper->buffer);
Rect rect;
if (dirtyRect) {
rect.left = GET_INT(dirtyRect, gRectClassInfo.left);
rect.top = GET_INT(dirtyRect, gRectClassInfo.top);
rect.right = GET_INT(dirtyRect, gRectClassInfo.right);
rect.bottom = GET_INT(dirtyRect, gRectClassInfo.bottom);
} else {
rect.set(Rect(buffer->getWidth(), buffer->getHeight()));
}
void* bits = NULL;
status_t status = buffer->lock(LOCK_CANVAS_USAGE, rect, &bits);
if (status) return JNI_FALSE;
if (!bits) {
buffer->unlock();
return JNI_FALSE;
}
ssize_t bytesCount = buffer->getStride() * bytesPerPixel(buffer->getPixelFormat());
SkBitmap bitmap;
bitmap.setInfo(SkImageInfo::Make(buffer->getWidth(), buffer->getHeight(),
convertPixelFormat(buffer->getPixelFormat()),
kPremul_SkAlphaType),
bytesCount);
if (buffer->getWidth() > 0 && buffer->getHeight() > 0) {
bitmap.setPixels(bits);
} else {
bitmap.setPixels(NULL);
}
SET_INT(canvas, gCanvasClassInfo.mSurfaceFormat, buffer->getPixelFormat());
INVOKEV(canvas, gCanvasClassInfo.setNativeBitmap, reinterpret_cast<jlong>(&bitmap));
SkRect clipRect;
clipRect.set(rect.left, rect.top, rect.right, rect.bottom);
SkCanvas* nativeCanvas = GraphicsJNI::getNativeCanvas(env, canvas);
nativeCanvas->clipRect(clipRect);
if (dirtyRect) {
INVOKEV(dirtyRect, gRectClassInfo.set,
int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
}
return JNI_TRUE;
}
示例11: affect_total
/* walk even though they could fly at will. */
void affect_total(struct char_data *ch)
{
struct affected_type *af;
int i,j;
char buff[200];
for(i=0; i<MAX_WEAR; i++) {
if (ch->equipment[i])
for(j=0; j<MAX_OBJ_AFFECT; j++)
affect_modify(ch, ch->equipment[i]->affected[j].location,
(int)ch->equipment[i]->affected[j].modifier,
ch->equipment[i]->obj_flags.bitvector, FALSE);
}
for(af = ch->affected; af; af=af->next)
if(af->type != SPELL_FLY)
affect_modify(ch, af->location, (int) af->modifier, af->bitvector,
FALSE);
ch->tmpabilities = ch->abilities;
for(i=0; i<MAX_WEAR; i++) {
if (ch->equipment[i])
for(j=0; j<MAX_OBJ_AFFECT; j++)
affect_modify(ch, ch->equipment[i]->affected[j].location,
(int) ch->equipment[i]->affected[j].modifier,
ch->equipment[i]->obj_flags.bitvector, TRUE);
}
for(af = ch->affected; af; af=af->next)
if(af->type != SPELL_FLY)
affect_modify(ch, af->location, (int)af->modifier,
af->bitvector, TRUE);
/* Make certain values are between 0..25, not < 0 and not > 25! */
i = ((!IS_PC(ch)) ? 25 :18); /* fuck polies */
GET_DEX(ch) = MAX(3,MIN(GET_DEX(ch), i));
GET_INT(ch) = MAX(3,MIN(GET_INT(ch), i));
GET_WIS(ch) = MAX(3,MIN(GET_WIS(ch), i));
GET_CON(ch) = MAX(3,MIN(GET_CON(ch), i));
GET_STR(ch) = MAX(3,GET_STR(ch));
if (!IS_PC(ch)) {
GET_STR(ch) = MIN(GET_STR(ch), i);
} else if(GET_RACE(ch) != RACE_OGRE) {
if (GET_STR(ch) > 18) {
GET_ADD(ch) = 100;
GET_STR(ch) = 18;
}
} else {
/* warning: I am counting on ChangeStrength() */
/* to be working for this to be safe :) */
GET_STR(ch) = MIN(22,GET_STR(ch));
}
}
示例12: if
void MainWindow::readSettings()
{
QVariant v;
QSettings s;
s.beginGroup("Units");
if (s.value("unit_system").toString() == "metric") {
prefs.unit_system = METRIC;
prefs.units = SI_units;
} else if (s.value("unit_system").toString() == "imperial") {
prefs.unit_system = IMPERIAL;
prefs.units = IMPERIAL_units;
} else {
prefs.unit_system = PERSONALIZE;
GET_UNIT("length", length, units::FEET, units::METERS);
GET_UNIT("pressure", pressure, units::PSI, units::BAR);
GET_UNIT("volume", volume, units::CUFT, units::LITER);
GET_UNIT("temperature", temperature, units::FAHRENHEIT, units::CELSIUS);
GET_UNIT("weight", weight, units::LBS, units::KG);
}
s.endGroup();
s.beginGroup("DisplayListColumns");
GET_BOOL("CYLINDER", visible_cols.cylinder);
GET_BOOL("TEMPERATURE", visible_cols.temperature);
GET_BOOL("TOTALWEIGHT", visible_cols.totalweight);
GET_BOOL("SUIT", visible_cols.suit);
GET_BOOL("NITROX", visible_cols.nitrox);
GET_BOOL("OTU", visible_cols.otu);
GET_BOOL("MAXCNS", visible_cols.maxcns);
GET_BOOL("SAC", visible_cols.sac);
s.endGroup();
s.beginGroup("TecDetails");
GET_BOOL("po2graph", pp_graphs.po2);
GET_BOOL("pn2graph", pp_graphs.pn2);
GET_BOOL("phegraph", pp_graphs.phe);
GET_DOUBLE("po2threshold", pp_graphs.po2_threshold);
GET_DOUBLE("pn2threshold", pp_graphs.pn2_threshold);
GET_DOUBLE("phethreshold", pp_graphs.phe_threshold);
GET_BOOL("mod", mod);
GET_DOUBLE("modppO2", mod_ppO2);
GET_BOOL("ead", ead);
GET_BOOL("redceiling", profile_red_ceiling);
GET_BOOL("dcceiling", profile_dc_ceiling);
GET_BOOL("calcceiling", profile_calc_ceiling);
GET_BOOL("calcceiling3m", calc_ceiling_3m_incr);
GET_BOOL("calcalltissues", calc_all_tissues);
GET_INT("gflow", gflow);
GET_INT("gfhigh", gfhigh);
set_gf(prefs.gflow, prefs.gfhigh);
s.endGroup();
s.beginGroup("Display");
v = s.value(QString("divelist_font"));
if (v.isValid())
prefs.divelist_font = strdup(v.toString().toUtf8().data());
}
示例13: func_make_string
CELL func_make_string(CELL frame)
{
if (!(INTP(FV0) && GET_INT(FV0) >= 0)) {
return make_exception("1st argument expects non-negative integer");
}
if (FC == 2 && !CHARP(FV1)) {
return make_exception("2nd argument expects character");
}
return make_string_filled(GET_INT(FV0), (FC == 2) ? GET_CHAR(FV1) : -1);
}
示例14: pnm_getActualTraits
FUNC_STATUS WORD pnm_getActualTraits (
IP_XFORM_HANDLE hXform, /* in: handle for xform */
DWORD dwInputAvail, /* in: # avail bytes in input buf */
PBYTE pbInputBuf, /* in: ptr to input buffer */
PDWORD pdwInputUsed, /* out: # bytes used from input buf */
PDWORD pdwInputNextPos,/* out: file-pos to read from next */
PIP_IMAGE_TRAITS pInTraits, /* out: input image traits */
PIP_IMAGE_TRAITS pOutTraits) /* out: output image traits */
{
PPNM_INST g;
HANDLE_TO_PTR (hXform, g);
/* If there is no header, we'll report no usage of input */
*pdwInputUsed = 0;
/* Parse the header for decode operations. */
if (!g->fIsEncode) {
unsigned char c;
unsigned int maxval;
GET_CHAR(&c);
if (c!='P') {
return IP_INPUT_ERROR;
}
GET_CHAR(&c);
if (c=='4') {
/* PBM */
g->traits.iComponentsPerPixel=1;
g->traits.iBitsPerPixel=1;
} else if (c=='5') {
/* PGM */
g->traits.iComponentsPerPixel=1;
g->traits.iBitsPerPixel=0;
} else if (c=='6') {
/* PPM */
g->traits.iComponentsPerPixel=3;
g->traits.iBitsPerPixel=0;
} else {
/* "Plain" (all-ASCII) formats (1-3) not (yet) supported. */
return IP_INPUT_ERROR;
}
GET_INT(&g->traits.iPixelsPerRow);
GET_INT(&g->traits.lNumRows);
if (!g->traits.iBitsPerPixel) {
GET_INT(&maxval);
while (maxval) {
g->traits.iBitsPerPixel++;
maxval>>=1;
}
}
示例15: load_config
void C_THISCLASS::load_config(unsigned char *data, int len)
{
int pos=0;
int x=0;
if (len-pos >= 4) { effect=GET_INT(); pos+=4; }
if (len-pos >= 4) { num_colors=GET_INT(); pos+=4; }
if (num_colors <= 16) while (len-pos >= 4 && x < num_colors) { colors[x++]=GET_INT(); pos+=4; }
else num_colors=1;
if (len-pos >= 4) { size=GET_INT(); pos+=4; }
if (len-pos >= 4) { rot=GET_INT(); pos+=4; }
}