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
|
Rev | Line | |
---|
[56] | 1 | /* |
---|
| 2 | * Abuse - dark 2D side-scrolling platform game |
---|
| 3 | * Copyright (c) 1995 Crack dot Com |
---|
[494] | 4 | * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> |
---|
[56] | 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 | |
---|
[131] | 13 | #include <string.h> |
---|
| 14 | |
---|
[481] | 15 | #include "macs.h" |
---|
| 16 | #include "status.h" |
---|
| 17 | #include "dprint.h" |
---|
[2] | 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; |
---|
[124] | 43 | status_node(char *Name, visual_object *Show, status_node *Next) |
---|
[131] | 44 | { name = strdup(Name); |
---|
| 45 | show = Show; |
---|
| 46 | next = Next; |
---|
[2] | 47 | } |
---|
[129] | 48 | ~status_node() { free(name); if (show) delete show; } |
---|
[2] | 49 | } |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | void StatusManager::push(char *name, visual_object *show) |
---|
| 55 | { |
---|
[124] | 56 | first=new status_node(name,show,first); |
---|
[2] | 57 | } |
---|
| 58 | |
---|
| 59 | void StatusManager::update(int percentage) |
---|
| 60 | { |
---|
| 61 | dprintf("\r%s [\n"); |
---|
| 62 | int t=percentage/5; |
---|
[494] | 63 | for (int i=0; i<t; i++) |
---|
[2] | 64 | dprintf("."); |
---|
[494] | 65 | for (i=t+1; i<20; i++) |
---|
[2] | 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.