diff options
| author | Tyge Løvset <[email protected]> | 2022-04-18 00:44:51 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-04-18 00:44:51 +0200 |
| commit | 00804d9ff488f63468a0bb528c7b807aea7c3ea3 (patch) | |
| tree | 51b47787adc853bd1a10ec820a6ef5c184fa2498 /examples/astar.c | |
| parent | 4436a1c0ac37dc2e73a2134d5ad85c010340b35d (diff) | |
| download | STC-modified-00804d9ff488f63468a0bb528c7b807aea7c3ea3.tar.gz STC-modified-00804d9ff488f63468a0bb528c7b807aea7c3ea3.zip | |
Converted all example to use cstr_str(&s) instead of s.str to allow SSO string. Fixed misc warnings.
Diffstat (limited to 'examples/astar.c')
| -rw-r--r-- | examples/astar.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/astar.c b/examples/astar.c index ee002b79..bce03716 100644 --- a/examples/astar.c +++ b/examples/astar.c @@ -105,7 +105,7 @@ astar(cstr* maze, int width) point delta = deltas[i];
point next = point_init(current.x + delta.x, current.y + delta.y, width);
int new_cost = *csmap_pcost_at(&costs, current);
- if (maze->str[point_index(&next)] != '#')
+ if (cstr_str(maze)[point_index(&next)] != '#')
{
const csmap_pcost_value *cost = csmap_pcost_get(&costs, next);
if (cost == NULL || new_cost < cost->second)
@@ -160,8 +160,8 @@ main(void) int width = cstr_find(maze, "\n") + 1;
c_autovar (cdeq_point path = astar(&maze, width), cdeq_point_drop(&path))
{
- c_foreach (it, cdeq_point, path) maze.str[point_index(it.ref)] = 'x';
- printf("%s", maze.str);
+ c_foreach (it, cdeq_point, path) cstr_data(&maze)[point_index(it.ref)] = 'x';
+ printf("%s", cstr_str(&maze));
}
}
}
|
