The Castle Doctrine Forums

Discuss the massively-multiplayer home defense game.

You are not logged in.

#1 2014-04-02 10:55:14

DaVinci243
Member
Registered: 2014-03-27
Posts: 72

How to make your house automaticly - For community servers

This skidded code is presented to you by DaVinci.



WARNING: Following code is skidded. It includes a lot of shitty code. This is by all means to encourage you all to make yourself so it looks better than what mine is.

#include <iostream>
#include <fstream>
#include <string>

^^^^^^ Those are includes we need.

we are using namespace std.

string housemapstring (inHouseMap);
	string newmapdetector;
	string thenewrisingone;
	newmapdetector = "998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#0#0#0#0#0#0#0#0#0#999#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#998#0#0#0#0#0#";
	// The house adv. dupe
	size_t founddx = housemapstring.find(newmapdetector);
	ifstream dataFilex("Vinci/yourhouse.txt");
	getline(dataFilex,thenewrisingone);
	dataFilex.close();
	if (founddx != string::npos) {
		inHouseMap = thenewrisingone.c_str();
	}

^^^^^

Put this part to :sethousemap. above everything.




Now you are packed with the skid method of file reading!

It's time that you make a file existent as "Vinci/yourhouse.txt" OR OR OR change it to wtf you want.





This is how I made my starting houses.


noob programmer haking on open-source game.

Offline

#2 2014-04-03 12:49:00

DaVinci243
Member
Registered: 2014-03-27
Posts: 72

Re: How to make your house automaticly - For community servers

bump.


noob programmer haking on open-source game.

Offline

#3 2014-04-03 14:30:38

booper
Member
Registered: 2014-02-15
Posts: 35

Re: How to make your house automaticly - For community servers

to what end?

Offline

#4 2014-04-03 19:52:26

poor
Member
Registered: 2014-03-23
Posts: 113

Re: How to make your house automaticly - For community servers

DaVinci243 wrote:

bump.

shameless


"Safety" is relative
Current life: None; I'm quite dead.

Offline

#5 2014-04-07 10:39:16

DaVinci243
Member
Registered: 2014-03-27
Posts: 72

Re: How to make your house automaticly - For community servers

You'll have to do this to EditHouseGrid on game source files.


noob programmer haking on open-source game.

Offline

Board footer

Powered by FluxBB 1.5.8