本文整理汇总了C++中TemporaryStorageArray类的典型用法代码示例。如果您正苦于以下问题:C++ TemporaryStorageArray类的具体用法?C++ TemporaryStorageArray怎么用?C++ TemporaryStorageArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TemporaryStorageArray类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: UseTextRefStack
/**
* Activate usage of the NewGRF #TextRefStack for the error message.
* @param number of entries to copy from the temporary NewGRF registers
*/
void CommandCost::UseTextRefStack(uint num_registers)
{
extern TemporaryStorageArray<int32, 0x110> _temp_store;
assert(num_registers < lengthof(textref_stack));
this->textref_stack_size = num_registers;
for (uint i = 0; i < num_registers; i++) {
textref_stack[i] = _temp_store.GetValue(0x100 + i);
}
}
开发者ID:ComLock,项目名称:OpenTTD,代码行数:14,代码来源:command.cpp
示例2: PrepareTextRefStackUsage
/**
* Prepare the TTDP compatible string code parsing
* @param numEntries number of entries to copy from the registers
*/
void PrepareTextRefStackUsage(byte numEntries)
{
extern TemporaryStorageArray<int32, 0x110> _temp_store;
_newgrf_textrefstack->ResetStack();
byte *p = _newgrf_textrefstack->stack;
for (uint i = 0; i < numEntries; i++) {
for (uint j = 0; j < 32; j += 8) {
*p = GB(_temp_store.Get(0x100 + i), j, 8);
p++;
}
}
}
开发者ID:oshepherd,项目名称:openttd-progsigs,代码行数:18,代码来源:newgrf_text.cpp
示例3: StartTextRefStackUsage
/**
* Start using the TTDP compatible string code parsing.
*
* On start a number of values is copied on the #TextRefStack.
* You can then use #GetString() and the normal string drawing functions,
* and they will use the #TextRefStack for NewGRF string codes.
*
* However, when you want to draw a string multiple times using the same stack,
* you have to call #RewindTextRefStack() between draws.
*
* After you are done with drawing, you must disable usage of the #TextRefStack
* by calling #StopTextRefStackUsage(), so NewGRF string codes operate on the
* normal string parameters again.
*
* @param numEntries number of entries to copy from the registers
* @param values values to copy onto the stack; if NULL the temporary NewGRF registers will be used instead
*/
void StartTextRefStackUsage(byte numEntries, const uint32 *values)
{
extern TemporaryStorageArray<int32, 0x110> _temp_store;
_newgrf_textrefstack.ResetStack();
byte *p = _newgrf_textrefstack.stack;
for (uint i = 0; i < numEntries; i++) {
uint32 value = values != NULL ? values[i] : _temp_store.GetValue(0x100 + i);
for (uint j = 0; j < 32; j += 8) {
*p = GB(value, j, 8);
p++;
}
}
}
开发者ID:Ayutac,项目名称:OpenTTD,代码行数:32,代码来源:newgrf_text.cpp
示例4: GetVariable
static inline uint32 GetVariable(const ResolverObject &object, ScopeResolver *scope, byte variable, uint32 parameter, bool *available)
{
/* First handle variables common with Action7/9/D */
uint32 value;
if (GetGlobalVariable(variable, &value, object.grffile)) return value;
/* Non-common variable */
switch (variable) {
case 0x0C:
return object.callback;
case 0x10:
return object.callback_param1;
case 0x18:
return object.callback_param2;
case 0x1C:
return object.last_value;
case 0x5F:
return (scope->GetRandomBits() << 8) | scope->GetTriggers();
case 0x7D:
return _temp_store.GetValue(parameter);
case 0x7F:
if (object.grffile == NULL) return 0;
return object.grffile->GetParam(parameter);
/* Not a common variable, so evaluate the feature specific variables */
default:
return scope->GetVariable(variable, parameter, available);
}
}
开发者ID:ComLock,项目名称:OpenTTD,代码行数:32,代码来源:newgrf_spritegroup.cpp
示例5:
/**
* ResolverObject (re)entry point.
* This cannot be made a call to a virtual function because virtual functions
* do not like NULL and checking for NULL *everywhere* is more cumbersome than
* this little helper function.
* @param group the group to resolve for
* @param object information needed to resolve the group
* @param top_level true if this is a top-level SpriteGroup, false if used nested in another SpriteGroup.
* @return the resolved group
*/
/* static */ const SpriteGroup *SpriteGroup::Resolve(const SpriteGroup *group, ResolverObject &object, bool top_level)
{
if (group == NULL) return NULL;
if (top_level) {
_temp_store.ClearChanges();
}
return group->Resolve(object);
}
开发者ID:J0anJosep,项目名称:OpenTTD,代码行数:18,代码来源:newgrf_spritegroup.cpp
注:本文中的TemporaryStorageArray类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论