//
      // Constructor
      //
      Item::Item(Record *record, void *data) : record(record), data(data)
      {
        items.Append(this);

        // Update cache size
        curCacheSize += record->fastFind->Size();
      }
Esempio n. 2
0
  //
  // Load
  //
  // Load a list of tasks
  //
  void LoadTasks(GameObj *subject, FScope *fScope, NList<Task> &tasks)
  {
    // Iterate the scope
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x40B71B7D: // "Task"
          tasks.Append(LoadTask(subject, sScope));
          break;
      }
    }
  }
Esempio n. 3
0
  //
  // Init
  //
  // Initialize system
  //
  void Init()
  {
    ASSERT(!initialized)
    ASSERT(!items.GetCount())

    PTree pTree;

    // Process the configuration
    if (pTree.AddFile(configName))
    {
      FScope *fScope = pTree.GetGlobalScope();
      FScope *sScope;

      while ((sScope = fScope->NextFunction()) != NULL)
      {
        switch (sScope->NameCrc())
        {
          case 0x64FFFFD7: // "Place"
          {
            // Load the data
            const char *type = StdLoad::TypeString(sScope);
            F32 direction = StdLoad::TypeCompassAngle(sScope);
            F32 distance = StdLoad::TypeF32(sScope);
            F32 orientation = StdLoad::TypeCompassAngle(sScope);

            // Create the item
            items.Append(new Item(type, direction, distance, orientation));
            break;
          }
        }
      }
    }

    // System now initialized
    initialized = TRUE;
  }
Esempio n. 4
0
 //
 // AddDestination
 //
 // Add a global destination
 //
 void AddDestination(Destination *destination)
 {
   ASSERT(destination)
   destinations.Append(destination);
 }