source: abuse/trunk/src/specache.h @ 682

Last change on this file since 682 was 555, checked in by Sam Hocevar, 8 years ago

ps3: make everything compile on the PS3. Of course, nothing links yet
because so much support is missing.

  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#ifndef __SPECACHE_HPP_
12#define __SPECACHE_HPP_
13
14#include "specs.h"
15
16#include <string.h>
17
18class spec_directory_cache
19{
20  class filename_node
21  {
22    public :
23    filename_node *left,*right,*next;
24    char *fn;
25    spec_directory *sd;
26    char *filename() { return fn; }
27    filename_node(char const *filename, spec_directory *dir)
28    {
29      fn = strdup(filename);
30      sd = dir;
31      next = left = right = 0;
32    }
33    long size;
34  } *fn_root,*fn_list;
35  void clear(filename_node *f); // private recursive member
36  long size;
37  public :
38  spec_directory *get_spec_directory(char const *filename, bFILE *fp=NULL);
39  spec_directory_cache() { fn_root=0; size=0; }
40  void clear();                             // frees up all allocated memory
41  void load(bFILE *fp);
42  void save(bFILE *fp);
43  ~spec_directory_cache() { clear(); }
44} ;
45
46extern spec_directory_cache sd_cache;
47
48#endif
Note: See TracBrowser for help on using the repository browser.