source: abuse/trunk/src/specache.hpp @ 97

Last change on this file since 97 was 57, checked in by Sam Hocevar, 12 years ago
  • Move each header to the same directory as its corresponding source, to get a better idea of which files are likely to export symbols.
File size: 1.2 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *
5 *  This software was released into the Public Domain. As with most public
6 *  domain software, no warranty is made or implied by Crack dot Com or
7 *  Jonathan Clark.
8 */
9
10#ifndef __SPECACHE_HPP_
11#define __SPECACHE_HPP_
12
13#include "specs.hpp"
14
15
16class spec_directory_cache
17{
18  class filename_node
19  {
20    public :
21    filename_node *left,*right,*next;
22    char *fn;
23    spec_directory *sd;
24    char *filename() { return fn; }
25    filename_node(char const *filename, spec_directory *dir)
26    {
27      fn=(char *)memcpy(jmalloc(strlen(filename)+1,"spec_dir cache"),filename,strlen(filename)+1);
28      sd=dir;
29      next=left=right=0;     
30    }
31    long size;
32  } *fn_root,*fn_list;
33  void clear(filename_node *f); // private recursive member 
34  long size;
35  public :
36  spec_directory *get_spec_directory(char const *filename, bFILE *fp=NULL);
37  spec_directory_cache() { fn_root=0; size=0; }
38  void clear();                             // frees up all allocated memory
39  void load(bFILE *fp);
40  void save(bFILE *fp);
41  ~spec_directory_cache() { clear(); }
42} ;
43
44extern spec_directory_cache sd_cache;
45
46#endif
Note: See TracBrowser for help on using the repository browser.