Last change
on this file since 241 was
197,
checked in by Maciej Komosinski, 11 years ago
|
GDK used by developers since 1999, distributed on the web since 2002
|
-
Property svn:eol-style set to
native
|
File size:
915 bytes
|
Rev | Line | |
---|
[121] | 1 | // This file is a part of the Framsticks GDK. |
---|
[197] | 2 | // Copyright (C) 1999-2014 Maciej Komosinski and Szymon Ulatowski. See LICENSE.txt for details. |
---|
[109] | 3 | // Refer to http://www.framsticks.com/ for further information. |
---|
| 4 | |
---|
| 5 | #include "paramtabobj.h" |
---|
| 6 | |
---|
| 7 | int ParamTab::measureTab(const ParamEntry *pe) |
---|
| 8 | { |
---|
| 9 | int i=0; |
---|
| 10 | while(pe->id) {i++;pe++;} |
---|
| 11 | return i; |
---|
| 12 | } |
---|
| 13 | |
---|
| 14 | void ParamTab::resize(int s) |
---|
| 15 | { |
---|
| 16 | if (s==siz) return; |
---|
| 17 | tab=(ParamEntry*)realloc(tab,sizeof(ParamEntry)*(s+1)); |
---|
| 18 | siz=s; |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | int ParamTab::add(const ParamEntry* p,int count) |
---|
| 22 | { |
---|
| 23 | if (count<0) count=measureTab(p); |
---|
| 24 | resize(siz+count); |
---|
| 25 | memmove(tab+siz-count,p,sizeof(ParamEntry)*count); |
---|
| 26 | memset(tab+siz,0,sizeof(ParamEntry)); |
---|
| 27 | if (siz>0) tab[0].flags=(short)(siz-tab[0].group); |
---|
| 28 | return siz-1; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | void ParamTab::remove(int i,int count) |
---|
| 32 | { |
---|
| 33 | memmove(tab+i,tab+i+count,sizeof(ParamEntry)*count); |
---|
| 34 | resize(siz-count); |
---|
| 35 | memset(tab+siz,0,sizeof(ParamEntry)); |
---|
| 36 | if (siz>0) tab[0].flags=(short)(siz-tab[0].group); |
---|
| 37 | } |
---|
| 38 | |
---|
Note: See
TracBrowser
for help on using the repository browser.