Last change
on this file since 494 was
494,
checked in by Sam Hocevar, 12 years ago
|
style: remove trailing spaces, fix copyright statements.
|
File size:
1.4 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 or |
---|
8 | * Jonathan Clark. |
---|
9 | */ |
---|
10 | |
---|
11 | #include "config.h" |
---|
12 | |
---|
13 | #include <string.h> |
---|
14 | |
---|
15 | #include "macs.h" |
---|
16 | #include "status.h" |
---|
17 | #include "dprint.h" |
---|
18 | |
---|
19 | class status_node; |
---|
20 | |
---|
21 | class StatusManager |
---|
22 | { |
---|
23 | status_node *first; |
---|
24 | StatusManager() { first=NULL; } |
---|
25 | virtual void push(char *name, visual_object *show); |
---|
26 | virtual void update(int percentage); |
---|
27 | virtual void pop(); |
---|
28 | } ; |
---|
29 | |
---|
30 | extern StatusManager *stat_man; |
---|
31 | |
---|
32 | |
---|
33 | |
---|
34 | StatusManager *stat_man=NULL; |
---|
35 | |
---|
36 | class status_node |
---|
37 | { |
---|
38 | public : |
---|
39 | char *name; |
---|
40 | status_node *next; |
---|
41 | visual_object *show; |
---|
42 | time_marker last_update; |
---|
43 | status_node(char *Name, visual_object *Show, status_node *Next) |
---|
44 | { name = strdup(Name); |
---|
45 | show = Show; |
---|
46 | next = Next; |
---|
47 | } |
---|
48 | ~status_node() { free(name); if (show) delete show; } |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | void StatusManager::push(char *name, visual_object *show) |
---|
55 | { |
---|
56 | first=new status_node(name,show,first); |
---|
57 | } |
---|
58 | |
---|
59 | void StatusManager::update(int percentage) |
---|
60 | { |
---|
61 | dprintf("\r%s [\n"); |
---|
62 | int t=percentage/5; |
---|
63 | for (int i=0; i<t; i++) |
---|
64 | dprintf("."); |
---|
65 | for (i=t+1; i<20; i++) |
---|
66 | dprintf(" "); |
---|
67 | dprintf("]"); |
---|
68 | } |
---|
69 | |
---|
70 | void StatusManager::pop() |
---|
71 | { |
---|
72 | CONDITION(first,"No status's to pop!"); |
---|
73 | status_node *p=first; first=first->next; |
---|
74 | delete p; |
---|
75 | } |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | |
---|
Note: See
TracBrowser
for help on using the repository browser.