Changeset 687
- Timestamp:
- Jul 30, 2013, 5:48:38 PM (10 years ago)
- Location:
- abuse/branches/lol/src
- Files:
-
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/branches/lol/src/Makefile.am
r686 r687 62 62 $(NULL) 63 63 64 EXTRALIBS = lisp/liblisp.a sdlport/libsdlport.a imlib/libimlib.a net/libnet.a 65 abuse_LDADD = $(EXTRALIBS) $(LOL_LIBS) 66 abuse_DEPENDENCIES = $(EXTRALIBS) 64 abuse_CPPFLAGS = $(AM_CPPFLAGS) -DHAVE_OPENGL \ 65 -I$(srcdir) -I$(srcdir)/lisp -I$(srcdir)/imlib -I$(srcdir)/net 66 abuse_LDFLAGS = lisp/liblisp.a sdlport/libsdlport.a imlib/libimlib.a net/libnet.a $(AM_LDFLAGS) 67 abuse_LDADD = @LOL_LIBS@ 68 abuse_DEPENDENCIES = @LOL_DEPS@ 67 69 68 70 abuse_tool_SOURCES = \ 69 71 tool/abuse-tool.cpp \ 70 72 crc.cpp crc.h 71 abuse_tool_LDADD = imlib/libimlib.a 72 abuse_tool_DEPENDENCIES = $(abuse_tool_LDADD) 73 abuse_tool_CPPFLAGS = $(AM_CPPFLAGS) -DHAVE_OPENGL \ 74 -I$(srcdir) -I$(srcdir)/lisp -I$(srcdir)/imlib -I$(srcdir)/net 75 abuse_tool_LDFLAGS = imlib/libimlib.a $(AM_LDFLAGS) 76 abuse_tool_LDADD = @LOL_LIBS@ 77 abuse_tool_DEPENDENCIES = @LOL_DEPS@ 73 78 74 INCLUDES = -I$(srcdir) -I$(srcdir)/lisp -I$(srcdir)/imlib \75 -I$(srcdir)/net $(SDL_CFLAGS)76 77 CPPFLAGS = @CPPFLAGS@ -DNO_CHECK78 -
abuse/branches/lol/src/cache.cpp
r635 r687 165 165 char *CrcManager::get_filename(int filenumber) 166 166 { 167 CHECK(filenumber>=0 && filenumber<total_files); 167 ASSERT(filenumber >= 0); 168 ASSERT(filenumber < total_files); 168 169 return files[filenumber]->filename; 169 170 } … … 171 172 uint32_t CrcManager::get_crc(int filenumber, int &failed) 172 173 { 173 CHECK(filenumber>=0 && filenumber<total_files); 174 ASSERT(filenumber >= 0); 175 ASSERT(filenumber < total_files); 174 176 if (files[filenumber]->crc_calculated) 175 177 { 176 failed =0;178 failed = 0; 177 179 return files[filenumber]->crc; 178 180 } 179 failed =1;181 failed = 1; 180 182 return 0; 181 183 } … … 183 185 void CrcManager::set_crc(int filenumber, uint32_t crc) 184 186 { 185 CHECK(filenumber>=0 && filenumber<total_files); 186 files[filenumber]->crc_calculated=1; 187 ASSERT(filenumber >= 0); 188 ASSERT(filenumber < total_files); 189 files[filenumber]->crc_calculated = 1; 187 190 files[filenumber]->crc=crc; 188 191 } … … 882 885 int id = AllocId(); 883 886 884 CHECK(id < total && list[id].file_number < 0); 887 ASSERT(id < total); 888 ASSERT(list[id].file_number < 0); 885 889 886 890 list[id].file_number = fn; … … 911 915 backtile *CacheList::backt(int id) 912 916 { 913 CacheItem *me=list+id; 914 CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id"); 917 CacheItem *me = list + id; 918 919 ASSERT(id < total && id >= 0 && me->file_number >= 0, "bad id"); 915 920 916 921 if (me->last_access>=0) … … 932 937 foretile *CacheList::foret(int id) 933 938 { 934 CacheItem *me=list+id; 935 CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id"); 939 CacheItem *me = list + id; 940 941 ASSERT(id < total && id >= 0 && me->file_number >= 0, "bad id"); 936 942 937 943 if (me->last_access>=0) … … 952 958 figure *CacheList::fig(int id) 953 959 { 954 CacheItem *me=list+id; 955 // CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id"); 960 CacheItem *me = list + id; 961 962 //ASSERT(id < total && id >= 0 && me->file_number >= 0, "bad id"); 963 956 964 if (me->last_access>=0) 957 965 { … … 971 979 image *CacheList::img(int id) 972 980 { 973 CacheItem *me=list+id; 974 CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id"); 981 CacheItem *me = list + id; 982 983 ASSERT(id < total && id >= 0 && me->file_number >= 0, "bad id"); 984 975 985 if (me->last_access>=0) 976 986 { … … 992 1002 sound_effect *CacheList::sfx(int id) 993 1003 { 994 CacheItem *me=list+id; 995 CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id"); 1004 CacheItem *me = list + id; 1005 1006 ASSERT(id < total && id >= 0 && me->file_number >= 0, "bad id"); 1007 996 1008 if (me->last_access>=0) 997 1009 { … … 1011 1023 part_frame *CacheList::part(int id) 1012 1024 { 1013 CacheItem *me=list+id; 1014 CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id"); 1025 CacheItem *me = list + id; 1026 1027 ASSERT(id < total && id >= 0 && me->file_number >= 0, "bad id"); 1028 1015 1029 if (me->last_access>=0) 1016 1030 { … … 1031 1045 LObject *CacheList::lblock(int id) 1032 1046 { 1033 CacheItem *me=list+id; 1034 CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id"); 1047 CacheItem *me = list + id; 1048 1049 ASSERT(id < total && id >= 0 && me->file_number >= 0, "bad id"); 1050 1035 1051 return (LObject *)me->data; 1036 1052 } … … 1097 1113 int CacheList::loaded(int id) 1098 1114 { 1099 CacheItem *me=list+id; 1100 CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id"); 1115 CacheItem *me = list + id; 1116 1117 ASSERT(id < total && id >= 0 && me->file_number >= 0, "bad id"); 1118 1101 1119 if (me->last_access>=0) 1102 1120 return 1; … … 1106 1124 char_tint *CacheList::ctint(int id) 1107 1125 { 1108 CacheItem *me=list+id; 1109 CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id" && me->type==SPEC_PALETTE); 1126 CacheItem *me = list + id; 1127 1128 ASSERT(id < total && id >= 0 && me->file_number >= 0, "bad id"); 1129 ASSERT(me->type == SPEC_PALETTE); 1130 1110 1131 if (me->last_access>=0) 1111 1132 { -
abuse/branches/lol/src/chars.cpp
r643 r687 108 108 else 109 109 { 110 num = Max(ts, MAX_STATE);110 num = lol::max(ts, MAX_STATE); 111 111 LSpace *sp = LSpace::Current; 112 112 LSpace::Current = &LSpace::Perm; -
abuse/branches/lol/src/collide.cpp
r555 r687 117 117 if (x1<p->x1) 118 118 { 119 add_collide(first,x1, Max(y1,p->y1),p->x1-1,Min(y2,p->y2),who);119 add_collide(first,x1,lol::max(y1,p->y1),p->x1-1,lol::min(y2,p->y2),who); 120 120 ax1=p->x1; 121 121 } else … … 124 124 if (x2>p->x2) 125 125 { 126 add_collide(first,p->x2+1, Max(y1,p->y1),x2,Min(y2,p->y2),who);126 add_collide(first,p->x2+1,lol::max(y1,p->y1),x2,lol::min(y2,p->y2),who); 127 127 ax2=p->x2; 128 128 } -
abuse/branches/lol/src/common.h
r686 r687 25 25 26 26 // 27 // Custom utility functions28 //29 static inline int Min(int a, int b) { return a < b ? a : b; }30 static inline int Max(int a, int b) { return a > b ? a : b; }31 static inline unsigned int Min(unsigned int a, unsigned int b) { return a < b ? a : b; }32 static inline unsigned int Max(unsigned int a, unsigned int b) { return a > b ? a : b; }33 static inline long Min(long a, long b) { return a < b ? a : b; }34 static inline long Max(long a, long b) { return a > b ? a : b; }35 static inline unsigned long Min(unsigned long a, unsigned long b) { return a < b ? a : b; }36 static inline unsigned long Max(unsigned long a, unsigned long b) { return a > b ? a : b; }37 static inline float Min(float a, float b) { return a < b ? a : b; }38 static inline float Max(float a, float b) { return a > b ? a : b; }39 40 static inline ivec2 Min(ivec2 a, ivec2 b) { return ivec2(Min(a.x, b.x), Min(a.y, b.y)); }41 static inline ivec2 Max(ivec2 a, ivec2 b) { return ivec2(Max(a.x, b.x), Max(a.y, b.y)); }42 43 //44 27 // Byte swapping 45 28 // … … 65 48 } 66 49 67 #define ERROR(x,st) { if (!(x)) \68 { printf("Error on line %d of %s : %s\n", \69 __LINE__,__FILE__,st); exit(1); } }70 71 // These macros should be removed for the non-debugging version72 #ifdef NO_CHECK73 # define CONDITION(x,st)74 # define CHECK(x)75 #else76 # define CONDITION(x,st) ERROR(x,st)77 # define CHECK(x) CONDITION(x,"Check stop");78 #endif79 80 50 #endif // __COMMON_H__ 81 51 -
abuse/branches/lol/src/control.cpp
r555 r687 38 38 case CHAR_HUMAN : my_figure=human_figure; curbreak; 39 39 case CHAR_IGUANA : my_figure=iguana_figure; break; 40 default : CONDITION(0,"change_character, bad character type\n");40 default : ASSERT(0, "change_character, bad character type"); 41 41 } 42 42 cur_char=char_type; -
abuse/branches/lol/src/game.cpp
r686 r687 321 321 tmp = ivec2(0, 0); 322 322 323 tmp.x = Max(tmp.x, 0);324 tmp.y = Max(tmp.y, 0);323 tmp.x = lol::max(tmp.x, 0); 324 tmp.y = lol::max(tmp.y, 0); 325 325 326 326 ivec2 ret(pos.x * AUTOTILE_WIDTH / ftile_width() … … 802 802 x2 = x1 + (v->m_bb.x - v->m_aa.x + fw) / fw; 803 803 y2 = y1 + (v->m_bb.y - v->m_aa.y + fh) / fh; 804 x2 = Min(x2, current_level->foreground_width() - 1);805 y2 = Min(y2, current_level->foreground_height() - 1);804 x2 = lol::min(x2, current_level->foreground_width() - 1); 805 y2 = lol::min(y2, current_level->foreground_height() - 1); 806 806 807 807 xinc = fw; … … 977 977 if(help_text_frames >= 0) 978 978 { 979 int color = 2 + Max(0, help_text_frames - 10);979 int color = 2 + lol::max(0, help_text_frames - 10); 980 980 981 981 ivec2 aa = v->m_aa; … … 1510 1510 1511 1511 // Find average fps for last 10 frames 1512 float deltatime = Max(0.001f, frame_timer.Poll());1512 float deltatime = lol::max(0.001f, frame_timer.Poll()); 1513 1513 1514 1514 avg_time = 0.9f * avg_time + 0.1f * deltatime; … … 1516 1516 1517 1517 if (avg_time < 1.0f / 14) 1518 massive_frame_panic = Max(0, Min(20, massive_frame_panic - 1));1518 massive_frame_panic = lol::max(0, lol::min(20, massive_frame_panic - 1)); 1519 1519 1520 1520 int ret = 0; … … 1775 1775 { 1776 1776 if(ev.message.id == RAISE_SFX && sfx_volume != 127) 1777 sfx_volume = Min(127, sfx_volume + 16);1777 sfx_volume = lol::min(127, sfx_volume + 16); 1778 1778 if(ev.message.id == LOWER_SFX && sfx_volume != 0) 1779 sfx_volume = Max(sfx_volume - 16, 0);1779 sfx_volume = lol::max(sfx_volume - 16, 0); 1780 1780 if(ev.message.id == RAISE_MUSIC && music_volume != 126) 1781 1781 { 1782 music_volume = Min(music_volume + 16, 127);1782 music_volume = lol::min(music_volume + 16, 127); 1783 1783 if(current_song && (sound_avail & MUSIC_INITIALIZED)) 1784 1784 current_song->set_volume(music_volume); … … 1787 1787 if(ev.message.id == LOWER_MUSIC && music_volume != 0) 1788 1788 { 1789 music_volume = Max(music_volume - 16, 0);1789 music_volume = lol::max(music_volume - 16, 0); 1790 1790 if(current_song && (sound_avail & MUSIC_INITIALIZED)) 1791 1791 current_song->set_volume(music_volume); -
abuse/branches/lol/src/go.cpp
r686 r687 218 218 break; 219 219 default : 220 CHECK(0);220 ASSERT(false); 221 221 } 222 222 } -
abuse/branches/lol/src/imlib/dprint.cpp
r555 r687 55 55 else 56 56 { 57 ERROR(0,"dgets called but no handler set up");57 ASSERT(0, "dgets called but no handler set up"); 58 58 } 59 59 } -
abuse/branches/lol/src/imlib/event.cpp
r686 r687 34 34 EventHandler::EventHandler(image *screen, palette *pal) 35 35 { 36 CHECK(screen && pal); 36 ASSERT(screen); 37 ASSERT(pal); 38 37 39 m_pending = 0; 38 39 40 m_screen = screen; 40 41 -
abuse/branches/lol/src/imlib/event.h
r686 r687 85 85 void SetMousePos(ivec2 pos) 86 86 { 87 m_pos = ivec2( Min(Max(pos.x, 0), m_screen->Size().x - 1),88 Min(Max(pos.y, 0), m_screen->Size().y - 1));87 m_pos = ivec2(lol::min(lol::max(pos.x, 0), m_screen->Size().x - 1), 88 lol::min(lol::max(pos.y, 0), m_screen->Size().y - 1)); 89 89 SysWarpMouse(m_pos); 90 90 } -
abuse/branches/lol/src/imlib/filter.cpp
r686 r687 20 20 Filter::Filter(int colors) 21 21 { 22 CONDITION(colors >= 0 && colors <= 256, "bad colors value"); 22 ASSERT(colors >= 0 && colors <= 256, "bad colors value"); 23 23 24 m_size = colors; 24 25 m_table = (uint8_t *)malloc(m_size); … … 29 30 Filter::Filter(palette *from, palette *to) 30 31 { 31 m_size = Max(from->pal_size(), to->pal_size());32 m_size = lol::max(from->pal_size(), to->pal_size()); 32 33 m_table = (uint8_t *)malloc(m_size); 33 34 … … 59 60 void Filter::Set(int color_num, int change_to) 60 61 { 61 CONDITION(color_num >= 0 && color_num < m_size, "Bad colors_num"); 62 ASSERT(color_num >= 0 && color_num < m_size, "Bad colors_num"); 63 62 64 m_table[color_num] = change_to; 63 65 } … … 70 72 while (npixels--) 71 73 { 72 CONDITION(*dst < m_size, "not enough filter colors");74 ASSERT(*dst < m_size, "not enough filter colors"); 73 75 *dst = m_table[*dst]; 74 76 dst++; … … 88 90 return; 89 91 90 aa += Max(caa - pos, ivec2(0));91 pos = Max(pos, caa);92 bb = Min(bb, cbb - pos + aa);92 aa += lol::max(caa - pos, ivec2(0)); 93 pos = lol::max(pos, caa); 94 bb = lol::min(bb, cbb - pos + aa); 93 95 94 96 if (!(aa < bb)) -
abuse/branches/lol/src/imlib/guistat.cpp
r682 r687 142 142 void gui_status_manager::pop() 143 143 { 144 CONDITION(first,"No status's to pop!"); 145 gui_status_node *p=first; 146 first=first->next; 147 delete p; 144 ASSERT(first, "no status to pop!"); 145 146 gui_status_node *p = first; 147 first = first->next; 148 delete p; 148 149 } 149 150 -
abuse/branches/lol/src/imlib/image.cpp
r686 r687 66 66 uint8_t image::Pixel(ivec2 pos) 67 67 { 68 CONDITION(pos.x >= 0 && pos.x < m_size.x && pos.y >= 0 && pos.y < m_size.y,69 68 ASSERT(pos.x >= 0 && pos.x < m_size.x && pos.y >= 0 && pos.y < m_size.y, 69 "image::Pixel Bad pixel xy"); 70 70 return scan_line(pos.y)[pos.x]; 71 71 } … … 73 73 void image::PutPixel(ivec2 pos, uint8_t color) 74 74 { 75 CONDITION(pos.x >= 0 && pos.x < m_size.x && pos.y >= 0 && pos.y < m_size.y,76 75 ASSERT(pos.x >= 0 && pos.x < m_size.x && pos.y >= 0 && pos.y < m_size.y, 76 "image::PutPixel Bad pixel xy"); 77 77 78 78 if (m_special && … … 216 216 217 217 // We can now assume p1.y <= p2.y 218 AddDirty(ivec2( Min(p1.x, p2.x), p1.y),219 ivec2( Max(p1.x, p2.x), p2.y) + ivec2(1));218 AddDirty(ivec2(lol::min(p1.x, p2.x), p1.y), 219 ivec2(lol::max(p1.x, p2.x), p2.y) + ivec2(1)); 220 220 221 221 ivec2 span = p2 - p1; … … 229 229 int dx = (n > m) ? yi * m_size.x : xi; 230 230 int dy = (n > m) ? xi : yi * m_size.x; 231 int erx = 2 * Max(span.x * xi, span.y * yi);232 int ery = 2 * Min(span.x * xi, span.y * yi);231 int erx = 2 * lol::max(span.x * xi, span.y * yi); 232 int ery = 2 * lol::min(span.x * xi, span.y * yi); 233 233 234 234 Lock(); 235 for (int i = 0, er = 0; i <= Max(n, m); i++)235 for (int i = 0, er = 0; i <= lol::max(n, m); i++) 236 236 { 237 237 *start = color; … … 255 255 void image::PutPart(image *im, ivec2 pos, ivec2 aa, ivec2 bb, int transparent) 256 256 { 257 CHECK(aa < bb);257 ASSERT(aa < bb); 258 258 259 259 ivec2 caa, cbb; … … 262 262 // see if the are to be put is outside of actual image, if so adjust 263 263 // to fit in the image 264 pos += Min(aa, ivec2(0));265 aa += Min(aa, ivec2(0));266 bb = Min(bb, im->m_size);264 pos += lol::min(aa, ivec2(0)); 265 aa += lol::min(aa, ivec2(0)); 266 bb = lol::min(bb, im->m_size); 267 267 // return if it was adjusted so that nothing will be put 268 268 if (!(aa < bb)) … … 273 273 return; 274 274 275 aa += Max(caa - pos, ivec2(0));276 pos += Max(caa - pos, ivec2(0));277 bb = Min(bb, cbb - pos + aa);275 aa += lol::max(caa - pos, ivec2(0)); 276 pos += lol::max(caa - pos, ivec2(0)); 277 bb = lol::min(bb, cbb - pos + aa); 278 278 if (!(aa < bb)) 279 279 return; … … 339 339 if (m_special) 340 340 { 341 aa = Min(aa, ivec2(m_special->x1_clip(), m_special->y1_clip()));342 bb = Max(bb, ivec2(m_special->x2_clip(), m_special->y2_clip()));341 aa = lol::min(aa, ivec2(m_special->x1_clip(), m_special->y1_clip())); 342 bb = lol::max(bb, ivec2(m_special->x2_clip(), m_special->y2_clip())); 343 343 } 344 344 … … 372 372 if (m_special) 373 373 { 374 x1 = Min(x1, m_special->x1_clip());375 y1 = Min(y1, m_special->y1_clip());376 x2 = Max(x2, m_special->x2_clip());377 y2 = Max(y2, m_special->y2_clip());374 x1 = lol::min(x1, m_special->x1_clip()); 375 y1 = lol::min(y1, m_special->y1_clip()); 376 x2 = lol::max(x2, m_special->x2_clip()); 377 y2 = lol::max(y2, m_special->y2_clip()); 378 378 } 379 379 … … 391 391 for (dirty_rect *p = (dirty_rect *)dirties.first(); p; ) 392 392 { 393 aa = Min(aa, p->m_aa);394 bb = Max(bb, p->m_bb);393 aa = lol::min(aa, p->m_aa); 394 bb = lol::max(bb, p->m_bb); 395 395 dirty_rect *tmp = (dirty_rect *)p->Next(); 396 396 dirties.unlink(p); … … 409 409 return; 410 410 411 aa = Max(aa, ivec2(0));412 bb = Min(bb, m_size);411 aa = lol::max(aa, ivec2(0)); 412 bb = lol::min(bb, m_size); 413 413 414 414 if (!(aa < bb)) … … 510 510 return; 511 511 512 aa = Max(aa, ivec2(0));513 bb = Min(bb, m_size);512 aa = lol::max(aa, ivec2(0)); 513 bb = lol::min(bb, m_size); 514 514 515 515 if (!(aa < bb)) … … 559 559 { 560 560 if (aa.x < p->m_aa.x) 561 AddDirty(ivec2(aa.x, Max(aa.y, p->m_aa.y)),562 ivec2(p->m_aa.x, Min(bb.y, p->m_bb.y + 1)));561 AddDirty(ivec2(aa.x, lol::max(aa.y, p->m_aa.y)), 562 ivec2(p->m_aa.x, lol::min(bb.y, p->m_bb.y + 1))); 563 563 if (bb.x > p->m_bb.x + 1) 564 AddDirty(ivec2(p->m_bb.x + 1, Max(aa.y, p->m_aa.y)),565 ivec2(bb.x, Min(bb.y, p->m_bb.y + 1)));564 AddDirty(ivec2(p->m_bb.x + 1, lol::max(aa.y, p->m_aa.y)), 565 ivec2(bb.x, lol::min(bb.y, p->m_bb.y + 1))); 566 566 if (aa.y < p->m_aa.y) 567 567 AddDirty(aa, ivec2(bb.x, p->m_aa.y)); … … 574 574 575 575 } 576 CHECK(aa < bb);576 ASSERT(aa < bb); 577 577 dirties.add_end(new dirty_rect(aa, bb - ivec2(1))); 578 578 } … … 592 592 else 593 593 { 594 p1.x = Max(p1.x, 0);595 p1.y = Max(p1.y, 0);596 p2.x = Min(p2.x, m_size.x - 1);597 p2.y = Min(p2.y, m_size.y - 1);594 p1.x = lol::max(p1.x, 0); 595 p1.y = lol::max(p1.y, 0); 596 p2.x = lol::min(p2.x, m_size.x - 1); 597 p2.y = lol::min(p2.y, m_size.y - 1); 598 598 } 599 599 if (p2.x < 0 || p2.y < 0 || p1.x >= m_size.x || p1.y >= m_size.y … … 728 728 void image::scroll(int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t xd, int16_t yd) 729 729 { 730 CHECK(x1>=0 && y1>=0 && x1<x2 && y1<y2 && x2<m_size.x && y2<m_size.y); 730 ASSERT(x1 >= 0); 731 ASSERT(y1 >= 0); 732 ASSERT(x1 < x2); 733 ASSERT(y1 < y2); 734 ASSERT(x2 < m_size.x); 735 ASSERT(y2 < m_size.y); 736 731 737 if (m_special) 732 738 { 733 739 ivec2 caa, cbb; 734 740 m_special->GetClip(caa, cbb); 735 x1=Max(x1, caa.x); y1=Max(caa.y, y1); x2=Min(x2, cbb.x - 1); y2=Min(y2, cbb.y - 1); 741 x1=lol::max(x1, caa.x); 742 y1=lol::max(caa.y, y1); 743 x2=lol::min(x2, cbb.x - 1); 744 y2=lol::min(y2, cbb.y - 1); 736 745 } 737 746 int16_t xsrc, ysrc, xdst, ydst, xtot=x2-x1-lol::abs(xd)+1, ytot, xt; … … 755 764 image *image::create_smooth(int16_t smoothness) 756 765 { 766 ASSERT(smoothness >= 0); 767 757 768 int16_t i, j, k, l, t, d; 758 769 image *im; 759 CHECK(smoothness>=0);760 if (!smoothness)return NULL;770 if (!smoothness) 771 return NULL; 761 772 d=smoothness*2+1; 762 773 d=d*d; … … 922 933 if (y2>cbb.y - 1) y2=cbb.y - 1; 923 934 if (x2>cbb.x - 1) x2=cbb.x - 1; 924 CHECK(x2>=x1 && y2>=y1); 935 936 ASSERT(x2 >= x1); 937 ASSERT(y2 >= y1); 938 925 939 if (x2<x1 || y2<y1) return NULL; 926 940 ret=new image(ivec2((x2-x1+8)/8, (y2-y1+1))); -
abuse/branches/lol/src/imlib/image.h
r682 r687 50 50 51 51 image_descriptor(ivec2 size, int keep_dirties = 1, int static_memory = 0); 52 int bound_x1(int x1) { return Max(x1, m_aa.x); }53 int bound_y1(int y1) { return Max(y1, m_aa.y); }54 int bound_x2(int x2) { return Min(x2, m_bb.x); }55 int bound_y2(int y2) { return Min(y2, m_bb.y); }52 int bound_x1(int x1) { return lol::max(x1, m_aa.x); } 53 int bound_y1(int y1) { return lol::max(y1, m_aa.y); } 54 int bound_x2(int x2) { return lol::min(x2, m_bb.x); } 55 int bound_y2(int y2) { return lol::min(y2, m_bb.y); } 56 56 inline int x1_clip() { return m_aa.x; } 57 57 inline int y1_clip() { return m_aa.y; } … … 65 65 void SetClip(ivec2 aa, ivec2 bb) 66 66 { 67 m_aa = Max(aa, ivec2(0));68 m_bb = Min(Max(bb, m_aa + ivec2(1)), m_size);67 m_aa = lol::max(aa, ivec2(0)); 68 m_bb = lol::min(lol::max(bb, m_aa + ivec2(1)), m_size); 69 69 } 70 70 void GetClip(int &x1, int &y1, int &x2, int &y2) … … 76 76 if(x2 < x1 + 1) x2 = x1 + 1; 77 77 if(y2 < y1 + 1) y2 = y1 + 1; 78 m_aa.x = Max(x1, 0); m_aa.y = Max(y1, 0);79 m_bb.x = Min(x2, m_size.x); m_bb.y = Min(y2, m_size.y);78 m_aa.x = lol::max(x1, 0); m_aa.y = lol::max(y1, 0); 79 m_bb.x = lol::min(x2, m_size.x); m_bb.y = lol::min(y2, m_size.y); 80 80 } 81 81 void ReduceDirties(); -
abuse/branches/lol/src/imlib/input.cpp
r682 r687 192 192 void button::change_visual(image *new_visual) 193 193 { 194 CHECK(visual);195 visual=new_visual;194 ASSERT(visual); 195 visual = new_visual; 196 196 } 197 197 -
abuse/branches/lol/src/imlib/jwindow.cpp
r686 r687 397 397 398 398 if(size.x == -1) 399 m_size.x = Max(m_size.x, 15 + left_border() + right_border());399 m_size.x = lol::max(m_size.x, 15 + left_border() + right_border()); 400 400 if(size.y == -1) 401 m_size.y = Max(m_size.y, top_border() + bottom_border());401 m_size.y = lol::max(m_size.y, top_border() + bottom_border()); 402 402 m_surf = new image(m_size, NULL, 2); 403 403 m_surf->clear(backg); … … 436 436 i->set_owner(this); 437 437 i->area(x1, y1, x2, y2); 438 m_size = Max(m_size, ivec2(x2, y2));438 m_size = lol::max(m_size, ivec2(x2, y2)); 439 439 } 440 440 } -
abuse/branches/lol/src/imlib/palette.cpp
r686 r687 121 121 void palette::set_rgbs() 122 122 { 123 int i,v; 124 CHECK(ncolors==256); 123 ASSERT(ncolors == 256); 124 125 int i, v; 125 126 for (i=0; i<64; i++) 126 127 { … … 170 171 void palette::set_used(int color_num) 171 172 { 172 int x,b; 173 CHECK(color_num>=0 && color_num<ncolors); 174 x=color_num/8; 175 b=color_num%8; 176 usd[x]|=(128>>b); 173 ASSERT(color_num >= 0); 174 ASSERT(color_num < ncolors); 175 176 int x = color_num / 8; 177 int b = color_num % 8; 178 usd[x] |= 128 >> b; 177 179 } 178 180 179 181 void palette::set_unused(int color_num) 180 182 { 181 int x,b; 182 CHECK(color_num>=0 && color_num<ncolors); 183 x=color_num/8; 184 b=color_num%8; 185 usd[x]&=(0xff^(128>>b)); 183 ASSERT(color_num >= 0); 184 ASSERT(color_num < ncolors); 185 186 int x = color_num / 8; 187 int b = color_num % 8; 188 usd[x] &= 0xff ^ (128 >> b); 186 189 } 187 190 188 191 int palette::used(int color_num) 189 192 { 190 int x,b; 191 CHECK(color_num>=0 && color_num<ncolors); 192 x=color_num/8; 193 b=color_num%8; 194 return (usd[x]&(128>>b)); 193 ASSERT(color_num >= 0); 194 ASSERT(color_num < ncolors); 195 196 int x = color_num / 8; 197 int b = color_num % 8; 198 return usd[x] & (128 >> b); 195 199 } 196 200 … … 235 239 236 240 void palette::set(int x, unsigned char red, char unsigned green, char unsigned blue) 237 { CONDITION(x>=0 && x<ncolors,"Pallete::set passed bad x"); 238 CONDITION((int)red<=ncolors && (int)green<=ncolors && (int)blue<=ncolors, 239 "pallette::set color values bigger than palette"); 240 pal[x].red=red; pal[x].green=green; pal[x].blue=blue; 241 { 242 ASSERT(x >= 0 && x < ncolors, "palete::set passed bad x"); 243 ASSERT((int)red <= ncolors && (int)green <= ncolors && (int)blue <= ncolors, 244 "palette::set color values bigger than palette"); 245 246 pal[x].red = red; 247 pal[x].green = green; 248 pal[x].blue = blue; 241 249 } 242 250 243 251 void palette::get(int x, unsigned char &red, unsigned char &green, unsigned char &blue) 244 { CONDITION(x>=0 && x<ncolors,"Pallete::get passed bad x"); 245 red=pal[x].red; green=pal[x].green; blue=pal[x].blue; 246 } 252 { 253 ASSERT(x >= 0 && x < ncolors, "palete::get passed bad x"); 254 255 red = pal[x].red; 256 green = pal[x].green; 257 blue = pal[x].blue; 258 } 259 247 260 palette::~palette() 248 { if (pal) free(pal); 249 if (usd) free(usd); 261 { 262 free(pal); 263 free(usd); 250 264 } 251 265 252 266 palette::palette(int number_colors) 253 267 { 254 CONDITION(number_colors>0,"palette::constructor - need at least one color!"); 255 ncolors=number_colors; 256 bg=0; 257 pal=(color *)malloc(ncolors*3); 258 usd=(unsigned char *)malloc(ncolors/8+1); 259 defaults(); 268 ASSERT(number_colors > 0, "palette::constructor - need at least one color!"); 269 270 ncolors = number_colors; 271 bg = 0; 272 pal = (color *)malloc(ncolors*3); 273 usd = (unsigned char *)malloc(ncolors / 8 + 1); 274 defaults(); 260 275 } 261 276 … … 277 292 { 278 293 int t,r,g,b; 279 CONDITION(!is_leaf(),"Cannot prune a leaf!");294 ASSERT(!is_leaf(),"Cannot prune a leaf!"); 280 295 total(t,r,g,b); 281 296 red=r/t; … … 304 319 unsigned char r, unsigned char g, unsigned char b) 305 320 { 306 int i; 307 CONDITION(level<=8,"Tree cannot have more than eight levels"); 308 if (level==8) 309 be_childish(); 310 else 311 for (i=0; i<8; i++) children[i]=NULL; 312 padre=dad; 313 red=r; green=g; blue=b; 314 tot=0; 321 int i; 322 ASSERT(level <= 8, "Tree cannot have more than eight levels"); 323 324 if (level == 8) 325 be_childish(); 326 else 327 for (i=0; i<8; i++) children[i]=NULL; 328 padre = dad; 329 red = r; green = g; blue = b; 330 tot = 0; 315 331 } 316 332 … … 326 342 if (who->children[x]) 327 343 { 328 CONDITION(lev<8,"Levl > 7");344 ASSERT(lev < 8, "Levl > 7"); 329 345 re_delete(who->children[x],lev+1); 330 346 level[lev].unlink(who->children[x]); … … 354 370 } 355 371 } 356 CONDITION(lev>0,"could not prune!");372 ASSERT(lev > 0, "could not prune!"); 357 373 t=0; r=0; g=0; b=0; 358 374 f->total(t,r,g,b); … … 362 378 f->total(t,r,g,b); 363 379 } 364 CONDITION(t>1,"Should be more colors\n");380 ASSERT(t > 1, "Should be more colors"); 365 381 printf("%d Pruned at level %d, r=%d, g=%d, b=%d, total nodes off = %d\n",nc, 366 382 lev,r/t,g/t,b/t,t); -
abuse/branches/lol/src/imlib/pmenu.cpp
r682 r687 78 78 next=Next; 79 79 on_off=NULL; 80 CONDITION(Name,"Sub menu cannot have a NULL name");80 ASSERT(Name, "Sub menu cannot have a NULL name"); 81 81 n = strdup(Name); 82 82 sub=Sub; -
abuse/branches/lol/src/imlib/sprite.cpp
r686 r687 25 25 ASprite::ASprite(image *screen, image *visual, ivec2 pos) 26 26 { 27 CHECK(visual && screen); 27 ASSERT(visual); 28 ASSERT(screen); 29 28 30 m_pos = pos; 29 31 m_visual = visual; -
abuse/branches/lol/src/imlib/status.cpp
r555 r687 75 75 void text_status_manager::pop() 76 76 { 77 CONDITION(first,"No status's to pop!");77 ASSERT(first, "no status to pop!"); 78 78 if (level==1) dprintf("\n"); 79 79 level--; -
abuse/branches/lol/src/imlib/transimage.cpp
r686 r687 56 56 { 57 57 printf("size = %d %d (%ld bytes)\n", m_size.x, m_size.y, (long)bytes); 58 CONDITION(parser, "malloc error for TransImage::m_data");58 ASSERT(parser, "malloc error for TransImage::m_data"); 59 59 } 60 60 … … 122 122 123 123 // Number of lines to skip, number of lines to draw, first line to draw 124 int skiplines = Max(pos1.y - pos.y, 0);125 ysteps = Min(pos2.y - pos.y, m_size.y - skiplines);124 int skiplines = lol::max(pos1.y - pos.y, 0); 125 ysteps = lol::min(pos2.y - pos.y, m_size.y - skiplines); 126 126 pos.y += skiplines; 127 127 … … 140 140 } 141 141 142 screen->AddDirty(ivec2( Max(pos.x, pos1.x), pos.y),143 ivec2( Min(pos.x + m_size.x, pos2.x), pos.y + m_size.y));142 screen->AddDirty(ivec2(lol::max(pos.x, pos1.x), pos.y), 143 ivec2(lol::min(pos.x + m_size.x, pos2.x), pos.y + m_size.y)); 144 144 return parser; 145 145 } … … 158 158 if (N == SCANLINE) 159 159 { 160 pos1.y = Max(pos1.y, pos.y + amount);161 pos2.y = Min(pos2.y, pos.y + amount + 1);160 pos1.y = lol::max(pos1.y, pos.y + amount); 161 pos2.y = lol::min(pos2.y, pos.y + amount + 1); 162 162 if (pos1.y >= pos2.y) 163 163 return; … … 169 169 return; // if ClipToLine says nothing to draw, return 170 170 171 CONDITION(N != BLEND || (pos.y >= bpos.y171 ASSERT(N != BLEND || (pos.y >= bpos.y 172 172 && pos.y + ysteps <= bpos.y + blend->Size().y), 173 "Blend doesn't fit on TransImage");173 "blend doesn't fit on TransImage"); 174 174 175 175 if (N == FADE || N == FADE_TINT || N == BLEND) … … 182 182 183 183 if (N == PREDATOR) 184 ysteps = Min(ysteps, pos2.y - 1 - pos.y - 2);184 ysteps = lol::min(ysteps, pos2.y - 1 - pos.y - 2); 185 185 186 186 screen->Lock(); … … 211 211 212 212 // Chop left side if necessary, but no more than todo 213 int tochop = Min(todo, Max(pos1.x - ix, 0));213 int tochop = lol::min(todo, lol::max(pos1.x - ix, 0)); 214 214 215 215 ix += tochop; … … 219 219 220 220 // Chop right side if necessary and process the remaining pixels 221 int count = Min(todo, Max(pos2.x - ix, 0));221 int count = lol::min(todo, lol::max(pos2.x - ix, 0)); 222 222 223 223 if (N == NORMAL || N == SCANLINE) -
abuse/branches/lol/src/imlib/video.cpp
r670 r687 23 23 { 24 24 // make sure the image has the ability to contain dirty areas 25 CHECK(im->m_special);25 ASSERT(im->m_special); 26 26 27 27 if (im->m_special->keep_dirt == 0) -
abuse/branches/lol/src/intsect.cpp
r686 r687 126 126 { 127 127 int32_t ae_bd=my1*mx2-mx1*my2; 128 CONDITION(ae_bd,"line intersect fuck up");128 ASSERT(ae_bd,"line intersect fuck up"); 129 129 tx2=(mx1*mx2*(b2-b1))/ae_bd+xadd; 130 130 ty2=my1*tx2/mx1+b1; … … 133 133 { 134 134 int32_t db_ea=(my2*mx1-mx2*my1); 135 CONDITION(db_ea,"line intersect fuck up");135 ASSERT(db_ea,"line intersect fuck up"); 136 136 ty2=(mx1*b1*my2-my1*mx2*b2)/db_ea+yadd; 137 137 tx2=mx1*(ty2-b1)/my1; -
abuse/branches/lol/src/items.cpp
r682 r687 67 67 } 68 68 69 maxx= Max(x1,x2);70 maxy= Max(y1,y2);71 minx= Min(x1,x2);72 miny= Min(y1,y2);69 maxx=lol::max(x1,x2); 70 maxy=lol::max(y1,y2); 71 minx=lol::min(x1,x2); 72 miny=lol::min(y1,y2); 73 73 74 74 if (skip_next) … … 152 152 153 153 154 maxx= Max(x1,x2);155 maxy= Max(y1,y2);156 minx= Min(x1,x2);157 miny= Min(y1,y2);154 maxx=lol::max(x1,x2); 155 maxy=lol::max(y1,y2); 156 minx=lol::min(x1,x2); 157 miny=lol::min(y1,y2); 158 158 159 159 if (skip_next) -
abuse/branches/lol/src/level.cpp
r686 r687 63 63 } 64 64 } 65 CONDITION(c,"no attacker found");65 ASSERT(c, "no attacker found"); 66 66 return c; 67 67 } … … 298 298 { 299 299 int startable; 300 CONDITION(nplayers>0,"make_view_list with <=0 players!\n");300 ASSERT(nplayers > 0, "make_view_list with <=0 players!"); 301 301 view *f=NULL; 302 302 int j,use_type=current_start_type; … … 2019 2019 { 2020 2020 int32_t x1=fp->read_uint32(); 2021 CONDITION(x1>=0,"expected x1 for object link to be > 0\n");2021 ASSERT(x1 >= 0, "expected x1 for object link to be > 0"); 2022 2022 int32_t x2=fp->read_uint32(); 2023 2023 game_object *p,*q=number_to_object_in_list(x1,save_list); … … 2628 2628 if (blockx2>=foreground_width()) { x2=tl*foreground_width()-1; } 2629 2629 if (blocky2>=foreground_height()) { y2=th*foreground_height()-1; } 2630 blockx1= Max(blockx1,0);2631 blocky1= Max(blocky1,0);2630 blockx1=lol::max(blockx1,0); 2631 blocky1=lol::max(blocky1,0); 2632 2632 2633 2633 if ((blockx1>blockx2) || (blocky1>blocky2)) return ; -
abuse/branches/lol/src/level.h
r682 r687 104 104 ~level(); 105 105 106 int fg_raised(int x, int y) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);106 int fg_raised(int x, int y) { ASSERT(x>=0 && y>=0 && x<fg_width && y<fg_height); 107 107 return (*(map_fg+x+y*fg_width))&0x4000; } 108 void fg_set_raised(int x, int y, int r) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);108 void fg_set_raised(int x, int y, int r) { ASSERT(x>=0 && y>=0 && x<fg_width && y<fg_height); 109 109 uint16_t v=(*(map_fg+x+y*fg_width))&(0xffff-0x4000); 110 110 if (r) (*(map_fg+x+y*fg_width))=v|0x4000; 111 111 else (*(map_fg+x+y*fg_width))=v; 112 112 } 113 void mark_seen(int x, int y) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height);113 void mark_seen(int x, int y) { ASSERT(x>=0 && y>=0 && x<fg_width && y<fg_height); 114 114 (*(map_fg+x+y*fg_width))|=0x8000; } 115 115 void clear_fg(int32_t x, int32_t y) { *(map_fg+x+y*fg_width)&=0x7fff; } 116 116 117 uint16_t *get_fgline(int y) { CHECK(y>=0 && y<fg_height); return map_fg+y*fg_width; }118 uint16_t *get_bgline(int y) { CHECK(y>=0 && y<bg_height); return map_bg+y*bg_width; }117 uint16_t *get_fgline(int y) { ASSERT(y>=0 && y<fg_height); return map_fg+y*fg_width; } 118 uint16_t *get_bgline(int y) { ASSERT(y>=0 && y<bg_height); return map_bg+y*bg_width; } 119 119 uint16_t GetFg(ivec2 pos) { if (pos >= ivec2(0) && pos < ivec2(fg_width, fg_height)) 120 120 return fgvalue(*(map_fg+pos.x+pos.y*fg_width)); -
abuse/branches/lol/src/light.cpp
r686 r687 493 493 if (x1<p->x1) 494 494 { 495 add_light(first,x1, Max(y1,p->y1),p->x1-1,Min(y2,p->y2),who);495 add_light(first,x1,lol::max(y1,p->y1),p->x1-1,lol::min(y2,p->y2),who); 496 496 ax1=p->x1; 497 497 } else … … 500 500 if (x2>p->x2) 501 501 { 502 add_light(first,p->x2+1, Max(y1,p->y1),x2,Min(y2,p->y2),who);502 add_light(first,p->x2+1,lol::max(y1,p->y1),x2,lol::min(y2,p->y2),who); 503 503 ax2=p->x2; 504 504 } -
abuse/branches/lol/src/lisp/lisp.cpp
r686 r687 279 279 LFixedPoint *LFixedPoint::Create(int32_t x) 280 280 { 281 size_t size = Max(sizeof(LFixedPoint), sizeof(LRedirect));281 size_t size = lol::max(sizeof(LFixedPoint), sizeof(LRedirect)); 282 282 283 283 LFixedPoint *p = (LFixedPoint *)LSpace::Current->Alloc(size); … … 289 289 LObjectVar *LObjectVar::Create(int index) 290 290 { 291 size_t size = Max(sizeof(LObjectVar), sizeof(LRedirect));291 size_t size = lol::max(sizeof(LObjectVar), sizeof(LRedirect)); 292 292 293 293 LObjectVar *p = (LObjectVar *)LSpace::Current->Alloc(size); … … 301 301 if (addr == NULL) 302 302 return NULL; 303 size_t size = Max(sizeof(LPointer), sizeof(LRedirect));303 size_t size = lol::max(sizeof(LPointer), sizeof(LRedirect)); 304 304 305 305 LPointer *p = (LPointer *)LSpace::Current->Alloc(size); … … 311 311 LChar *LChar::Create(uint16_t ch) 312 312 { 313 size_t size = Max(sizeof(LChar), sizeof(LRedirect));313 size_t size = lol::max(sizeof(LChar), sizeof(LRedirect)); 314 314 315 315 LChar *c = (LChar *)LSpace::Current->Alloc(size); … … 336 336 struct LString *LString::Create(int length) 337 337 { 338 size_t size = Max(sizeof(LString) + length - 1, sizeof(LRedirect));338 size_t size = lol::max(sizeof(LString) + length - 1, sizeof(LRedirect)); 339 339 340 340 LString *s = (LString *)LSpace::Current->Alloc(size); … … 348 348 PtrRef r1(arg_list), r2(block_list); 349 349 350 size_t size = Max(sizeof(LUserFunction), sizeof(LRedirect));350 size_t size = lol::max(sizeof(LUserFunction), sizeof(LRedirect)); 351 351 352 352 LUserFunction *lu = (LUserFunction *)LSpace::Current->Alloc(size); … … 359 359 LSysFunction *new_lisp_sys_function(int min_args, int max_args, int fun_number) 360 360 { 361 size_t size = Max(sizeof(LSysFunction), sizeof(LRedirect));361 size_t size = lol::max(sizeof(LSysFunction), sizeof(LRedirect)); 362 362 363 363 // System functions should reside in permanant space … … 395 395 LSymbol *new_lisp_symbol(char *name) 396 396 { 397 size_t size = Max(sizeof(LSymbol), sizeof(LRedirect));397 size_t size = lol::max(sizeof(LSymbol), sizeof(LRedirect)); 398 398 399 399 LSymbol *s = (LSymbol *)LSpace::Current->Alloc(size); … … 412 412 LNumber *LNumber::Create(long num) 413 413 { 414 size_t size = Max(sizeof(LNumber), sizeof(LRedirect));414 size_t size = lol::max(sizeof(LNumber), sizeof(LRedirect)); 415 415 416 416 LNumber *n = (LNumber *)LSpace::Current->Alloc(size); … … 422 422 LList *LList::Create() 423 423 { 424 size_t size = Max(sizeof(LList), sizeof(LRedirect));424 size_t size = lol::max(sizeof(LList), sizeof(LRedirect)); 425 425 426 426 LList *c = (LList *)LSpace::Current->Alloc(size); … … 1062 1062 1063 1063 1064 char n[MAX_LISP_TOKEN_LEN]; // assume all tokens will be < 200 characters1064 static char token_buffer[MAX_LISP_TOKEN_LEN]; // assume all tokens will be < 200 characters 1065 1065 1066 1066 int end_of_program(char const *s) 1067 1067 { 1068 return !read_ltoken(s, n);1068 return !read_ltoken(s, token_buffer); 1069 1069 } 1070 1070 … … 1085 1085 LObject *ret = NULL; 1086 1086 1087 if (!read_ltoken(code, n))1087 if (!read_ltoken(code, token_buffer)) 1088 1088 lerror(NULL, "unexpected end of program"); 1089 1089 1090 if (!strcmp( n, "nil"))1090 if (!strcmp(token_buffer, "nil")) 1091 1091 return NULL; 1092 else if (toupper( n[0])=='T' && !n[1])1092 else if (toupper(token_buffer[0])=='T' && !token_buffer[1]) 1093 1093 return true_symbol; 1094 else if ( n[0]=='\'') // short hand for quote function1094 else if (token_buffer[0]=='\'') // short hand for quote function 1095 1095 { 1096 1096 LObject *cs = LList::Create(), *c2=NULL, *tmp; … … 1105 1105 ret=cs; 1106 1106 } 1107 else if ( n[0]=='`') // short hand for backquote function1107 else if (token_buffer[0]=='`') // short hand for backquote function 1108 1108 { 1109 1109 LObject *cs = LList::Create(), *c2=NULL, *tmp; … … 1117 1117 ((LList *)cs)->m_cdr = (LObject *)c2; 1118 1118 ret=cs; 1119 } else if ( n[0]==',') // short hand for comma function1119 } else if (token_buffer[0]==',') // short hand for comma function 1120 1120 { 1121 1121 LObject *cs = LList::Create(), *c2=NULL, *tmp; … … 1130 1130 ret=cs; 1131 1131 } 1132 else if ( n[0]=='(') // make a list of everything in ()1132 else if (token_buffer[0]=='(') // make a list of everything in () 1133 1133 { 1134 1134 void *first=NULL, *cur=NULL, *last=NULL; … … 1138 1138 { 1139 1139 char const *tmp=code; 1140 if (!read_ltoken(tmp, n)) // check for the end of the list1140 if (!read_ltoken(tmp, token_buffer)) // check for the end of the list 1141 1141 lerror(NULL, "unexpected end of program"); 1142 if ( n[0]==')')1142 if (token_buffer[0]==')') 1143 1143 { 1144 1144 done=1; 1145 read_ltoken(code, n); // read off the ')'1145 read_ltoken(code, token_buffer); // read off the ')' 1146 1146 } 1147 1147 else 1148 1148 { 1149 if ( n[0]=='.' && !n[1])1149 if (token_buffer[0]=='.' && !token_buffer[1]) 1150 1150 { 1151 1151 if (!first) … … 1154 1154 { 1155 1155 void *tmp; 1156 read_ltoken(code, n); // skip the '.'1156 read_ltoken(code, token_buffer); // skip the '.' 1157 1157 tmp=Compile(code); 1158 1158 ((LList *)last)->m_cdr = (LObject *)tmp; // link the last cdr to … … 1177 1177 ret=(LObject *)comp_optimize(first); 1178 1178 1179 } else if ( n[0]==')')1179 } else if (token_buffer[0]==')') 1180 1180 lerror(code, "mismatched )"); 1181 else if (isdigit( n[0]) || (n[0]=='-' && isdigit(n[1])))1181 else if (isdigit(token_buffer[0]) || (token_buffer[0]=='-' && isdigit(token_buffer[1]))) 1182 1182 { 1183 1183 LNumber *num = LNumber::Create(0); 1184 sscanf( n, "%ld", &num->m_num);1184 sscanf(token_buffer, "%ld", &num->m_num); 1185 1185 ret=num; 1186 } else if ( n[0]=='"')1186 } else if (token_buffer[0]=='"') 1187 1187 { 1188 1188 ret = LString::Create(str_token_len(code)); … … 1202 1202 *start=0; 1203 1203 code++; 1204 } else if ( n[0]=='#')1205 { 1206 if ( n[1]=='\\')1207 { 1208 read_ltoken(code, n); // read character name1209 if (!strcmp( n, "newline"))1204 } else if (token_buffer[0]=='#') 1205 { 1206 if (token_buffer[1]=='\\') 1207 { 1208 read_ltoken(code, token_buffer); // read character name 1209 if (!strcmp(token_buffer, "newline")) 1210 1210 ret = LChar::Create('\n'); 1211 else if (!strcmp( n, "space"))1211 else if (!strcmp(token_buffer, "space")) 1212 1212 ret = LChar::Create(' '); 1213 1213 else 1214 ret = LChar::Create( n[0]);1215 } 1216 else if ( n[1]==0) // short hand for function1214 ret = LChar::Create(token_buffer[0]); 1215 } 1216 else if (token_buffer[1]==0) // short hand for function 1217 1217 { 1218 1218 LObject *cs = LList::Create(), *c2=NULL, *tmp; … … 1228 1228 else 1229 1229 { 1230 lbreak("Unknown #\\ notation : %s\n", n);1230 lbreak("Unknown #\\ notation : %s\n", token_buffer); 1231 1231 exit(0); 1232 1232 } 1233 1233 } else { 1234 ret = LSymbol::FindOrCreate( n);1234 ret = LSymbol::FindOrCreate(token_buffer); 1235 1235 } 1236 1236 return ret; … … 3054 3054 PtrRef ref1(this); 3055 3055 3056 maxevaldepth = Max(maxevaldepth, ++evaldepth);3056 maxevaldepth = lol::max(maxevaldepth, ++evaldepth); 3057 3057 3058 3058 int tstart = trace_level; -
abuse/branches/lol/src/lisp/lisp_gc.cpp
r637 r687 87 87 LObject *ret = x; 88 88 89 maxgcdepth = Max(maxgcdepth, ++gcdepth);89 maxgcdepth = lol::max(maxgcdepth, ++gcdepth); 90 90 91 91 if ((uint8_t *)x >= cstart && (uint8_t *)x < cend) -
abuse/branches/lol/src/loader2.cpp
r682 r687 452 452 453 453 454 ERROR(nbacktiles,"No background tiles defined!");455 ERROR(nforetiles,"No foreground tiles defined!");456 ERROR(foretiles[0]>=0,"No black (0) foreground tile defined!");457 ERROR(backtiles[0]>=0,"No black (0) background tile defined!");458 ERROR(big_font_pict!=-1 || small_font_pict!=-1,459 "No font loaded (use load_big_font or load_small_font)!");460 f_wid =cache.foret(foretiles[0])->im->Size().x;461 f_hi =cache.foret(foretiles[0])->im->Size().y;462 b_wid =cache.backt(backtiles[0])->im->Size().x;463 b_hi =cache.backt(backtiles[0])->im->Size().y;454 ASSERT(nbacktiles, "no background tiles defined!"); 455 ASSERT(nforetiles, "no foreground tiles defined!"); 456 ASSERT(foretiles[0] >= 0, "no black (0) foreground tile defined!"); 457 ASSERT(backtiles[0] >= 0, "no black (0) background tile defined!"); 458 ASSERT(big_font_pict != -1 || small_font_pict != -1, 459 "no font loaded (use load_big_font or load_small_font)!"); 460 f_wid = cache.foret(foretiles[0])->im->Size().x; 461 f_hi = cache.foret(foretiles[0])->im->Size().y; 462 b_wid = cache.backt(backtiles[0])->im->Size().x; 463 b_hi = cache.backt(backtiles[0])->im->Size().y; 464 464 465 465 #if 0 … … 501 501 long l=fp->file_size(); 502 502 s=(char *)malloc(l+1); 503 ERROR(s,"Malloc error in load_script");503 ASSERT(s, "malloc error in load_script"); 504 504 505 505 fp->read(s,l); -
abuse/branches/lol/src/loadgame.cpp
r682 r687 70 70 for (i=0; i<total_saved; i++,y+=ih) 71 71 { 72 maxih = Max(ih, maxih);73 maxiw = Max(iw, maxiw);72 maxih = lol::max(ih, maxih); 73 maxiw = lol::max(iw, maxiw); 74 74 if (y >= lines * ih) 75 75 { -
abuse/branches/lol/src/menu.cpp
r686 r687 50 50 ivec2 caa, cbb; 51 51 main_screen->GetClip(caa, cbb); 52 aa = Max(aa, caa);53 bb = Min(bb, cbb);52 aa = lol::max(aa, caa); 53 bb = lol::min(bb, cbb); 54 54 55 55 if (!(aa < bb)) -
abuse/branches/lol/src/objects.cpp
r686 r687 240 240 int RC_type_size(int type) 241 241 { 242 switch (type) 243 { 244 case RC_8 : 245 { return 1; } break; 246 case RC_16 : 247 { return 2; } break; 248 case RC_32 : 249 { return 4; } break; 250 } 251 CHECK(0); 252 return 1; 242 switch (type) 243 { 244 case RC_8: return 1; 245 case RC_16: return 2; 246 case RC_32: return 4; 247 } 248 ASSERT(false); 249 return 1; 253 250 } 254 251 … … 389 386 ivec2 pos2 = the_game->GameToMouse(ivec2(x1, draw_to), v); 390 387 391 pos2.y = Max(v->m_aa.y, pos2.y);392 pos1.y = Min(v->m_bb.y, pos1.y);388 pos2.y = lol::max(v->m_aa.y, pos2.y); 389 pos1.y = lol::min(v->m_bb.y, pos1.y); 393 390 TransImage *p = picture(); 394 391 -
abuse/branches/lol/src/particle.cpp
r686 r687 41 41 void add_panim(int id, long x, long y, int dir) 42 42 { 43 CONDITION(id>=0 && id<total_pseqs,"bad id for particle animation");43 ASSERT(id >= 0 && id < total_pseqs, "bad id for particle animation"); 44 44 part_animation *pan=new part_animation(pseqs[id],x,y,dir,NULL); 45 45 if (!first_anim) … … 214 214 main_screen->GetClip(caa, cbb); 215 215 216 int t = 1 + Max(lol::abs(p2.x - p1.x), lol::abs(p2.y - p1.y));216 int t = 1 + lol::max(lol::abs(p2.x - p1.x), lol::abs(p2.y - p1.y)); 217 217 int xo = p1.x << 16, 218 218 yo = p1.y << 16, … … 244 244 main_screen->GetClip(caa, cbb); 245 245 246 int t = 1 + Max(lol::abs(p2.x - p1.x), lol::abs(p2.y - p1.y));246 int t = 1 + lol::max(lol::abs(p2.x - p1.x), lol::abs(p2.y - p1.y)); 247 247 int xo = p1.x << 16, 248 248 yo = p1.y << 16, -
abuse/branches/lol/src/sdlport/event.cpp
r682 r687 84 84 int x, y; 85 85 uint8_t buttons = SDL_GetMouseState(&x, &y); 86 x = Min((x << 16) / mouse_xscale, main_screen->Size().x - 1);87 y = Min((y << 16) / mouse_yscale, main_screen->Size().y - 1);86 x = lol::min((x << 16) / mouse_xscale, main_screen->Size().x - 1); 87 y = lol::min((y << 16) / mouse_yscale, main_screen->Size().y - 1); 88 88 ev.mouse_move.x = x; 89 89 ev.mouse_move.y = y; -
abuse/branches/lol/src/sdlport/video.cpp
r682 r687 241 241 return; 242 242 243 CHECK(x1 >= 0 && x2 >= x1 && y1 >= 0 && y2 >= y1); 243 ASSERT(x1 >= 0); 244 ASSERT(x2 >= x1); 245 ASSERT(y1 >= 0); 246 ASSERT(y2 >= y1); 244 247 245 248 // Adjust if we are trying to draw off the screen -
abuse/branches/lol/src/tool/abuse-tool.cpp
r682 r687 163 163 /* Try to print a representation of the item */ 164 164 int has_binary = 0; 165 for (int i = 0; i < Min(20, (int)se->size); i++)165 for (int i = 0; i < lol::min(20, (int)se->size); i++) 166 166 { 167 167 uint8_t ch = ((uint8_t *)se->data)[i]; … … 176 176 putchar('\"'); 177 177 178 size_t max = Min(has_binary ? 15 : 30, (int)se->size);178 size_t max = lol::min(has_binary ? 15 : 30, (int)se->size); 179 179 for (size_t i = 0; i < max; i++) 180 180 { … … 220 220 { 221 221 uint8_t buf[1024]; 222 int step = Min((int)todo, 1024);222 int step = lol::min((int)todo, 1024); 223 223 fp.read(buf, step); 224 224 fwrite(buf, step, 1, stdout); -
abuse/branches/lol/src/transp.cpp
r682 r687 25 25 ivec2 pos(x, y); 26 26 27 aa += Max(caa - pos, ivec2(0));28 bb -= Max(caa - pos, ivec2(0));29 pos = Max(caa, pos);27 aa += lol::max(caa - pos, ivec2(0)); 28 bb -= lol::max(caa - pos, ivec2(0)); 29 pos = lol::max(caa, pos); 30 30 31 bb = Min(bb, cbb - ivec2(1) - pos);31 bb = lol::min(bb, cbb - ivec2(1) - pos); 32 32 33 33 if (!(bb >= ivec2(0))) -
abuse/branches/lol/src/view.cpp
r682 r687 119 119 return pan_x; 120 120 121 return Max(0, m_lastpos.x - (m_bb.x - m_aa.x + 1) / 2 + m_shift.x + pan_x);121 return lol::max(0, m_lastpos.x - (m_bb.x - m_aa.x + 1) / 2 + m_shift.x + pan_x); 122 122 } 123 123 … … 127 127 return pan_x; 128 128 129 return Max(0, (m_lastlastpos.x + m_lastpos.x) / 2129 return lol::max(0, (m_lastlastpos.x + m_lastpos.x) / 2 130 130 - (m_bb.x - m_aa.x + 1) / 2 + m_shift.x + pan_x); 131 131 } … … 136 136 return pan_y; 137 137 138 return Max(0, m_lastpos.y - (m_bb.y - m_aa.y + 1) / 2 - m_shift.y + pan_y);138 return lol::max(0, m_lastpos.y - (m_bb.y - m_aa.y + 1) / 2 - m_shift.y + pan_y); 139 139 } 140 140 … … 144 144 return pan_y; 145 145 146 return Max(0, (m_lastlastpos.y + m_lastpos.y) / 2146 return lol::max(0, (m_lastlastpos.y + m_lastpos.y) / 2 147 147 - (m_bb.y - m_aa.y + 1) / 2 - m_shift.y + pan_y); 148 148 } … … 157 157 158 158 if (m_focus->x > m_lastpos.x) 159 m_lastpos.x = Max(m_lastpos.x, m_focus->x - no_xright);159 m_lastpos.x = lol::max(m_lastpos.x, m_focus->x - no_xright); 160 160 else if (m_focus->x < m_lastpos.x) 161 m_lastpos.x = Min(m_lastpos.x, m_focus->x + no_xleft);161 m_lastpos.x = lol::min(m_lastpos.x, m_focus->x + no_xleft); 162 162 163 163 if (m_focus->y > m_lastpos.y) 164 m_lastpos.y = Max(m_lastpos.y, m_focus->y - no_ybottom);164 m_lastpos.y = lol::max(m_lastpos.y, m_focus->y - no_ybottom); 165 165 else if (m_focus->y < m_lastpos.y) 166 m_lastpos.y = Min(m_lastpos.y, m_focus->y + no_ytop);166 m_lastpos.y = lol::min(m_lastpos.y, m_focus->y + no_ytop); 167 167 } 168 168
Note: See TracChangeset
for help on using the changeset viewer.