Bug #357 ยป 0050-Correct-re-use-to-reuse.patch
client/goto.c | ||
---|---|---|
pf_path_print(return_path, LOG_GOTO_PATH);
|
||
if (goto_map->patrol.return_path != NULL) {
|
||
/* We cannot re-use old path because:
|
||
/* We cannot reuse old path because:
|
||
* 1- the start tile isn't the same.
|
||
* 2- the turn number neither (impossible to do in backward mode). */
|
||
goto_path_undraw(goto_map->patrol.return_path);
|
client/tilespec.c | ||
---|---|---|
/*
|
||
* There may be more orientations available in this tileset than are
|
||
* needed, if an oriented unit set has been re-used between tilesets.
|
||
* needed, if an oriented unit set has been reused between tilesets.
|
||
*
|
||
* Don't bother loading unused ones, unless they might be used by
|
||
* unit_default_orientation (logic here mirrors get_unittype_sprite()).
|
common/aicore/path_finding.c | ||
---|---|---|
/************************************************************************//**
|
||
Replace the position. Reference count of the old pos is reduced by one,
|
||
but it likely lives on via other references.
|
||
If reference count goes to zero, re-use the memory instead of
|
||
If reference count goes to zero, reuse the memory instead of
|
||
freeing and allocating again.
|
||
****************************************************************************/
|
||
static inline struct pf_fuel_pos *
|
data/trident/tiles.spec | ||
---|---|---|
; For hills, forest and mountains don't currently have a full set,
|
||
; re-use values but provide for future expansion; current sets
|
||
; reuse values but provide for future expansion; current sets
|
||
; effectively ignore N/S terrain.
|
||
; Hills, and whether terrain to north, south, east, west
|
utility/astring.c | ||
---|---|---|
One pattern for using astr_str() is to replace static buffers in
|
||
functions that return a pointer to static storage. Where previously
|
||
you would have had e.g. "static struct buf[128]" with an arbitrary
|
||
size limit, you can have "static struct astring buf", and re-use the
|
||
same astring on subsequent calls; the caller should behave the
|
||
same (only reading the string and not freeing it).
|
||
size limit, you can have "static struct astring buf", and reuse
|
||
the same astring on subsequent calls; the caller should behave
|
||
the same (only reading the string and not freeing it).
|
||
***********************************************************************/
|
||
utility/inputfile.c | ||
---|---|---|
astr_free(&inf->token);
|
||
astr_free(&inf->partial);
|
||
/* assign zeros for safety if accidently re-use etc: */
|
||
/* Assign zeros for safety if accidently reuse etc: */
|
||
init_zeros(inf);
|
||
inf->magic = ~INF_MAGIC;
|
||