OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4MapScriptMap Class Reference

#include <C4MapScript.h>

Inheritance diagram for C4MapScriptMap:
[legend]
Collaboration diagram for C4MapScriptMap:
[legend]

Public Member Functions

 C4MapScriptMap (C4PropList *prototype)
 
 ~C4MapScriptMap ()
 
void Clear ()
 
virtual C4MapScriptMapGetMapScriptMap ()
 
C4MapScriptLayerCreateLayer (int32_t wdt, int32_t hgt)
 
virtual C4MapScriptLayerGetMapScriptLayer ()
 
class C4MapScriptMapGetMap ()
 
bool CreateSurface (int32_t wdt, int32_t hgt)
 
void ClearSurface ()
 
void SetSurfaces (std::unique_ptr< CSurface8 > fg, std::unique_ptr< CSurface8 > bg)
 
std::pair< std::unique_ptr
< CSurface8 >, std::unique_ptr
< CSurface8 > > 
ReleaseSurfaces ()
 
bool HasSurface () const
 
void UpdateSurfaceSize ()
 
C4Rect GetBounds () const
 
int32_t GetWdt () const
 
int32_t GetHgt () const
 
uint8_t GetPix (int32_t x, int32_t y, uint8_t outside_col) const
 
uint8_t GetBackPix (int32_t x, int32_t y, uint8_t outside_col) const
 
bool SetPix (int32_t x, int32_t y, uint8_t fg, uint8_t bg) const
 
bool IsPixMasked (int32_t x, int32_t y) const
 
void ConvertSkyToTransparent ()
 
int32_t GetPixCount (const C4Rect &rcBounds, const C4MapScriptMatTexMask &mask)
 
bool Fill (uint8_t fg, uint8_t bg, const C4Rect &rcBounds, const C4MapScriptAlgo *algo)
 
bool Blit (const C4Rect &rcBounds, const C4MapScriptAlgo *algo)
 
bool Blit (const C4MapScriptLayer *src, const C4Rect &src_rect, const C4MapScriptMatTexMask &mask, int32_t tx, int32_t ty)
 
bool FindPos (const C4Rect &search_rect, const C4MapScriptMatTexMask &mask, int32_t *out_x, int32_t *out_y, int32_t max_tries)
 
void CompileFunc (StdCompiler *pComp, C4ValueNumbers *numbers)
 
virtual C4PropListNumberedGetPropListNumbered ()
 
virtual bool IsNumbered () const
 
virtual const char * GetName () const
 
virtual void SetName (const char *NewName=0)
 
virtual void SetOnFire (bool OnFire)
 
virtual C4Def const * GetDef () const
 
virtual C4DefGetDef ()
 
virtual C4ObjectGetObject ()
 
virtual C4Object const * GetObject () const
 
virtual C4EffectGetEffect ()
 
C4PropListGetPrototype () const
 
void RemoveCyclicPrototypes ()
 
virtual class C4PropListStaticIsStatic ()
 
const class C4PropListStaticIsStatic () const
 
virtual bool Delete ()
 
virtual bool GetPropertyByS (const C4String *k, C4Value *pResult) const
 
virtual C4ValueArrayGetProperties () const
 
virtual void SetPropertyByS (C4String *k, const C4Value &to)
 
virtual void ResetProperty (C4String *k)
 
bool GetProperty (C4PropertyName k, C4Value *pResult) const
 
C4StringGetPropertyStr (C4PropertyName k) const
 
C4ValueArrayGetPropertyArray (C4PropertyName n) const
 
C4AulFuncGetFunc (C4PropertyName k) const
 
C4AulFuncGetFunc (C4String *k) const
 
C4AulFuncGetFunc (const char *k) const
 
C4StringEnumerateOwnFuncs (C4String *prev=0) const
 
C4Value Call (C4PropertyName k, C4AulParSet *pPars=0, bool fPassErrors=false)
 
C4Value Call (C4String *k, C4AulParSet *pPars=0, bool fPassErrors=false)
 
C4Value Call (const char *k, C4AulParSet *pPars=0, bool fPassErrors=false)
 
C4PropertyName GetPropertyP (C4PropertyName k) const
 
int32_t GetPropertyBool (C4PropertyName n, bool default_val=false) const
 
int32_t GetPropertyInt (C4PropertyName k, int32_t default_val=0) const
 
C4PropListGetPropertyPropList (C4PropertyName k) const
 
bool HasProperty (C4String *k) const
 
void SetProperty (C4PropertyName k, const C4Value &to)
 
void Freeze ()
 
void Thaw ()
 
bool IsFrozen () const
 
C4PropListStaticFreezeAndMakeStaticRecursively (std::vector< C4Value > *prop_lists, const C4PropListStatic *parent=nullptr, C4String *key=nullptr)
 
virtual void Denumerate (C4ValueNumbers *)
 
void AppendDataString (StdStrBuf *out, const char *delim, int depth=3, bool ignore_reference_parent=false) const
 
StdStrBuf ToJSON (int depth=10, bool ignore_reference_parent=false) const
 
std::vector< C4String * > GetSortedLocalProperties (bool add_prototype=true) const
 
std::vector< C4String * > GetSortedLocalProperties (const char *prefix, const C4PropList *ignore_overridden) const
 
std::vector< C4String * > GetUnsortedProperties (const char *prefix, C4PropList *ignore_parent=nullptr) const
 
std::vector< C4String * > GetSortedProperties (const char *prefix, C4PropList *ignore_parent=nullptr) const
 
bool operator== (const C4PropList &b) const
 
Iterator begin ()
 
Iterator end ()
 

Static Public Member Functions

static C4PropListGetByNumber (int32_t iNumber)
 
static bool CheckPropList (C4PropList *)
 
static void SetEnumerationIndex (int32_t iMaxObjectNumber)
 
static int32_t GetEnumerationIndex ()
 
static void ResetEnumerationIndex ()
 
static void ShelveNumberedPropLists ()
 
static void UnshelveNumberedPropLists ()
 
static void ClearShelve ()
 
static void ClearNumberedPropLists ()
 
static C4PropListNew (C4PropList *prototype=0)
 
static C4PropListStaticNewStatic (C4PropList *prototype, const C4PropListStatic *parent, C4String *key)
 

Public Attributes

int32_t Number
 
int32_t Status
 

Protected Member Functions

void AcquireNumber ()
 
void ClearNumber ()
 
void ClearRefs ()
 

Protected Attributes

class C4MapScriptMapmap
 

Static Protected Attributes

static C4Set
< C4PropListNumbered * > 
PropLists
 
static std::vector
< C4PropListNumbered * > 
ShelvedPropLists
 
static int32_t EnumerationIndex = 0
 

Detailed Description

Definition at line 321 of file C4MapScript.h.

Constructor & Destructor Documentation

C4MapScriptMap::C4MapScriptMap ( C4PropList prototype)
inline

Definition at line 325 of file C4MapScript.h.

References C4MapScriptLayer::map.

325 : C4MapScriptLayer(prototype, nullptr) { map=this; }
C4MapScriptLayer(C4PropList *prototype, C4MapScriptMap *map)
class C4MapScriptMap * map
Definition: C4MapScript.h:275
C4MapScriptMap::~C4MapScriptMap ( )
inline

Definition at line 326 of file C4MapScript.h.

References Clear().

326 { Clear(); }

Here is the call graph for this function:

Member Function Documentation

void C4PropListNumbered::AcquireNumber ( )
protectedinherited

Definition at line 155 of file C4PropList.cpp.

References C4Set< T >::Add(), C4PropListNumbered::EnumerationIndex, C4Set< T >::Get(), C4PropListNumbered::Number, and C4PropListNumbered::PropLists.

Referenced by C4Effect::C4Effect(), C4MapScriptLayer::C4MapScriptLayer(), and C4Object::Init().

156 {
157  // Enumerate object
158  do
160  while (PropLists.Get(Number));
161  // Add to list
162  PropLists.Add(this);
163 }
T * Add(T const &e)
T & Get(H e) const
static C4Set< C4PropListNumbered * > PropLists
Definition: C4PropList.h:237
static int32_t EnumerationIndex
Definition: C4PropList.h:239

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropList::AppendDataString ( StdStrBuf out,
const char *  delim,
int  depth = 3,
bool  ignore_reference_parent = false 
) const
inherited

Definition at line 497 of file C4PropList.cpp.

References StdStrBuf::Append(), C4Set< T >::GetSize(), C4Set< T >::GetSortedListOfElementPointers(), and C4PropList::IsStatic().

Referenced by C4Value::GetDataString(), and C4Object::GetDataString().

498 {
499  StdStrBuf & DataString = *out;
500  if (depth <= 0 && Properties.GetSize())
501  {
502  DataString.Append("...");
503  return;
504  }
505  std::list<const C4Property *> sorted_props = Properties.GetSortedListOfElementPointers();
506  for (std::list<const C4Property *>::const_iterator p = sorted_props.begin(); p != sorted_props.end(); ++p)
507  {
508  if (p != sorted_props.begin()) DataString.Append(delim);
509  DataString.Append((*p)->Key->GetData());
510  DataString.Append(" = ");
511  DataString.Append((*p)->Value.GetDataString(depth - 1, ignore_reference_parent ? IsStatic() : nullptr));
512  }
513 }
std::list< const T * > GetSortedListOfElementPointers() const
virtual class C4PropListStatic * IsStatic()
Definition: C4PropList.h:87
unsigned int GetSize() const
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527

Here is the call graph for this function:

Here is the caller graph for this function:

C4PropList::Iterator C4PropList::begin ( )
inherited

Definition at line 962 of file C4PropList.cpp.

References C4PropList::begin(), C4Set< T >::First(), C4PropList::GetPrototype(), C4Set< T >::GetSize(), and C4Set< T >::Next().

Referenced by C4PropList::begin(), and C4ParticleProperties::Set().

963 {
965 
966  if (GetPrototype())
967  {
968  iter = GetPrototype()->begin();
969  }
970  else
971  {
972  iter.properties = std::make_shared<std::vector<const C4Property*> >();
973  }
974  iter.Reserve(Properties.GetSize());
975 
976  const C4Property * p = Properties.First();
977  while (p)
978  {
979  iter.AddProperty(p);
980  p = Properties.Next(p);
981  }
982 
983  iter.Init();
984  return iter;
985 }
T const * Next(T const *p) const
unsigned int GetSize() const
Iterator begin()
Definition: C4PropList.cpp:962
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
T const * First() const

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4MapScriptLayer::Blit ( const C4Rect rcBounds,
const C4MapScriptAlgo algo 
)
inherited

Definition at line 532 of file C4MapScript.cpp.

References C4MapScriptLayer::HasSurface(), C4Rect::Hgt, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

533 {
534  // safety
535  if (!HasSurface()) return false;
536  assert(rcBounds.x>=0 && rcBounds.y>=0 && rcBounds.x+rcBounds.Wdt<=fg_surface->Wdt && rcBounds.y+rcBounds.Hgt<=fg_surface->Hgt);
537  assert(algo);
538  // set all pixels within bounds by algo, if algo is not transparent
539  uint8_t fg, bg;
540  for (int32_t y=rcBounds.y; y<rcBounds.y+rcBounds.Hgt; ++y)
541  for (int32_t x=rcBounds.x; x<rcBounds.x+rcBounds.Wdt; ++x)
542  if (((*algo)(x,y,fg,bg)))
543  {
544  if (fg) fg_surface->_SetPix(x,y,fg);
545  if (bg) bg_surface->_SetPix(x,y,bg);
546  }
547  return true;
548 }
bool HasSurface() const
Definition: C4MapScript.h:296
int32_t Wdt
Definition: C4Rect.h:32
int32_t y
Definition: C4Rect.h:32
int32_t x
Definition: C4Rect.h:32
int32_t Hgt
Definition: C4Rect.h:32

Here is the call graph for this function:

bool C4MapScriptLayer::Blit ( const C4MapScriptLayer src,
const C4Rect src_rect,
const C4MapScriptMatTexMask mask,
int32_t  tx,
int32_t  ty 
)
inherited

Definition at line 550 of file C4MapScript.cpp.

References C4MapScriptLayer::HasSurface(), C4Rect::Hgt, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

551 {
552  // safety
553  assert(src);
554  if (!HasSurface() || !src->HasSurface()) return false;
555  // cannot assert this, because C4Rect::Contains(C4Rect &) has an off-by-one-error which I don't dare to fix right now
556  // TODO: Fix C4Rect::Contains and check if the sector code still works
557  // assert(src->GetBounds().Contains(src_rect));
558  // copy all pixels that aren't masked
559  uint8_t fg, bg;
560  for (int32_t y=src_rect.y; y<src_rect.y+src_rect.Hgt; ++y)
561  for (int32_t x=src_rect.x; x<src_rect.x+src_rect.Wdt; ++x)
562  {
563  fg = src->fg_surface->_GetPix(x, y);
564  bg = src->bg_surface->_GetPix(x, y);
565 
566  if (col_mask(fg, bg))
567  {
568  fg_surface->_SetPix(x-src_rect.x+tx,y-src_rect.y+ty,fg);
569  bg_surface->_SetPix(x-src_rect.x+tx,y-src_rect.y+ty,bg);
570  }
571  }
572  return true;
573 }
bool HasSurface() const
Definition: C4MapScript.h:296
int32_t Wdt
Definition: C4Rect.h:32
int32_t y
Definition: C4Rect.h:32
int32_t x
Definition: C4Rect.h:32
int32_t Hgt
Definition: C4Rect.h:32

Here is the call graph for this function:

C4Value C4PropList::Call ( C4PropertyName  k,
C4AulParSet pPars = 0,
bool  fPassErrors = false 
)
inlineinherited

Definition at line 112 of file C4PropList.h.

References C4StringTable::P, and Strings.

Referenced by C4Command::Acquire(), C4Object::ActivateEntrance(), C4Object::ActivateMenu(), C4Object::AssignDeath(), C4Object::AssignRemoval(), C4Command::Call(), C4GameScriptHost::Call(), C4Effect::CallEffect(), C4Command::CallFailed(), C4Effect::CallStart(), C4Effect::CallStop(), C4Effect::CallTimer(), C4FindObjectFunc::Check(), C4Effect::ClearAll(), C4Object::Collect(), C4SortObjectFunc::CompareGetValue(), C4Object::Contact(), C4GameObjects::CrossCheck(), C4Landscape::P::DigMaterial2Objects(), C4Object::DirectComContents(), C4Object::DoBreath(), C4Object::DoCon(), C4Object::DoDamage(), C4Object::DoEnergy(), C4Object::DoMovement(), C4ObjectMenu::DoRefillInternal(), C4Object::DoSelect(), C4Object::Enter(), C4RoundResults::EvaluateGame(), C4RoundResults::EvaluateGoals(), C4Object::ExecAction(), C4Object::ExecLife(), C4ScriptGuiWindowAction::ExecuteCommand(), C4Object::ExecuteCommand(), C4Object::Exit(), C4Command::Fail(), C4Command::GetTryEnter(), C4Def::GetValue(), C4Object::GetValue(), GrabLost(), C4GameObjects::GRBroadcast(), C4Landscape::Incinerate(), C4Effect::Init(), C4Player::Init(), C4Game::InitGame(), C4ObjectMenu::IsCloseDenied(), C4Effect::Kill(), C4Object::Lift(), C4Player::MakeCrewMember(), C4Game::NewObject(), ObjectActionJump(), ObjectComGrab(), ObjectComPunch(), ObjectComPut(), ObjectComUnGrab(), C4ObjectMenu::OnSelectionChanged(), C4GameObjects::OnSynchronized(), C4EditCursor::PerformDuplication(), C4EditCursor::PerformDuplicationLegacy(), C4Player::PlaceReadyCrew(), C4Landscape::P::PostFreeShape(), C4Object::Promote(), C4Object::Push(), C4Game::SaveData(), C4Object::SetAction(), C4GUI::FrameDecoration::SetByDef(), C4Object::SetCommand(), C4Player::SetObjectCrewStatus(), C4Object::SetOwner(), C4Object::StatusActivate(), C4Command::Transfer(), and C4Object::UnSelect().

113  { return Call(&Strings.P[k], pPars, fPassErrors); }
C4String P[P_LAST]
C4StringTable Strings
Definition: C4Globals.cpp:42
C4Value Call(C4PropertyName k, C4AulParSet *pPars=0, bool fPassErrors=false)
Definition: C4PropList.h:112

Here is the caller graph for this function:

C4Value C4PropList::Call ( C4String k,
C4AulParSet pPars = 0,
bool  fPassErrors = false 
)
inherited

Definition at line 783 of file C4PropList.cpp.

References C4PropList::C4Value, C4AulFunc::Exec(), C4PropList::GetFunc(), and C4PropList::Status.

784 {
785  if (!Status) return C4Value();
786  C4AulFunc *pFn = GetFunc(k);
787  if (!pFn) return C4Value();
788  return pFn->Exec(this, Pars, fPassErrors);
789 }
C4AulFunc * GetFunc(C4PropertyName k) const
Definition: C4PropList.h:107
friend class C4Value
Definition: C4PropList.h:166
C4Value Exec(C4PropList *p=nullptr, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
Definition: C4AulFunc.h:73
int32_t Status
Definition: C4PropList.h:169

Here is the call graph for this function:

C4Value C4PropList::Call ( const char *  k,
C4AulParSet pPars = 0,
bool  fPassErrors = false 
)
inherited

Definition at line 791 of file C4PropList.cpp.

References C4PropList::C4Value, C4AulFunc::Exec(), FormatString(), C4AulScriptEngine::GetErrorHandler(), C4PropList::GetFunc(), C4AulErrorHandler::OnError(), ScriptEngine, C4PropList::Status, and C4AulError::what().

792 {
793  if (!Status) return C4Value();
794  assert(s && s[0]);
795  C4AulFunc *pFn = GetFunc(s);
796  if (!pFn)
797  {
798  if (s[0] != '~')
799  {
800  C4AulExecError err(FormatString("Undefined function: %s", s).getData());
801  if (fPassErrors)
802  throw err;
803  ::ScriptEngine.GetErrorHandler()->OnError(err.what());
804  }
805  return C4Value();
806  }
807  return pFn->Exec(this, Pars, fPassErrors);
808 }
C4AulErrorHandler * GetErrorHandler() const
Definition: C4Aul.h:175
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
C4AulFunc * GetFunc(C4PropertyName k) const
Definition: C4PropList.h:107
friend class C4Value
Definition: C4PropList.h:166
C4Value Exec(C4PropList *p=nullptr, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
Definition: C4AulFunc.h:73
int32_t Status
Definition: C4PropList.h:169
virtual void OnError(const char *msg)=0
#define s
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277

Here is the call graph for this function:

bool C4PropListNumbered::CheckPropList ( C4PropList pObj)
staticinherited

Definition at line 80 of file C4PropList.cpp.

References C4Set< T >::First(), C4Set< T >::Next(), and C4PropListNumbered::PropLists.

Referenced by C4Object::SetOCF(), C4Object::UpdateOCF(), and C4PropList::~C4PropList().

81 {
82  if (!pObj) return false;
83  C4PropListNumbered * const * p = PropLists.First();
84  while (p)
85  {
86  if (*p == pObj)
87  return true;
88  p = PropLists.Next(p);
89  }
90  return false;
91 }
T const * Next(T const *p) const
static C4Set< C4PropListNumbered * > PropLists
Definition: C4PropList.h:237
T const * First() const

Here is the call graph for this function:

Here is the caller graph for this function:

void C4MapScriptMap::Clear ( )

Definition at line 617 of file C4MapScript.cpp.

Referenced by ~C4MapScriptMap().

618 {
619  // Layers are owned by map. Free them.
620  for (std::list<C4MapScriptLayer *>::iterator i=layers.begin(); i!=layers.end(); ++i) delete *i;
621  layers.clear();
622 }

Here is the caller graph for this function:

void C4PropListNumbered::ClearNumber ( )
protectedinherited

Definition at line 165 of file C4PropList.cpp.

References C4PropListNumbered::Number, C4PropListNumbered::PropLists, and C4Set< T >::Remove().

Referenced by C4PropListNumbered::ShelveNumberedPropLists().

166 {
167  // Make proplist invisible during denumeration process
168  if (Number != -1)
169  {
170  PropLists.Remove(this);
171  Number = -1;
172  }
173 }
void Remove(H e)
static C4Set< C4PropListNumbered * > PropLists
Definition: C4PropList.h:237

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropListNumbered::ClearNumberedPropLists ( )
staticinherited

Definition at line 137 of file C4PropList.cpp.

References C4PropList::Clear(), C4Set< T >::First(), C4Set< T >::Next(), and C4PropListNumbered::PropLists.

Referenced by C4Game::Clear().

138 {
139  // empty all proplists to ensure safe deletion of proplists with circular references
140  // note that this the call to Clear() might delete some prop lists. So it is assumed that
141  // PropLists does not shrink its table as the number of values goes down
142  C4PropListNumbered *const* p_next = PropLists.First(), *const* p;
143  while ((p = p_next))
144  {
145  p_next = PropLists.Next(p);
146  // check *p since it might have been deleted by clearing the previous prop list
147  if (*p) (*p)->Clear();
148  }
149 }
void Clear()
Definition: C4PropList.h:68
T const * Next(T const *p) const
static C4Set< C4PropListNumbered * > PropLists
Definition: C4PropList.h:237
T const * First() const

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropList::ClearRefs ( )
inlineprotectedinherited

Definition at line 157 of file C4PropList.h.

References C4Value::Set0().

Referenced by C4Object::AssignRemoval().

157 { while (FirstRef) FirstRef->Set0(); }
void Set0()
Definition: C4Value.h:336

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropListNumbered::ClearShelve ( )
staticinherited

Definition at line 131 of file C4PropList.cpp.

References C4PropListNumbered::ShelvedPropLists.

Referenced by C4Game::Clear().

132 {
133  // cleanup shelve - used in game clear, un unsuccessful section load, etc.
134  ShelvedPropLists.clear();
135 }
static std::vector< C4PropListNumbered * > ShelvedPropLists
Definition: C4PropList.h:238

Here is the caller graph for this function:

void C4MapScriptLayer::ClearSurface ( )
inherited

Definition at line 474 of file C4MapScript.cpp.

Referenced by C4MapScriptLayer::CreateSurface(), and C4MapScriptLayer::~C4MapScriptLayer().

475 {
476  fg_surface.reset(); bg_surface.reset();
477  // if there is no surface, width and height parameters are undefined. no need to update them.
478 }

Here is the caller graph for this function:

void C4PropListNumbered::CompileFunc ( StdCompiler pComp,
C4ValueNumbers numbers 
)
inherited

Definition at line 180 of file C4PropList.cpp.

References C4Set< T >::Add(), C4PropList::CompileFunc(), StdCompiler::excCorrupt(), C4Set< T >::Get(), StdCompiler::isDeserializer(), C4PropListNumbered::Number, C4PropListNumbered::PropLists, StdCompiler::SEP_SEP2, StdCompiler::Separator(), and StdCompiler::Value().

Referenced by C4Effect::CompileFunc().

181 {
182  int32_t n = Number;
183  pComp->Value(n);
185  C4PropList::CompileFunc(pComp, numbers);
186  if (pComp->isDeserializer())
187  {
188  if (PropLists.Get(n))
189  {
190  pComp->excCorrupt("multiple PropLists with Number %d", n);
191  return;
192  }
193  // Once this proplist has a Number, it has to be in PropLists. See the destructor below.
194  Number = n;
195  PropLists.Add(this);
196  }
197 }
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:129
void CompileFunc(StdCompiler *pComp, C4ValueNumbers *)
Definition: C4PropList.cpp:376
void excCorrupt(const char *szMessage,...)
Definition: StdCompiler.h:258
T * Add(T const &e)
T & Get(H e) const
void Value(const T &rStruct)
Definition: StdCompiler.h:170
virtual bool isDeserializer()
Definition: StdCompiler.h:63
static C4Set< C4PropListNumbered * > PropLists
Definition: C4PropList.h:237

Here is the call graph for this function:

Here is the caller graph for this function:

void C4MapScriptLayer::ConvertSkyToTransparent ( )
inherited

Definition at line 490 of file C4MapScript.cpp.

References C4M_MaxTexIndex, and C4MapScriptLayer::HasSurface().

491 {
492  // Convert all sky (color==C4M_MaxTexIndex) pixels to transparent (color==0)
493  // Needed because C4Landscape map zoom assumes sky to be 0
494  if (!HasSurface()) return;
495  for (int32_t y=0; y<fg_surface->Hgt; ++y)
496  {
497  for (int32_t x=0; x<fg_surface->Wdt; ++x)
498  {
499  if (fg_surface->_GetPix(x,y) == C4M_MaxTexIndex)
500  fg_surface->_SetPix(x,y, 0);
501 
502  if (bg_surface->_GetPix(x,y) == C4M_MaxTexIndex)
503  bg_surface->_SetPix(x,y, 0);
504  }
505  }
506 }
bool HasSurface() const
Definition: C4MapScript.h:296
const int C4M_MaxTexIndex
Definition: C4Constants.h:51

Here is the call graph for this function:

C4MapScriptLayer * C4MapScriptMap::CreateLayer ( int32_t  wdt,
int32_t  hgt 
)

Definition at line 624 of file C4MapScript.cpp.

References C4MapScriptLayer::C4MapScriptLayer(), C4MapScriptLayer::CreateSurface(), C4MapScriptHost::GetLayerPrototype(), and MapScript.

625 {
626  // Create layer and register to map. Layer's created by a map are freed when the map is freed.
628  layers.push_back(new_layer); // push before CreateSurface for exception safety
629  if (!new_layer->CreateSurface(wdt, hgt))
630  {
631  layers.remove(new_layer);
632  delete new_layer;
633  return nullptr;
634  }
635  return new_layer;
636 }
C4MapScriptHost MapScript
C4MapScriptLayer(C4PropList *prototype, C4MapScriptMap *map)
bool CreateSurface(int32_t wdt, int32_t hgt)
C4PropListStatic * GetLayerPrototype()
Definition: C4MapScript.h:351

Here is the call graph for this function:

bool C4MapScriptLayer::CreateSurface ( int32_t  wdt,
int32_t  hgt 
)
inherited

Definition at line 458 of file C4MapScript.cpp.

References C4MapScriptLayer::ClearSurface(), and C4MapScriptLayer::UpdateSurfaceSize().

Referenced by CreateLayer().

459 {
460  // Create new surface of given size. Surface is filled with color 0
461  ClearSurface();
462  if (wdt<=0 || hgt<=0) return false;
463  fg_surface = std::make_unique<CSurface8>();
464  bg_surface = std::make_unique<CSurface8>();
465  if (!fg_surface->Create(wdt, hgt) || !bg_surface->Create(wdt, hgt))
466  {
467  ClearSurface();
468  return false;
469  }
471  return true;
472 }
void UpdateSurfaceSize()

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool C4PropList::Delete ( )
inlinevirtualinherited

Reimplemented in C4PropListStaticMember, C4PropListStatic, C4PropListScript, and C4Def.

Definition at line 92 of file C4PropList.h.

Referenced by C4ScriptHost::DeleteOwnedPropLists().

92 { return false; }

Here is the caller graph for this function:

void C4PropList::Denumerate ( C4ValueNumbers numbers)
virtualinherited

Reimplemented in C4Object, C4AulScriptEngine, and C4Effect.

Definition at line 329 of file C4PropList.cpp.

References C4Value::Denumerate(), C4Set< T >::First(), C4Set< T >::Next(), C4PropList::RemoveCyclicPrototypes(), and C4Property::Value.

Referenced by C4Value::Denumerate(), and C4Object::Denumerate().

330 {
331  const C4Property * p = Properties.First();
332  while (p)
333  {
334  const_cast<C4Value &>(p->Value).Denumerate(numbers);
335  p = Properties.Next(p);
336  }
337  prototype.Denumerate(numbers);
339 }
void RemoveCyclicPrototypes()
Definition: C4PropList.cpp:409
C4Value Value
Definition: C4PropList.h:57
virtual void Denumerate(C4ValueNumbers *)
Definition: C4PropList.cpp:329
void Denumerate(C4ValueNumbers *)
Definition: C4Value.cpp:253
T const * Next(T const *p) const
T const * First() const

Here is the call graph for this function:

Here is the caller graph for this function:

Iterator C4PropList::end ( )
inlineinherited

Definition at line 207 of file C4PropList.h.

Referenced by C4ParticleProperties::Set().

207 { return Iterator(); }

Here is the caller graph for this function:

C4String * C4PropList::EnumerateOwnFuncs ( C4String prev = 0) const
inherited

Definition at line 895 of file C4PropList.cpp.

References C4Set< T >::First(), C4Set< T >::Get(), C4Value::getFunction(), C4Property::Key, C4Set< T >::Next(), and C4Property::Value.

896 {
897  const C4Property * p = prev ? Properties.Next(&Properties.Get(prev)) : Properties.First();
898  while (p)
899  {
900  if (p->Value.getFunction())
901  return p->Key;
902  p = Properties.Next(p);
903  }
904  return 0;
905 }
C4Value Value
Definition: C4PropList.h:57
T & Get(H e) const
T const * Next(T const *p) const
C4String * Key
Definition: C4PropList.h:56
T const * First() const
C4AulFunc * getFunction() const
Definition: C4Value.h:119

Here is the call graph for this function:

bool C4MapScriptLayer::Fill ( uint8_t  fg,
uint8_t  bg,
const C4Rect rcBounds,
const C4MapScriptAlgo algo 
)
inherited

Definition at line 514 of file C4MapScript.cpp.

References C4MapScriptLayer::HasSurface(), C4Rect::Hgt, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

515 {
516  // safety
517  uint8_t temp_fg, temp_bg;
518  if (!HasSurface()) return false;
519  assert(rcBounds.x>=0 && rcBounds.y>=0 && rcBounds.x+rcBounds.Wdt<=fg_surface->Wdt && rcBounds.y+rcBounds.Hgt<=fg_surface->Hgt);
520  // set all non-masked pixels within bounds that fulfill algo
521  for (int32_t y=rcBounds.y; y<rcBounds.y+rcBounds.Hgt; ++y)
522  for (int32_t x=rcBounds.x; x<rcBounds.x+rcBounds.Wdt; ++x)
523  if (!algo || (*algo)(x,y,temp_fg,temp_bg))
524  {
525  fg_surface->_SetPix(x,y,fg);
526  bg_surface->_SetPix(x,y,bg);
527  }
528 
529  return true;
530 }
bool HasSurface() const
Definition: C4MapScript.h:296
int32_t Wdt
Definition: C4Rect.h:32
int32_t y
Definition: C4Rect.h:32
int32_t x
Definition: C4Rect.h:32
int32_t Hgt
Definition: C4Rect.h:32

Here is the call graph for this function:

bool C4MapScriptLayer::FindPos ( const C4Rect search_rect,
const C4MapScriptMatTexMask mask,
int32_t *  out_x,
int32_t *  out_y,
int32_t  max_tries 
)
inherited

Definition at line 588 of file C4MapScript.cpp.

References C4MapScriptLayer::HasSurface(), C4Rect::Hgt, Random(), C4Rect::Wdt, C4Rect::x, and C4Rect::y.

589 {
590  // safety
591  if (!HasSurface() || search_rect.Wdt<=0 || search_rect.Hgt<=0) return false;
592  // Search random positions
593  for (int32_t i=0; i<max_tries; ++i)
594  {
595  int32_t x=search_rect.x + Random(search_rect.Wdt);
596  int32_t y=search_rect.y + Random(search_rect.Hgt);
597  if (col_mask(fg_surface->_GetPix(x,y), bg_surface->_GetPix(x,y))) { *out_x=x; *out_y=y; return true; }
598  }
599  // Nothing found yet: Start at a random position and search systemically
600  // (this guantuess to find a pixel if there is one, but favours border pixels)
601  int32_t sx=search_rect.x + Random(search_rect.Wdt);
602  int32_t sy=search_rect.y + Random(search_rect.Hgt);
603  for (int32_t x = sx; x < search_rect.x + search_rect.Wdt; ++x)
604  if (col_mask(fg_surface->_GetPix(x,sy), bg_surface->_GetPix(x,sy))) { *out_x=x; *out_y=sy; return true; }
605  for (int32_t y = sy + 1; y<search_rect.y + search_rect.Hgt; ++y)
606  for (int32_t x = search_rect.x; x < search_rect.x + search_rect.Wdt; ++x)
607  if (col_mask(fg_surface->_GetPix(x,y), bg_surface->_GetPix(x,y))) { *out_x=x; *out_y=y; return true; }
608  for (int32_t y = search_rect.y; y<sy; ++y)
609  for (int32_t x = search_rect.x; x < search_rect.x + search_rect.Wdt; ++x)
610  if (col_mask(fg_surface->_GetPix(x,y), bg_surface->_GetPix(x,y))) { *out_x=x; *out_y=y; return true; }
611  for (int32_t x = search_rect.x; x<sx; ++x)
612  if (col_mask(fg_surface->_GetPix(x,sy), bg_surface->_GetPix(x,sy))) { *out_x=x; *out_y=sy; return true; }
613  // Nothing found
614  return false;
615 }
uint32_t Random()
Definition: C4Random.cpp:43
bool HasSurface() const
Definition: C4MapScript.h:296
int32_t Wdt
Definition: C4Rect.h:32
int32_t y
Definition: C4Rect.h:32
int32_t x
Definition: C4Rect.h:32
int32_t Hgt
Definition: C4Rect.h:32

Here is the call graph for this function:

void C4PropList::Freeze ( )
inlineinherited

Definition at line 130 of file C4PropList.h.

Referenced by C4PropList::FreezeAndMakeStaticRecursively().

130 { constant = true; }

Here is the caller graph for this function:

C4PropListStatic * C4PropList::FreezeAndMakeStaticRecursively ( std::vector< C4Value > *  prop_lists,
const C4PropListStatic parent = nullptr,
C4String key = nullptr 
)
inherited

Definition at line 284 of file C4PropList.cpp.

References C4VPropList(), C4PropList::Freeze(), C4PropList::FreezeAndMakeStaticRecursively(), C4PropListStatic::GetParent(), C4PropListStatic::GetParentKeyName(), C4PropList::GetPropertyByS(), C4Value::getPropList(), C4PropList::GetPrototype(), C4PropList::GetSortedLocalProperties(), C4PropList::IsStatic(), C4PropList::NewStatic(), C4Value::SetPropList(), and C4PropList::Status.

Referenced by C4PropList::FreezeAndMakeStaticRecursively(), and C4AulScriptEngine::Link().

285 {
286  Freeze();
287  // Already static?
288  C4PropListStatic *this_static = IsStatic();
289  if (!this_static)
290  {
291  // Make self static by creating a copy and replacing all references
292  this_static = NewStatic(GetPrototype(), parent, key);
293  this_static->Properties.Swap(&Properties); // grab properties
294  this_static->Status = Status;
295  C4Value holder = C4VPropList(this);
296  while (FirstRef && FirstRef->NextRef)
297  {
298  C4Value *ref = FirstRef;
299  if (ref == &holder) ref = ref->NextRef;
300  ref->SetPropList(this_static);
301  }
302  // store reference
303  if (prop_lists)
304  prop_lists->push_back(C4VPropList(this_static));
305  // "this" should be deleted as holder goes out of scope
306  }
307  // Iterate over sorted list of elements to make static
308  // Must iterate over sorted list because the order must be defined, just in case it's a network game
309  // and a non-static child proplist is available through different paths it should still get the same name
310  auto prop_names = this_static->GetSortedLocalProperties(false);
311  for (auto prop_name : prop_names)
312  {
313  C4Value child_val;
314  this_static->GetPropertyByS(prop_name, &child_val);
315  C4PropList *child_proplist = child_val.getPropList();
316  if (child_proplist)
317  {
318  // Avoid infinite recursion: Only freeze into unfrozen children and "true" static children
319  C4PropListStatic *child_static = child_proplist->IsStatic();
320  if (!child_static || (child_static->GetParent() == this_static && child_static->GetParentKeyName() == prop_name))
321  {
322  child_proplist->FreezeAndMakeStaticRecursively(prop_lists, this_static, prop_name);
323  }
324  }
325  }
326  return this_static;
327 }
C4PropListStatic * FreezeAndMakeStaticRecursively(std::vector< C4Value > *prop_lists, const C4PropListStatic *parent=nullptr, C4String *key=nullptr)
Definition: C4PropList.cpp:284
void Freeze()
Definition: C4PropList.h:130
virtual class C4PropListStatic * IsStatic()
Definition: C4PropList.h:87
C4String * GetParentKeyName()
Definition: C4PropList.h:272
std::vector< C4String * > GetSortedLocalProperties(bool add_prototype=true) const
Definition: C4PropList.cpp:535
virtual bool GetPropertyByS(const C4String *k, C4Value *pResult) const
Definition: C4PropList.cpp:712
C4Value C4VPropList(C4PropList *p)
Definition: C4Value.h:245
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
int32_t Status
Definition: C4PropList.h:169
static C4PropListStatic * NewStatic(C4PropList *prototype, const C4PropListStatic *parent, C4String *key)
Definition: C4PropList.cpp:70
void SetPropList(C4PropList *PropList)
Definition: C4Value.h:141
const C4PropListStatic * GetParent() const
Definition: C4PropList.h:271
C4PropList * getPropList() const
Definition: C4Value.h:116

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t C4MapScriptLayer::GetBackPix ( int32_t  x,
int32_t  y,
uint8_t  outside_col 
) const
inlineinherited

Definition at line 306 of file C4MapScript.h.

References C4MapScriptLayer::HasSurface().

Referenced by C4MapScriptLayer::IsPixMasked(), and C4MapScriptAlgoLayer::operator()().

306 { return (!HasSurface()||x<0||y<0||x>=bg_surface->Wdt||y>=bg_surface->Hgt) ? outside_col : bg_surface->_GetPix(x,y); }
bool HasSurface() const
Definition: C4MapScript.h:296

Here is the call graph for this function:

Here is the caller graph for this function:

C4Rect C4MapScriptLayer::GetBounds ( ) const
inherited

Definition at line 508 of file C4MapScript.cpp.

Referenced by FnParRect().

509 {
510  // Return bounding rectangle of surface. Surface always starts at 0,0.
511  return fg_surface ? C4Rect(0,0,fg_surface->Wdt,fg_surface->Hgt) : C4Rect();
512 }
Definition: C4Rect.h:29

Here is the caller graph for this function:

C4PropList * C4PropListNumbered::GetByNumber ( int32_t  iNumber)
staticinherited

Definition at line 75 of file C4PropList.cpp.

References C4Set< T >::Get(), and C4PropListNumbered::PropLists.

Referenced by C4Value::Denumerate(), and C4GameObjects::ObjectPointer().

76 {
77  return PropLists.Get(iNumber);
78 }
T & Get(H e) const
static C4Set< C4PropListNumbered * > PropLists
Definition: C4PropList.h:237

Here is the call graph for this function:

Here is the caller graph for this function:

C4Def const * C4PropList::GetDef ( ) const
virtualinherited

Reimplemented in C4Def.

Definition at line 640 of file C4PropList.cpp.

References C4PropList::GetDef(), and C4PropList::GetPrototype().

Referenced by C4Value::_getDef(), ConstructionCheck(), C4Game::CreateObject(), C4Game::CreateObjectConstruction(), C4AulExec::DirectExec(), C4GameMessage::Draw(), C4Game::DrawPropListSpecImage(), C4AulExec::FnTranslate(), C4PropList::GetDef(), C4Value::getDef(), C4GameMessage::Init(), C4Object::Init(), C4FindObjectDef::IsImpossible(), C4PropList::operator==(), C4ScriptHost::Parse(), C4AulParse::Parse_Script(), C4Game::PlaceAnimal(), C4Game::PlaceVegetation(), and C4ScriptGuiWindowProperty::Set().

641 {
642  if (GetPrototype()) return GetPrototype()->GetDef();
643  return 0;
644 }
virtual C4Def const * GetDef() const
Definition: C4PropList.cpp:640
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

Here is the caller graph for this function:

C4Def * C4PropList::GetDef ( )
virtualinherited

Reimplemented in C4Def.

Definition at line 634 of file C4PropList.cpp.

References C4PropList::GetDef(), and C4PropList::GetPrototype().

635 {
636  if (GetPrototype()) return GetPrototype()->GetDef();
637  return 0;
638 }
virtual C4Def const * GetDef() const
Definition: C4PropList.cpp:640
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

C4Effect * C4PropList::GetEffect ( )
virtualinherited

Reimplemented in C4Effect.

Definition at line 664 of file C4PropList.cpp.

References C4PropList::GetEffect(), and C4PropList::GetPrototype().

Referenced by C4ValueConv< C4Effect * >::_FromC4V(), C4Value::GetDataString(), and C4PropList::GetEffect().

665 {
666  if (GetPrototype()) return GetPrototype()->GetEffect();
667  return 0;
668 }
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
virtual C4Effect * GetEffect()
Definition: C4PropList.cpp:664

Here is the call graph for this function:

Here is the caller graph for this function:

static int32_t C4PropListNumbered::GetEnumerationIndex ( )
inlinestaticinherited

Definition at line 226 of file C4PropList.h.

References C4PropListNumbered::EnumerationIndex.

Referenced by C4Game::NewObject(), C4EditCursor::PerformDuplication(), and C4ControlSyncCheck::Set().

226 { return EnumerationIndex; }
static int32_t EnumerationIndex
Definition: C4PropList.h:239

Here is the caller graph for this function:

C4AulFunc* C4PropList::GetFunc ( C4PropertyName  k) const
inlineinherited

Definition at line 107 of file C4PropList.h.

References C4StringTable::P, and Strings.

Referenced by C4Effect::AssignCallbackFunctions(), C4PropList::Call(), C4Effect::CallDamage(), C4Value::CompileFunc(), C4ScriptHost::CopyPropList(), C4Effect::DoCall(), C4PropList::GetFunc(), C4Effect::Init(), C4MapScriptHost::InitializeMap(), C4Object::PutAwayUnusedObject(), C4MaterialReaction::ResolveScriptFuncs(), C4MCOverlay::SetField(), C4AulCompiler::PreparseAstVisitor::visit(), and C4AulCompiler::CodegenAstVisitor::visit().

108  { return GetFunc(&Strings.P[k]); }
C4String P[P_LAST]
C4AulFunc * GetFunc(C4PropertyName k) const
Definition: C4PropList.h:107
C4StringTable Strings
Definition: C4Globals.cpp:42

Here is the caller graph for this function:

C4AulFunc * C4PropList::GetFunc ( C4String k) const
inherited

Definition at line 758 of file C4PropList.cpp.

References C4Set< T >::Get(), C4PropList::GetFunc(), C4Value::getFunction(), C4PropList::GetPrototype(), C4Set< T >::Has(), and C4Property::Value.

759 {
760  assert(k);
761  if (Properties.Has(k))
762  {
763  return Properties.Get(k).Value.getFunction();
764  }
765  if (GetPrototype())
766  {
767  return GetPrototype()->GetFunc(k);
768  }
769  return 0;
770 }
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
C4AulFunc * GetFunc(C4PropertyName k) const
Definition: C4PropList.h:107
T & Get(H e) const
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
C4AulFunc * getFunction() const
Definition: C4Value.h:119

Here is the call graph for this function:

C4AulFunc * C4PropList::GetFunc ( const char *  k) const
inherited

Definition at line 772 of file C4PropList.cpp.

References C4StringTable::FindString(), C4PropList::GetFunc(), s, and Strings.

773 {
774  assert(s);
775  if (s[0] == '~') ++s;
776  C4String * k = Strings.FindString(s);
777  // this string is entirely unused
778  if (!k)
779  return 0;
780  return GetFunc(k);
781 }
C4String * FindString(const char *strString) const
C4AulFunc * GetFunc(C4PropertyName k) const
Definition: C4PropList.h:107
C4StringTable Strings
Definition: C4Globals.cpp:42
#define s

Here is the call graph for this function:

int32_t C4MapScriptLayer::GetHgt ( ) const
inlineinherited

Definition at line 302 of file C4MapScript.h.

302 { return fg_surface ? fg_surface->Hgt : 0; }
class C4MapScriptMap* C4MapScriptLayer::GetMap ( )
inlineinherited

Definition at line 281 of file C4MapScript.h.

References C4MapScriptLayer::map.

281 { return map; }
class C4MapScriptMap * map
Definition: C4MapScript.h:275
virtual C4MapScriptLayer* C4MapScriptLayer::GetMapScriptLayer ( )
inlinevirtualinherited

Reimplemented from C4PropList.

Definition at line 280 of file C4MapScript.h.

280 { return this; }
virtual C4MapScriptMap* C4MapScriptMap::GetMapScriptMap ( )
inlinevirtual

Reimplemented from C4PropList.

Definition at line 328 of file C4MapScript.h.

328 { return this; }
const char * C4PropList::GetName ( ) const
virtualinherited

Reimplemented in C4PropListStatic.

Definition at line 604 of file C4PropList.cpp.

References C4String::GetCStr(), C4PropList::GetPropertyStr(), P_Name, and s.

Referenced by C4Object::ActivateMenu(), C4Effect::AssignCallbackFunctions(), C4Effect::C4Effect(), C4Object::CanConcatPictureWith(), C4FindObjectAction::Check(), C4Game::CheckObjectEnumeration(), C4Effect::ClearAll(), ConstructionCheck(), C4Effect::DoCall(), C4EditCursor::DoContextMenu(), C4ObjectMenu::DoRefillInternal(), C4Object::Draw(), C4ScriptGuiWindow::Draw(), C4Game::DrawCrewOverheadText(), C4Object::ExecLife(), C4Effect::Get(), C4Effect::GetCount(), C4Object::GetDataString(), C4Object::GetInfoString(), C4Effect::Init(), C4Effect::Kill(), C4Object::Lift(), C4Game::NewObject(), ObjectComDig(), C4Object::Promote(), C4Object::Push(), C4Object::SetAction(), C4Object::SetOCF(), C4Effect::TempRemoveUpperEffects(), C4Object::UpdateOCF(), and C4EditCursor::UpdateStatusBar().

605 {
607  if (!s) return "";
608  return s->GetCStr();
609 }
const char * GetCStr() const
Definition: C4StringTable.h:49
C4String * GetPropertyStr(C4PropertyName k) const
Definition: C4PropList.cpp:730
#define s

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4PropList::GetObject ( )
virtualinherited

Reimplemented in C4Object.

Definition at line 622 of file C4PropList.cpp.

References C4PropList::GetObject(), and C4PropList::GetPrototype().

Referenced by C4Value::_getObj(), C4EditCursor::AddToSelection(), C4ScriptGuiWindowAction::ClearPointers(), ThisImpl< C4Object >::Conv(), C4GameMessage::Draw(), C4ScriptGuiWindowAction::ExecuteCommand(), FnGetEffectsFor(), C4Value::GetDataString(), C4Value::getObj(), C4PropList::GetObject(), C4GameMessage::Init(), Object(), C4GameObjects::ObjectPointer(), C4EditCursor::RemoveFromSelection(), and C4ScriptGuiWindowProperty::Set().

623 {
624  if (GetPrototype()) return GetPrototype()->GetObject();
625  return 0;
626 }
virtual C4Object * GetObject()
Definition: C4PropList.cpp:622
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object const * C4PropList::GetObject ( ) const
virtualinherited

Reimplemented in C4Object.

Definition at line 628 of file C4PropList.cpp.

References C4PropList::GetObject(), and C4PropList::GetPrototype().

629 {
630  if (GetPrototype()) return GetPrototype()->GetObject();
631  return 0;
632 }
virtual C4Object * GetObject()
Definition: C4PropList.cpp:622
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

uint8_t C4MapScriptLayer::GetPix ( int32_t  x,
int32_t  y,
uint8_t  outside_col 
) const
inlineinherited

Definition at line 305 of file C4MapScript.h.

References C4MapScriptLayer::HasSurface().

Referenced by C4MapScriptLayer::IsPixMasked(), and C4MapScriptAlgoLayer::operator()().

305 { return (!HasSurface()||x<0||y<0||x>=fg_surface->Wdt||y>=fg_surface->Hgt) ? outside_col : fg_surface->_GetPix(x,y); }
bool HasSurface() const
Definition: C4MapScript.h:296

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4MapScriptLayer::GetPixCount ( const C4Rect rcBounds,
const C4MapScriptMatTexMask mask 
)
inherited

Definition at line 575 of file C4MapScript.cpp.

References C4MapScriptLayer::HasSurface(), C4Rect::Hgt, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

576 {
577  // safety
578  if (!HasSurface()) return 0;
579  assert(rcBounds.x>=0 && rcBounds.y>=0 && rcBounds.x+rcBounds.Wdt<=fg_surface->Wdt && rcBounds.y+rcBounds.Hgt<=fg_surface->Hgt);
580  // count matching pixels in rect
581  int32_t count = 0;
582  for (int32_t y=rcBounds.y; y<rcBounds.y+rcBounds.Hgt; ++y)
583  for (int32_t x=rcBounds.x; x<rcBounds.x+rcBounds.Wdt; ++x)
584  count += col_mask(fg_surface->_GetPix(x,y), bg_surface->_GetPix(x, y));
585  return count;
586 }
bool HasSurface() const
Definition: C4MapScript.h:296
int32_t Wdt
Definition: C4Rect.h:32
int32_t y
Definition: C4Rect.h:32
int32_t x
Definition: C4Rect.h:32
int32_t Hgt
Definition: C4Rect.h:32

Here is the call graph for this function:

C4ValueArray * C4PropList::GetProperties ( ) const
virtualinherited

Reimplemented in C4Object, and C4Effect.

Definition at line 869 of file C4PropList.cpp.

References a, C4V_String, C4VString(), C4Set< T >::First(), C4PropList::GetProperties(), C4PropList::GetPrototype(), C4ValueArray::GetSize(), C4Set< T >::GetSize(), C4Property::Key, C4Set< T >::Next(), and C4ValueArray::SetSize().

Referenced by C4ScriptGuiWindow::CreateFromPropList(), C4PropList::GetProperties(), C4Effect::GetProperties(), C4Object::GetProperties(), and C4ScriptGuiWindowProperty::Set().

870 {
871  C4ValueArray * a;
872  int i;
873  if (GetPrototype())
874  {
875  a = GetPrototype()->GetProperties();
876  i = a->GetSize();
877  a->SetSize(i + Properties.GetSize());
878  }
879  else
880  {
881  a = new C4ValueArray(Properties.GetSize());
882  i = 0;
883  }
884  const C4Property * p = Properties.First();
885  while (p)
886  {
887  assert(p->Key != nullptr && "Proplist key is nullpointer");
888  (*a)[i++] = C4VString(p->Key);
889  assert(((*a)[i - 1].GetType() == C4V_String) && "Proplist key is non-string");
890  p = Properties.Next(p);
891  }
892  return a;
893 }
#define a
T const * Next(T const *p) const
unsigned int GetSize() const
virtual C4ValueArray * GetProperties() const
Definition: C4PropList.cpp:869
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
void SetSize(int32_t inSize)
int32_t GetSize() const
Definition: C4ValueArray.h:36
C4String * Key
Definition: C4PropList.h:56
C4Value C4VString(C4String *pStr)
Definition: C4Value.h:246
T const * First() const

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PropList::GetProperty ( C4PropertyName  k,
C4Value pResult 
) const
inlineinherited

Definition at line 103 of file C4PropList.h.

References C4PropList::GetPropertyByS(), C4StringTable::P, and Strings.

Referenced by C4MapScriptAlgoFilter::C4MapScriptAlgoFilter(), C4MapScriptAlgoModifier::C4MapScriptAlgoModifier(), C4MapScriptAlgoPolygon::C4MapScriptAlgoPolygon(), C4MapScriptAlgoRndChecker::C4MapScriptAlgoRndChecker(), C4FindObjectProcedure::Check(), C4DefGraphics::Draw(), C4GraphicsOverlay::Draw(), C4Object::DrawFaceImpl(), C4Object::DrawLine(), C4Object::ExecAction(), C4Object::GetAction(), C4Def::GetActionByName(), C4Object::GetDragImage(), C4Object::GetParallaxity(), C4MapScriptAlgo::GetXYProps(), C4GameMessage::Init(), C4Object::IsVisible(), C4ScriptUniform::Push(), C4Object::SetAction(), C4Object::SetActionByName(), and C4GraphicsOverlay::UpdateFacet().

104  { return GetPropertyByS(&Strings.P[k], pResult); }
C4String P[P_LAST]
C4StringTable Strings
Definition: C4Globals.cpp:42
virtual bool GetPropertyByS(const C4String *k, C4Value *pResult) const
Definition: C4PropList.cpp:712

Here is the call graph for this function:

Here is the caller graph for this function:

C4ValueArray * C4PropList::GetPropertyArray ( C4PropertyName  n) const
inherited

Definition at line 744 of file C4PropList.cpp.

References C4Set< T >::Get(), C4Value::getArray(), C4PropList::GetPropertyArray(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, Strings, and C4Property::Value.

Referenced by C4EditCursor::DoContextMenu(), C4PropList::GetPropertyArray(), and C4FoWLight::Update().

745 {
746  C4String * k = &Strings.P[n];
747  if (Properties.Has(k))
748  {
749  return Properties.Get(k).Value.getArray();
750  }
751  if (GetPrototype())
752  {
753  return GetPrototype()->GetPropertyArray(n);
754  }
755  return 0;
756 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
C4ValueArray * getArray() const
Definition: C4Value.h:118
C4ValueArray * GetPropertyArray(C4PropertyName n) const
Definition: C4PropList.cpp:744

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4PropList::GetPropertyBool ( C4PropertyName  n,
bool  default_val = false 
) const
inherited

Definition at line 827 of file C4PropList.cpp.

References C4Set< T >::Get(), C4Value::getBool(), C4PropList::GetPropertyBool(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, Strings, and C4Property::Value.

Referenced by C4PropList::GetPropertyBool().

828 {
829  C4String * k = &Strings.P[n];
830  if (Properties.Has(k))
831  {
832  return Properties.Get(k).Value.getBool();
833  }
834  if (GetPrototype())
835  {
836  return GetPrototype()->GetPropertyBool(n, default_val);
837  }
838  return default_val;
839 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
bool getBool() const
Definition: C4Value.h:113
int32_t GetPropertyBool(C4PropertyName n, bool default_val=false) const
Definition: C4PropList.cpp:827
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PropList::GetPropertyByS ( const C4String k,
C4Value pResult 
) const
virtualinherited

Reimplemented in C4Object, and C4Effect.

Definition at line 712 of file C4PropList.cpp.

References C4Set< T >::Get(), C4PropList::GetPropertyByS(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, P_Prototype, Strings, and C4Property::Value.

Referenced by C4Value::CompileFunc(), C4ScriptGuiWindow::CreateFromPropList(), C4PropList::FreezeAndMakeStaticRecursively(), C4Def::GetActionByName(), C4DefList::GetAllDefs(), C4PropList::GetProperty(), C4PropList::GetPropertyByS(), C4Effect::GetPropertyByS(), C4Object::GetPropertyByS(), C4ValueArraySortPropertycomp::operator()(), C4ScriptGuiWindowProperty::Set(), C4Object::SetActionByName(), C4ScriptHost::UnlinkOwnedFunctions(), C4GraphicsOverlay::UpdateFacet(), and C4AulCompiler::ConstexprEvaluator::visit().

713 {
714  if (Properties.Has(k))
715  {
716  *pResult = Properties.Get(k).Value;
717  return true;
718  }
719  else if (k == &Strings.P[P_Prototype])
720  {
721  *pResult = prototype;
722  return true;
723  }
724  else if(GetPrototype())
725  return GetPrototype()->GetPropertyByS(k, pResult);
726  else
727  return false;
728 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
virtual bool GetPropertyByS(const C4String *k, C4Value *pResult) const
Definition: C4PropList.cpp:712
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4PropList::GetPropertyInt ( C4PropertyName  k,
int32_t  default_val = 0 
) const
inherited

Definition at line 841 of file C4PropList.cpp.

References C4Set< T >::Get(), C4Value::getInt(), C4PropList::GetPropertyInt(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, Strings, and C4Property::Value.

Referenced by C4MouseControl::ButtonUpDragScript(), C4MapScriptAlgoEllipsis::C4MapScriptAlgoEllipsis(), C4MapScriptAlgoLines::C4MapScriptAlgoLines(), C4MapScriptAlgoOffset::C4MapScriptAlgoOffset(), C4MapScriptAlgoPolygon::C4MapScriptAlgoPolygon(), C4MapScriptAlgoRect::C4MapScriptAlgoRect(), C4MapScriptAlgoRndChecker::C4MapScriptAlgoRndChecker(), C4MapScriptAlgoRotate::C4MapScriptAlgoRotate(), C4MapScriptAlgoScale::C4MapScriptAlgoScale(), C4MapScriptAlgoTurbulence::C4MapScriptAlgoTurbulence(), C4Object::Contact(), C4Object::ContactAction(), C4Object::DoBreath(), C4Object::DoEnergy(), C4Object::DoMovement(), C4MouseControl::DragNone(), C4Object::Draw(), C4Object::DrawActionFace(), C4Game::DrawPropListSpecImage(), C4Object::DrawTopFace(), C4Command::Enter(), C4Object::ExecAction(), C4Object::ExecLife(), C4Object::ExecMovement(), C4ValueProviderAction::Execute(), C4Command::Exit(), C4Command::FlightControl(), FnParAlgo(), C4SoundModifierList::Get(), C4SoundModifier::GetBoolProp(), C4SoundModifier::GetFloatProp(), C4Def::GetPlane(), C4PropList::GetPropertyInt(), C4Object::GetSolidMaskPlane(), C4Object::Init(), C4Object::IsVisible(), C4Command::MoveTo(), ObjectActionThrow(), ObjectComDrop(), ObjectComJump(), C4Game::PlaceAnimal(), C4Game::PlaceVegetation(), C4Object::Push(), C4Command::Put(), C4Object::ResetProperty(), C4Object::SetAction(), C4Object::SetDir(), C4Object::SetOCF(), C4Object::SetPhase(), C4Object::SideBounds(), C4Command::Throw(), C4Object::UpdateActionFace(), C4MouseControl::UpdateCursorTarget(), C4GraphicsOverlay::UpdateFacet(), C4Object::UpdateFlipDir(), C4Object::UpdateOCF(), and C4Object::VerticalBounds().

842 {
843  C4String * k = &Strings.P[n];
844  if (Properties.Has(k))
845  {
846  return Properties.Get(k).Value.getInt();
847  }
848  if (GetPrototype())
849  {
850  return GetPrototype()->GetPropertyInt(n, default_val);
851  }
852  return default_val;
853 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
int32_t getInt() const
Definition: C4Value.h:112
int32_t GetPropertyInt(C4PropertyName k, int32_t default_val=0) const
Definition: C4PropList.cpp:841

Here is the call graph for this function:

Here is the caller graph for this function:

C4PropertyName C4PropList::GetPropertyP ( C4PropertyName  k) const
inherited

Definition at line 810 of file C4PropList.cpp.

References C4Set< T >::Get(), C4PropList::GetPropertyP(), C4PropList::GetPrototype(), C4Value::getStr(), C4Set< T >::Has(), C4StringTable::P, P_LAST, Strings, and C4Property::Value.

Referenced by C4Object::ContactAction(), C4Object::ExecAction(), C4Object::ExecMovement(), C4Object::GetProcedure(), C4PropList::GetPropertyP(), ObjectComDrop(), C4Object::SetAction(), C4Object::SideBounds(), and C4Object::VerticalBounds().

811 {
812  C4String * k = &Strings.P[n];
813  if (Properties.Has(k))
814  {
815  C4String * v = Properties.Get(k).Value.getStr();
816  if (v >= &Strings.P[0] && v < &Strings.P[P_LAST])
817  return C4PropertyName(v - &Strings.P[0]);
818  return P_LAST;
819  }
820  if (GetPrototype())
821  {
822  return GetPrototype()->GetPropertyP(n);
823  }
824  return P_LAST;
825 }
C4PropertyName GetPropertyP(C4PropertyName k) const
Definition: C4PropList.cpp:810
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
C4String * getStr() const
Definition: C4Value.h:117
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
C4PropertyName

Here is the call graph for this function:

Here is the caller graph for this function:

C4PropList * C4PropList::GetPropertyPropList ( C4PropertyName  k) const
inherited

Definition at line 855 of file C4PropList.cpp.

References C4Set< T >::Get(), C4PropList::GetPropertyPropList(), C4Value::getPropList(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, Strings, and C4Property::Value.

Referenced by C4MapScriptAlgoLayer::C4MapScriptAlgoLayer(), C4Game::DrawPropListSpecImage(), C4PropList::GetPropertyPropList(), and C4GameMessage::Init().

856 {
857  C4String * k = &Strings.P[n];
858  if (Properties.Has(k))
859  {
860  return Properties.Get(k).Value.getPropList();
861  }
862  if (GetPrototype())
863  {
864  return GetPrototype()->GetPropertyPropList(n);
865  }
866  return nullptr;
867 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
C4PropList * GetPropertyPropList(C4PropertyName k) const
Definition: C4PropList.cpp:855
C4PropList * getPropList() const
Definition: C4Value.h:116

Here is the call graph for this function:

Here is the caller graph for this function:

C4String * C4PropList::GetPropertyStr ( C4PropertyName  k) const
inherited

Definition at line 730 of file C4PropList.cpp.

References C4Set< T >::Get(), C4PropList::GetPropertyStr(), C4PropList::GetPrototype(), C4Value::getStr(), C4Set< T >::Has(), C4StringTable::P, Strings, and C4Property::Value.

Referenced by C4Game::DrawPropListSpecImage(), C4Object::ExecAction(), C4PropList::GetName(), C4PropListStatic::GetName(), C4PropList::GetPropertyStr(), C4Object::SetAction(), C4Object::SetDir(), C4MouseControl::UpdateCursorTarget(), and C4GraphicsOverlay::UpdateFacet().

731 {
732  C4String * k = &Strings.P[n];
733  if (Properties.Has(k))
734  {
735  return Properties.Get(k).Value.getStr();
736  }
737  if (GetPrototype())
738  {
739  return GetPrototype()->GetPropertyStr(n);
740  }
741  return 0;
742 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
C4String * getStr() const
Definition: C4Value.h:117
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
C4String * GetPropertyStr(C4PropertyName k) const
Definition: C4PropList.cpp:730

Here is the call graph for this function:

Here is the caller graph for this function:

C4PropListNumbered * C4PropListNumbered::GetPropListNumbered ( )
virtualinherited

Reimplemented from C4PropList.

Definition at line 175 of file C4PropList.cpp.

176 {
177  return this;
178 }
C4PropList* C4PropList::GetPrototype ( ) const
inlineinherited
std::vector< C4String * > C4PropList::GetSortedLocalProperties ( bool  add_prototype = true) const
inherited

Definition at line 535 of file C4PropList.cpp.

References C4Set< T >::GetSortedListOfElementPointers(), C4StringTable::P, P_Prototype, and Strings.

Referenced by C4PropList::FreezeAndMakeStaticRecursively().

536 {
537  // return property list without descending into prototype
538  std::list<const C4Property *> sorted_props = Properties.GetSortedListOfElementPointers();
539  std::vector< C4String * > result;
540  result.reserve(sorted_props.size() + add_prototype);
541  if (add_prototype) result.push_back(&::Strings.P[P_Prototype]); // implicit prototype for every prop list
542  for (auto p : sorted_props) result.push_back(p->Key);
543  return result;
544 }
C4String P[P_LAST]
std::list< const T * > GetSortedListOfElementPointers() const
C4StringTable Strings
Definition: C4Globals.cpp:42

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< C4String * > C4PropList::GetSortedLocalProperties ( const char *  prefix,
const C4PropList ignore_overridden 
) const
inherited

Definition at line 546 of file C4PropList.cpp.

References a, b, C4Set< T >::First(), C4String::GetCStr(), C4PropList::GetPrototype(), C4PropList::HasProperty(), C4Set< T >::Next(), C4StringTable::P, P_Prototype, and Strings.

547 {
548  // return property list without descending into prototype
549  // ignore properties that have been overridden by proplist given in ignore_overridden or any of its prototypes up to and excluding this
550  std::vector< C4String * > result;
551  for (const C4Property *pp = Properties.First(); pp; pp = Properties.Next(pp))
552  if (pp->Key != &::Strings.P[P_Prototype])
553  if (!prefix || pp->Key->GetData().BeginsWith(prefix))
554  {
555  // Override check
556  const C4PropList *check = ignore_overridden;
557  bool overridden = false;
558  if (check && check != this)
559  {
560  if (check->HasProperty(pp->Key)) { overridden = true; break; }
561  check = check->GetPrototype();
562  }
563  result.push_back(pp->Key);
564  }
565  // Sort
566  std::sort(result.begin(), result.end(), [](const C4String *a, const C4String *b) -> bool
567  {
568  return strcmp(a->GetCStr(), b->GetCStr()) < 0;
569  });
570  return result;
571 }
C4String P[P_LAST]
#define b
const char * GetCStr() const
Definition: C4StringTable.h:49
#define a
T const * Next(T const *p) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
bool HasProperty(C4String *k) const
Definition: C4PropList.h:120
T const * First() const

Here is the call graph for this function:

std::vector< C4String * > C4PropList::GetSortedProperties ( const char *  prefix,
C4PropList ignore_parent = nullptr 
) const
inherited

Definition at line 591 of file C4PropList.cpp.

References a, b, C4String::GetCStr(), and C4PropList::GetUnsortedProperties().

592 {
593  // Return property list with descending into prototype
594  // But do not include Prototype property
595  std::vector< C4String * > result = GetUnsortedProperties(prefix, ignore_parent);
596  // Sort
597  std::sort(result.begin(), result.end(), [](const C4String *a, const C4String *b) -> bool
598  {
599  return strcmp(a->GetCStr(), b->GetCStr()) < 0;
600  });
601  return result;
602 }
#define b
const char * GetCStr() const
Definition: C4StringTable.h:49
#define a
std::vector< C4String * > GetUnsortedProperties(const char *prefix, C4PropList *ignore_parent=nullptr) const
Definition: C4PropList.cpp:573

Here is the call graph for this function:

std::vector< C4String * > C4PropList::GetUnsortedProperties ( const char *  prefix,
C4PropList ignore_parent = nullptr 
) const
inherited

Definition at line 573 of file C4PropList.cpp.

References C4Set< T >::First(), C4PropList::GetPrototype(), C4Set< T >::Next(), C4StringTable::P, P_Prototype, and Strings.

Referenced by C4PropList::GetSortedProperties().

574 {
575  // Return property list with descending into prototype
576  // But do not include Prototype property
577  std::vector< C4String * > result;
578  const C4PropList *p = this;
579  do
580  {
581  for (const C4Property *pp = p->Properties.First(); pp; pp = p->Properties.Next(pp))
582  if (pp->Key != &::Strings.P[P_Prototype])
583  if (!prefix || pp->Key->GetData().BeginsWith(prefix))
584  result.push_back(pp->Key);
585  p = p->GetPrototype();
586  if (p == ignore_parent) break;
587  } while (p);
588  return result;
589 }
C4String P[P_LAST]
T const * Next(T const *p) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
T const * First() const

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4MapScriptLayer::GetWdt ( ) const
inlineinherited

Definition at line 301 of file C4MapScript.h.

301 { return fg_surface ? fg_surface->Wdt : 0; }
bool C4PropList::HasProperty ( C4String k) const
inlineinherited

Definition at line 120 of file C4PropList.h.

References C4Set< T >::Has().

Referenced by C4PropList::GetSortedLocalProperties(), C4MapScriptAlgo::GetXYProps(), C4AulCompiler::PreparseAstVisitor::visit(), and C4AulCompiler::ConstantResolver::visit().

120 { return Properties.Has(k); }
bool Has(H e) const

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4MapScriptLayer::HasSurface ( ) const
inlineinherited

Definition at line 296 of file C4MapScript.h.

Referenced by C4MapScriptLayer::Blit(), C4MapScriptLayer::ConvertSkyToTransparent(), C4MapScriptLayer::Fill(), C4MapScriptLayer::FindPos(), C4MapScriptLayer::GetBackPix(), C4MapScriptLayer::GetPix(), C4MapScriptLayer::GetPixCount(), and C4MapScriptLayer::SetPix().

296 { return fg_surface && fg_surface->Bits && bg_surface && bg_surface->Bits; }

Here is the caller graph for this function:

bool C4PropList::IsFrozen ( ) const
inlineinherited

Definition at line 132 of file C4PropList.h.

132 { return constant; }
virtual bool C4PropListNumbered::IsNumbered ( ) const
inlinevirtualinherited

Reimplemented from C4PropList.

Definition at line 221 of file C4PropList.h.

221 { return true; }
bool C4MapScriptLayer::IsPixMasked ( int32_t  x,
int32_t  y 
) const
inlineinherited

Definition at line 308 of file C4MapScript.h.

References C4MapScriptLayer::GetBackPix(), and C4MapScriptLayer::GetPix().

308 { return GetPix(x,y,0) != 0 || GetBackPix(x,y,0) != 0; } // masking: If pixel is inside surface and not transparent
uint8_t GetBackPix(int32_t x, int32_t y, uint8_t outside_col) const
Definition: C4MapScript.h:306
uint8_t GetPix(int32_t x, int32_t y, uint8_t outside_col) const
Definition: C4MapScript.h:305

Here is the call graph for this function:

virtual class C4PropListStatic* C4PropList::IsStatic ( )
inlinevirtualinherited

Reimplemented in C4PropListStatic.

Definition at line 87 of file C4PropList.h.

Referenced by C4PropList::AppendDataString(), C4Effect::CompileFunc(), C4Value::CompileFunc(), C4ScriptHost::CopyPropList(), C4Value::Denumerate(), C4AulExec::DirectExec(), C4PropList::FreezeAndMakeStaticRecursively(), C4Value::GetDataString(), C4ExtraScriptHost::GetPropList(), C4GameScriptHost::GetPropList(), C4PropList::ToJSON(), C4Value::ToJSON(), and C4AulCompiler::ConstexprEvaluator::visit().

87 { return nullptr; }

Here is the caller graph for this function:

const class C4PropListStatic* C4PropList::IsStatic ( ) const
inlineinherited

Definition at line 88 of file C4PropList.h.

References C4PropList::IsStatic().

Referenced by C4PropList::IsStatic().

88 { return const_cast<C4PropList*>(this)->IsStatic(); }
virtual class C4PropListStatic * IsStatic()
Definition: C4PropList.h:87

Here is the call graph for this function:

Here is the caller graph for this function:

C4PropList * C4PropList::New ( C4PropList prototype = 0)
staticinherited

Definition at line 64 of file C4PropList.cpp.

Referenced by CompileNewFunc(), FnPlaceVegetation(), C4ScriptGuiWindowProperty::ToC4Value(), C4ScriptGuiWindow::ToC4Value(), and C4AulCompiler::ConstexprEvaluator::visit().

65 {
66  C4PropList * r = new C4PropListScript(prototype);
67  return r;
68 }

Here is the caller graph for this function:

C4PropListStatic * C4PropList::NewStatic ( C4PropList prototype,
const C4PropListStatic parent,
C4String key 
)
staticinherited

Definition at line 70 of file C4PropList.cpp.

Referenced by C4PropListScen::C4PropListScen(), C4ScriptHost::CopyPropList(), C4PropList::FreezeAndMakeStaticRecursively(), C4ScenarioParameterDefs::RegisterScriptConstants(), and C4AulCompiler::ConstexprEvaluator::visit().

71 {
72  return new C4PropListStatic(prototype, parent, key);
73 }

Here is the caller graph for this function:

bool C4PropList::operator== ( const C4PropList b) const
inherited

Definition at line 358 of file C4PropList.cpp.

References C4Set< T >::First(), C4Set< T >::Get(), C4PropList::GetDef(), C4Set< T >::GetSize(), C4PropList::IsNumbered(), C4Property::Key, C4Set< T >::Next(), and C4Property::Value.

359 {
360  // every numbered proplist has a unique number and is only identical to itself
361  if (this == &b) return true;
362  if (IsNumbered() || b.IsNumbered()) return false;
363  if (Properties.GetSize() != b.Properties.GetSize()) return false;
364  if (GetDef() != b.GetDef()) return false;
365  const C4Property * p = Properties.First();
366  while (p)
367  {
368  const C4Property & bp = b.Properties.Get(p->Key);
369  if (!bp) return false;
370  if (p->Value != bp.Value) return false;
371  p = Properties.Next(p);
372  }
373  return true;
374 }
C4Value Value
Definition: C4PropList.h:57
virtual C4Def const * GetDef() const
Definition: C4PropList.cpp:640
T & Get(H e) const
T const * Next(T const *p) const
unsigned int GetSize() const
C4String * Key
Definition: C4PropList.h:56
virtual bool IsNumbered() const
Definition: C4PropList.h:90
T const * First() const

Here is the call graph for this function:

std::pair<std::unique_ptr<CSurface8>, std::unique_ptr<CSurface8> > C4MapScriptLayer::ReleaseSurfaces ( )
inlineinherited

Definition at line 292 of file C4MapScript.h.

293  {
294  return std::make_pair(std::move(fg_surface), std::move(bg_surface));
295  }
void C4PropList::RemoveCyclicPrototypes ( )
inherited

Definition at line 409 of file C4PropList.cpp.

References C4Value::getPropList(), and C4Value::Set0().

Referenced by C4PropList::Denumerate().

410 {
411  // clear any cyclic prototype chains
412  // Use prototype.getPropList() instead of GetPrototype() because denumeration might not be completed yet
413  for(C4PropList * it = prototype.getPropList(); it; it = it->prototype.getPropList())
414  if(it == this)
415  {
416  prototype.Set0();
417  }
418 }
void Set0()
Definition: C4Value.h:336
C4PropList * getPropList() const
Definition: C4Value.h:116

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropListNumbered::ResetEnumerationIndex ( )
staticinherited

Definition at line 99 of file C4PropList.cpp.

References C4PropListNumbered::EnumerationIndex, C4Set< T >::GetSize(), and C4PropListNumbered::PropLists.

Referenced by C4Game::Clear().

100 {
101  assert(!PropLists.GetSize());
102  EnumerationIndex = 0;
103 }
unsigned int GetSize() const
static C4Set< C4PropListNumbered * > PropLists
Definition: C4PropList.h:237
static int32_t EnumerationIndex
Definition: C4PropList.h:239

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropList::ResetProperty ( C4String k)
virtualinherited

Reimplemented in C4Object, and C4Effect.

Definition at line 928 of file C4PropList.cpp.

References C4StringTable::P, P_Prototype, C4Set< T >::Remove(), C4Value::Set0(), and Strings.

Referenced by C4Effect::ResetProperty(), C4Object::ResetProperty(), C4PropList::SetName(), and C4ScriptHost::UnlinkOwnedFunctions().

929 {
930  if (k == &Strings.P[P_Prototype])
931  prototype.Set0();
932  else
933  Properties.Remove(k);
934 }
C4String P[P_LAST]
void Set0()
Definition: C4Value.h:336
C4StringTable Strings
Definition: C4Globals.cpp:42
void Remove(H e)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropListNumbered::SetEnumerationIndex ( int32_t  iMaxObjectNumber)
staticinherited

Definition at line 93 of file C4PropList.cpp.

References C4PropListNumbered::EnumerationIndex.

Referenced by C4Game::CheckObjectEnumeration(), and C4GameObjects::PostLoad().

94 {
95  // update object enumeration index now, because calls like OnSynchronized might create objects
96  EnumerationIndex = std::max(EnumerationIndex, iMaxObjectNumber);
97 }
static int32_t EnumerationIndex
Definition: C4PropList.h:239

Here is the caller graph for this function:

void C4PropList::SetName ( const char *  NewName = 0)
virtualinherited

Reimplemented in C4Object.

Definition at line 611 of file C4PropList.cpp.

References C4VString(), C4StringTable::P, P_Name, C4PropList::ResetProperty(), C4PropList::SetProperty(), and Strings.

Referenced by c4_mapgen_handle_set_map_library(), C4MapScriptHost::InitFunctionMap(), and C4Object::SetName().

612 {
613  if (!NewName)
615  else
616  {
617  SetProperty(P_Name, C4VString(NewName));
618  }
619 }
virtual void ResetProperty(C4String *k)
Definition: C4PropList.cpp:928
C4String P[P_LAST]
void SetProperty(C4PropertyName k, const C4Value &to)
Definition: C4PropList.h:122
C4StringTable Strings
Definition: C4Globals.cpp:42
C4Value C4VString(C4String *pStr)
Definition: C4Value.h:246

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void C4PropList::SetOnFire ( bool  OnFire)
inlinevirtualinherited

Reimplemented in C4Object.

Definition at line 71 of file C4PropList.h.

Referenced by C4Effect::ClearAll(), C4Effect::Init(), C4Effect::Kill(), C4Effect::TempReaddUpperEffects(), and C4Effect::TempRemoveUpperEffects().

71 { }

Here is the caller graph for this function:

bool C4MapScriptLayer::SetPix ( int32_t  x,
int32_t  y,
uint8_t  fg,
uint8_t  bg 
) const
inlineinherited

Definition at line 307 of file C4MapScript.h.

References C4MapScriptLayer::HasSurface().

307 { if (!HasSurface()||x<0||y<0||x>=bg_surface->Wdt||y>=bg_surface->Hgt) return false; fg_surface->_SetPix(x,y,fg); bg_surface->_SetPix(x,y,bg); return true; }
bool HasSurface() const
Definition: C4MapScript.h:296

Here is the call graph for this function:

void C4PropList::SetProperty ( C4PropertyName  k,
const C4Value to 
)
inlineinherited

Definition at line 122 of file C4PropList.h.

References C4StringTable::P, C4PropList::SetPropertyByS(), and Strings.

Referenced by C4Effect::C4Effect(), C4Object::ChangeDef(), C4Object::Init(), C4DefScriptHost::Parse(), C4ScriptHost::Preparse(), C4Object::SetAction(), C4PropList::SetName(), C4ScriptGuiWindow::ToC4Value(), C4ScriptHost::UnLink(), and C4MapScriptLayer::UpdateSurfaceSize().

123  { SetPropertyByS(&Strings.P[k], to); }
C4String P[P_LAST]
C4StringTable Strings
Definition: C4Globals.cpp:42
virtual void SetPropertyByS(C4String *k, const C4Value &to)
Definition: C4PropList.cpp:907

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropList::SetPropertyByS ( C4String k,
const C4Value to 
)
virtualinherited

Reimplemented in C4Object, C4PropListScen, and C4Effect.

Definition at line 907 of file C4PropList.cpp.

References C4Set< T >::Add(), C4Set< T >::Get(), C4Value::getPropList(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, P_Prototype, C4Value::SetPropList(), Strings, and C4Property::Value.

Referenced by C4AulDefFunc::C4AulDefFunc(), C4PropListScen::C4PropListScen(), C4ScriptHost::CopyPropList(), C4PropList::SetProperty(), C4Effect::SetPropertyByS(), C4PropListScen::SetPropertyByS(), C4Object::SetPropertyByS(), C4ScriptGuiWindowProperty::ToC4Value(), C4ScriptGuiWindow::ToC4Value(), C4ScriptHost::UnlinkOwnedFunctions(), C4AulCompiler::PreparseAstVisitor::visit(), C4AulCompiler::ConstexprEvaluator::visit(), and C4AulCompiler::ConstantResolver::visit().

908 {
909  assert(!constant);
910  if (k == &Strings.P[P_Prototype])
911  {
912  C4PropList * newpt = to.getPropList();
913  for(C4PropList * it = newpt; it; it = it->GetPrototype())
914  if(it == this)
915  throw C4AulExecError("Trying to create cyclic prototype structure");
916  prototype.SetPropList(newpt);
917  }
918  else if (Properties.Has(k))
919  {
920  Properties.Get(k).Value = to;
921  }
922  else
923  {
924  Properties.Add(C4Property(k, to));
925  }
926 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
T * Add(T const &e)
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
void SetPropList(C4PropList *PropList)
Definition: C4Value.h:141
C4PropList * getPropList() const
Definition: C4Value.h:116

Here is the call graph for this function:

Here is the caller graph for this function:

void C4MapScriptLayer::SetSurfaces ( std::unique_ptr< CSurface8 fg,
std::unique_ptr< CSurface8 bg 
)
inlineinherited

Definition at line 286 of file C4MapScript.h.

References C4MapScriptLayer::UpdateSurfaceSize().

287  {
288  fg_surface = std::move(fg);
289  bg_surface = std::move(bg);
291  }
void UpdateSurfaceSize()

Here is the call graph for this function:

void C4PropListNumbered::ShelveNumberedPropLists ( )
staticinherited

Definition at line 105 of file C4PropList.cpp.

References C4PropListNumbered::ClearNumber(), C4Set< T >::First(), C4Set< T >::GetSize(), C4Set< T >::Next(), C4PropListNumbered::Number, C4PropListNumbered::PropLists, and C4PropListNumbered::ShelvedPropLists.

Referenced by C4Game::CompileFunc().

106 {
107  // unnumber all proplists and put them on the shelve. To be used on remaining objects before a savegame load.
108  assert(ShelvedPropLists.empty());
110  C4PropListNumbered *const* p_next = PropLists.First(), *const* p;
111  while ((p = p_next))
112  {
113  p_next = PropLists.Next(p);
114  C4PropListNumbered *pl = *p;
115  if (pl->Number != -1)
116  {
117  pl->ClearNumber();
118  ShelvedPropLists.push_back(pl);
119  }
120  }
121 }
static std::vector< C4PropListNumbered * > ShelvedPropLists
Definition: C4PropList.h:238
T const * Next(T const *p) const
unsigned int GetSize() const
static C4Set< C4PropListNumbered * > PropLists
Definition: C4PropList.h:237
T const * First() const

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropList::Thaw ( )
inlineinherited

Definition at line 131 of file C4PropList.h.

Referenced by C4AulScriptEngine::UnLink(), and C4ScriptHost::UnlinkOwnedFunctions().

131 { constant = false; }

Here is the caller graph for this function:

StdStrBuf C4PropList::ToJSON ( int  depth = 10,
bool  ignore_reference_parent = false 
) const
inherited

Definition at line 515 of file C4PropList.cpp.

References StdStrBuf::Append(), C4PropList::C4Value, C4Set< T >::GetSize(), C4Set< T >::GetSortedListOfElementPointers(), and C4PropList::IsStatic().

Referenced by C4Value::ToJSON().

516 {
517  if (depth <= 0 && Properties.GetSize())
518  {
519  throw new C4JSONSerializationError("maximum depth reached");
520  }
521  StdStrBuf DataString;
522  DataString = "{";
523  std::list<const C4Property *> sorted_props = Properties.GetSortedListOfElementPointers();
524  for (std::list<const C4Property *>::const_iterator p = sorted_props.begin(); p != sorted_props.end(); ++p)
525  {
526  if (p != sorted_props.begin()) DataString.Append(",");
527  DataString.Append(C4Value((*p)->Key).ToJSON());
528  DataString.Append(":");
529  DataString.Append((*p)->Value.ToJSON(depth - 1, ignore_reference_parent ? IsStatic() : nullptr));
530  }
531  DataString.Append("}");
532  return DataString;
533 }
std::list< const T * > GetSortedListOfElementPointers() const
friend class C4Value
Definition: C4PropList.h:166
virtual class C4PropListStatic * IsStatic()
Definition: C4PropList.h:87
unsigned int GetSize() const
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropListNumbered::UnshelveNumberedPropLists ( )
staticinherited

Definition at line 123 of file C4PropList.cpp.

References C4PropListNumbered::ShelvedPropLists.

Referenced by C4Game::LoadScenarioSection(), and C4GameObjects::PostLoad().

124 {
125  // re-insert shelved proplists into main list and give them a number
126  for (std::vector<C4PropListNumbered *>::iterator i=ShelvedPropLists.begin(); i!=ShelvedPropLists.end(); ++i)
127  (*i)->AcquireNumber();
128  ShelvedPropLists.clear();
129 }
static std::vector< C4PropListNumbered * > ShelvedPropLists
Definition: C4PropList.h:238

Here is the caller graph for this function:

void C4MapScriptLayer::UpdateSurfaceSize ( )
inherited

Definition at line 480 of file C4MapScript.cpp.

References C4VInt(), P_Hgt, P_Wdt, and C4PropList::SetProperty().

Referenced by C4MapScriptLayer::CreateSurface(), and C4MapScriptLayer::SetSurfaces().

481 {
482  // Called when surface size changes: Update internal property values
483  if (fg_surface)
484  {
485  SetProperty(P_Wdt, C4VInt(fg_surface->Wdt));
486  SetProperty(P_Hgt, C4VInt(fg_surface->Hgt));
487  }
488 }
C4Value C4VInt(int32_t i)
Definition: C4Value.h:242
void SetProperty(C4PropertyName k, const C4Value &to)
Definition: C4PropList.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

int32_t C4PropListNumbered::EnumerationIndex = 0
staticprotectedinherited
class C4MapScriptMap* C4MapScriptLayer::map
protectedinherited

Definition at line 275 of file C4MapScript.h.

Referenced by C4MapScriptMap(), and C4MapScriptLayer::GetMap().

std::vector< C4PropListNumbered * > C4PropListNumbered::ShelvedPropLists
staticprotectedinherited
int32_t C4PropList::Status
inherited

Definition at line 169 of file C4PropList.h.

Referenced by C4Command::Acquire(), C4Command::Activate(), C4GameObjects::Add(), C4ObjectList::Add(), C4FoW::Add(), C4EditCursor::AddToSelection(), C4Object::AssignDeath(), C4ObjectList::AssignInfo(), C4Object::AssignRemoval(), C4Object::At(), C4PropList::Call(), C4Game::CastObjects(), C4ObjectList::CheckCategorySort(), C4ObjectList::CheckSort(), C4Effect::ClearAll(), C4ObjectList::ClearInfo(), C4Object::Collect(), C4Object::CompileFunc(), C4GameObjects::CrossCheck(), C4ObjectList::DeleteObjects(), C4ObjectList::Denumerate(), C4Landscape::P::DigMaterial2Objects(), C4Object::DirectComContents(), C4Effect::DoDamage(), C4Object::Draw(), C4Game::DrawCrewOverheadText(), C4Object::DrawSelectMark(), C4Object::DrawTopFace(), C4EditCursor::EMMoveObject(), C4Object::Enter(), C4Object::ExecAction(), C4SoundInstance::Execute(), C4Effect::Execute(), C4Object::Execute(), C4ScriptGuiWindowAction::ExecuteCommand(), C4Command::Fail(), C4FindObject::Find(), C4ObjectList::Find(), C4ObjectList::FindOther(), C4GameObjects::FixObjectOrder(), C4PropList::FreezeAndMakeStaticRecursively(), C4Object::GetArea(), C4EditCursor::GetCurrentSelectionPosition(), C4Object::GetEntranceArea(), C4Object::GetInfoString(), C4ObjectList::GetListID(), C4Object::GetMomentum(), C4ObjectList::GetObject(), C4Object::GrabInfo(), GrabLost(), C4GameObjects::GRBroadcast(), C4GameMessage::Init(), C4Effect::Init(), C4Object::IsMoveableBySolidMask(), C4GraphicsOverlay::IsValid(), C4Object::Lift(), C4ObjectList::ListIDCount(), C4Player::MakeCrewMember(), C4ObjectList::MassCount(), C4Object::MenuCommand(), C4GameMessageList::New(), C4Game::NewObject(), ObjectComGrab(), ObjectComUnGrab(), C4ObjectList::ObjectCount(), C4EditCursor::PerformDuplicationLegacy(), C4Landscape::P::PostFreeShape(), C4GameObjects::PostLoad(), C4Object::Push(), C4GameObjects::Remove(), C4EditCursor::RemoveFromSelection(), C4AulScriptContext::ReturnDump(), C4GameObjects::SafeObjectPointer(), C4Object::SetAction(), C4Object::SetGraphics(), C4GameObjects::SetOCF(), C4Object::SetOCF(), C4Object::StatusActivate(), C4Object::StatusDeactivate(), C4Effect::TempReaddUpperEffects(), C4Effect::TempRemoveUpperEffects(), C4ObjectList::UpdateFaces(), C4ObjectList::UpdateGraphics(), C4Object::UpdateOCF(), C4Object::UpdatePos(), C4Object::UpdateSolidMask(), C4GameObjects::UpdateSolidMasks(), C4ObjectList::ValidateOwners(), and C4ObjectList::Write().


The documentation for this class was generated from the following files: