Changeset - r11284:ee8c04942ac9
[Not reviewed]
master
0 1 0
truebrain - 15 years ago 2009-03-07 20:55:24
truebrain@openttd.org
(svn r15638) -Fix: there is a time in your life you should stop coding for a project. You know that time is there when you make two huge mistakes in just 10 lines of code. I wish you all the best of luck :) (ps: HUGE mistakes!)
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_config.cpp
Show inline comments
 
@@ -204,9 +204,10 @@ void AIConfig::SettingsToString(char *st
 
		snprintf(no, sizeof(no), "%d", (*it).second);
 

	
 
		/* Check if the string would fit in the destination */
 
		size -= strlen((*it).first) - 1 - strlen(no) - 1;
 
		size_t needed_size = strlen((*it).first) + 1 + strlen(no) + 1;
 
		/* If it doesn't fit, skip the next settings */
 
		if (size <= 0) return;
 
		if (size <= needed_size) break;
 
		size -= needed_size;
 

	
 
		strcat(string, (*it).first);
 
		strcat(string, "=");
0 comments (0 inline, 0 general)