|
5 | 5 | // two points, with fast updates when changing reachability (e.g. on one machine
|
6 | 6 | // it was typically 0.2ms w/ 1024x1024 grid). Each grid square must be "open" or
|
7 | 7 | // "closed" (traversable or untraversable), and grid squares are only connected
|
8 |
| -// to their orthogonal neighbors, not diagonally. |
| 8 | +// to their orthogonal neighbors, not diagonally. |
9 | 9 | //
|
10 | 10 | // In one source file, create the implementation by doing something like this:
|
11 | 11 | //
|
|
17 | 17 | // The above creates an implementation that can run on maps up to 1024x1024.
|
18 | 18 | // Map sizes must be a multiple of (1<<(LOG2/2)) on each axis (e.g. 32 if LOG2=10,
|
19 | 19 | // 16 if LOG2=8, etc.) (You can just pad your map with untraversable space.)
|
20 |
| -// |
| 20 | +// |
21 | 21 | // MEMORY USAGE
|
22 | 22 | //
|
23 | 23 | // Uses about 6-7 bytes per grid square (e.g. 7MB for a 1024x1024 grid).
|
|
52 | 52 | // - function for setting a grid of squares at once (just use batching)
|
53 | 53 | //
|
54 | 54 | // LICENSE
|
55 |
| -// |
| 55 | +// |
56 | 56 | // See end of file for license information.
|
57 | 57 | //
|
58 | 58 | // ALGORITHM
|
@@ -435,7 +435,7 @@ static void stbcc__build_all_connections_for_cluster(stbcc_grid *g, int cx, int
|
435 | 435 | i = 0;
|
436 | 436 | j = 0;
|
437 | 437 | step_x = 0;
|
438 |
| - step_y = 1; |
| 438 | + step_y = 1; |
439 | 439 | n = STBCC__CLUSTER_SIZE_Y;
|
440 | 440 | break;
|
441 | 441 | case 2:
|
@@ -599,7 +599,7 @@ void stbcc_init_grid(stbcc_grid *g, unsigned char *map, int w, int h)
|
599 | 599 |
|
600 | 600 | #if 0
|
601 | 601 | for (j=0; j < STBCC__CLUSTER_COUNT_Y; ++j)
|
602 |
| - for (i=0; i < STBCC__CLUSTER_COUNT_X; ++i) |
| 602 | + for (i=0; i < STBCC__CLUSTER_COUNT_X; ++i) |
603 | 603 | g->cluster_dirty[j][i] = 0;
|
604 | 604 | #endif
|
605 | 605 |
|
@@ -699,7 +699,7 @@ static void stbcc__remove_clump_connection(stbcc_grid *g, int x1, int y1, int x2
|
699 | 699 | for (i=0; i < clump->num_adjacent; ++i)
|
700 | 700 | if (rc.clump_index == adj[i].clump_index &&
|
701 | 701 | rc.cluster_dx == adj[i].cluster_dx &&
|
702 |
| - rc.cluster_dy == adj[i].cluster_dy) |
| 702 | + rc.cluster_dy == adj[i].cluster_dy) |
703 | 703 | break;
|
704 | 704 |
|
705 | 705 | if (i < clump->num_adjacent)
|
@@ -736,7 +736,7 @@ static void stbcc__add_connections_to_adjacent_cluster(stbcc_grid *g, int cx, in
|
736 | 736 | i = 0;
|
737 | 737 | j = 0;
|
738 | 738 | step_x = 0;
|
739 |
| - step_y = 1; |
| 739 | + step_y = 1; |
740 | 740 | n = STBCC__CLUSTER_SIZE_Y;
|
741 | 741 | } else if (dy == -1) {
|
742 | 742 | i = 0;
|
@@ -797,7 +797,7 @@ static void stbcc__remove_connections_to_adjacent_cluster(stbcc_grid *g, int cx,
|
797 | 797 | i = 0;
|
798 | 798 | j = 0;
|
799 | 799 | step_x = 0;
|
800 |
| - step_y = 1; |
| 800 | + step_y = 1; |
801 | 801 | n = STBCC__CLUSTER_SIZE_Y;
|
802 | 802 | } else if (dy == -1) {
|
803 | 803 | i = 0;
|
@@ -1012,38 +1012,38 @@ This software is available under 2 licenses -- choose whichever you prefer.
|
1012 | 1012 | ------------------------------------------------------------------------------
|
1013 | 1013 | ALTERNATIVE A - MIT License
|
1014 | 1014 | Copyright (c) 2017 Sean Barrett
|
1015 |
| -Permission is hereby granted, free of charge, to any person obtaining a copy of |
1016 |
| -this software and associated documentation files (the "Software"), to deal in |
1017 |
| -the Software without restriction, including without limitation the rights to |
1018 |
| -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
1019 |
| -of the Software, and to permit persons to whom the Software is furnished to do |
| 1015 | +Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 1016 | +this software and associated documentation files (the "Software"), to deal in |
| 1017 | +the Software without restriction, including without limitation the rights to |
| 1018 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
| 1019 | +of the Software, and to permit persons to whom the Software is furnished to do |
1020 | 1020 | so, subject to the following conditions:
|
1021 |
| -The above copyright notice and this permission notice shall be included in all |
| 1021 | +The above copyright notice and this permission notice shall be included in all |
1022 | 1022 | copies or substantial portions of the Software.
|
1023 |
| -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
1024 |
| -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
1025 |
| -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
1026 |
| -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
1027 |
| -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
1028 |
| -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 1023 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 1024 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 1025 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 1026 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 1027 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 1028 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
1029 | 1029 | SOFTWARE.
|
1030 | 1030 | ------------------------------------------------------------------------------
|
1031 | 1031 | ALTERNATIVE B - Public Domain (www.unlicense.org)
|
1032 | 1032 | This is free and unencumbered software released into the public domain.
|
1033 |
| -Anyone is free to copy, modify, publish, use, compile, sell, or distribute this |
1034 |
| -software, either in source code form or as a compiled binary, for any purpose, |
| 1033 | +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this |
| 1034 | +software, either in source code form or as a compiled binary, for any purpose, |
1035 | 1035 | commercial or non-commercial, and by any means.
|
1036 |
| -In jurisdictions that recognize copyright laws, the author or authors of this |
1037 |
| -software dedicate any and all copyright interest in the software to the public |
1038 |
| -domain. We make this dedication for the benefit of the public at large and to |
1039 |
| -the detriment of our heirs and successors. We intend this dedication to be an |
1040 |
| -overt act of relinquishment in perpetuity of all present and future rights to |
| 1036 | +In jurisdictions that recognize copyright laws, the author or authors of this |
| 1037 | +software dedicate any and all copyright interest in the software to the public |
| 1038 | +domain. We make this dedication for the benefit of the public at large and to |
| 1039 | +the detriment of our heirs and successors. We intend this dedication to be an |
| 1040 | +overt act of relinquishment in perpetuity of all present and future rights to |
1041 | 1041 | this software under copyright law.
|
1042 |
| -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
1043 |
| -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
1044 |
| -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
1045 |
| -AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
1046 |
| -ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 1042 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 1043 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 1044 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 1045 | +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 1046 | +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
1047 | 1047 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1048 | 1048 | ------------------------------------------------------------------------------
|
1049 | 1049 | */
|
0 commit comments