source: golgotha/src/golg/map_data.cc

Last change on this file was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.2 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "map_data.hh"
10#include <string.h>
11
12g1_map_data_class *g1_map_data_class::first=0;
13
14g1_map_data_class::g1_map_data_class(char *name)
15  : name(name)
16{
17  if (!first)
18  {
19    next=first;
20    first=this;
21  }
22  else
23  {
24    g1_map_data_class *last=0;
25    g1_map_data_class *p;
26    for (p=first; p && strcmp(p->name,name)>0;)
27    {
28      last=p;
29      p=p->next;
30    }
31
32    if (last)
33    {
34      p->next=last->next;
35      last->next=p;
36    }
37    else
38    {
39      next=first;
40      first=this;
41    }     
42  }
43}
44
45
46g1_map_data_class::~g1_map_data_class()
47{
48  if (this==first)
49    first=first->next;
50  else
51  {
52    g1_map_data_class *p;
53    for (p=first; p->next!=this; p=p->next);
54    p->next=next;
55  }
56}
Note: See TracBrowser for help on using the repository browser.